/*++

Copyright (c) 1995  Microsoft Corporation

Module Name:

    nntp.idl

Abstract:

    Contains the Nntp RPC interface specification for the NNTP server.
    This includes API from the following catagories:



    Also contains the RPC specific data structures for these API.

Author:

        Johnson Apacible (johnsona)     13-Oct-1995
        Based on srvsvc.idl code from DanL and JohnsonA

Environment:

    User Mode - Win32 - MIDL

Revision History:

--*/


//
// Interface Attributes
//

[
    uuid(4f82f460-0e21-11cf-909e-00805f48a135),
    version(4.0),
#ifdef __midl
	ms_union,
#endif // __midl
    pointer_default(unique)
]


interface nntp


{

import   "import.idl";
#include <lmcons.h>

//
// BUGBUG - take this definition out when midl understands LPWSTR etc
//

typedef [handle] LPWSTR  NNTP_HANDLE;
typedef [handle] LPWSTR  NNTP_IMPERSONATE_HANDLE;

//
// Structures - Nntp
//

NET_API_STATUS
NntprQueryStatistics(
    [in,string,unique] NNTP_HANDLE          ServerName,
    [in]        DWORD                       InstanceId,
    [in]        DWORD                       Level,
    [out]       LPNNTP_STATISTICS_0         *StatInfo
    );

NET_API_STATUS
NntprClearStatistics(
    [in,string,unique] NNTP_HANDLE          ServerName,
    [in]        DWORD                       InstanceId
    );

//
// Feed information
//

typedef struct _I_FEED_INFO {

    [string] LPWSTR ServerName;
    FEED_TYPE       FeedType;

    FILETIME        PullRequestTime;
    FILETIME        StartTime;
    FILETIME        NextActiveTimeHigh;

    DWORD           FeedInterval;
    DWORD           FeedId;
    BOOL            AutoCreate;
	BOOL			Enabled ;

    DWORD           cbNewsgroups;
    [size_is(cbNewsgroups)] PUCHAR Newsgroups;
    DWORD           cbDistribution;
    [size_is(cbDistribution)] PUCHAR Distribution;
	DWORD			cbUucpName ;
	[size_is(cbUucpName),unique]	PUCHAR	UucpName ;
	DWORD			cbFeedTempDirectory ;
	[size_is(cbFeedTempDirectory),unique]	PUCHAR	FeedTempDirectory ;

	DWORD			MaxConnectAttempts ;
	DWORD			ConcurrentSessions ;

	//
	//	Feed security settings - for outgoing feeds only !
	//

	DWORD			SessionSecurityType ;

	DWORD			AuthenticationSecurityType ;
	DWORD			cbAccountName ;
	[size_is(cbAccountName),unique]	PUCHAR	NntpAccountName ;
	DWORD			cbPassword ;
	[size_is(cbPassword),unique]	PUCHAR	NntpPassword ;

	BOOL			fAllowControlMessages;
	DWORD			OutgoingPort;
	DWORD			FeedPairId;

} I_FEED_INFO, *LPI_FEED_INFO;

typedef struct _NNTP_FEED_ENUM_STRUCT {
    DWORD   EntriesRead;
    [size_is(EntriesRead)] LPI_FEED_INFO Buffer;
} NNTP_FEED_ENUM_STRUCT, *LPNNTP_FEED_ENUM_STRUCT;

//
// Feed APIs
//

NET_API_STATUS
NET_API_FUNCTION
NntprEnumerateFeeds(
    [in,string,unique]  NNTP_HANDLE      ServerName,
    [in]        DWORD                    InstanceId,
    [out]               LPNNTP_FEED_ENUM_STRUCT Buffer
    );

NET_API_STATUS
NET_API_FUNCTION
NntprGetFeedInformation(
    [in,string,unique]  NNTP_HANDLE     ServerName,
    [in]				DWORD           InstanceId,
    [in]                DWORD           FileId,
    [out]               LPI_FEED_INFO   *Buffer
    );

NET_API_STATUS
NET_API_FUNCTION
NntprSetFeedInformation(
    [in,string,unique]  NNTP_HANDLE     ServerName,
    [in]				DWORD           InstanceId,
    [in]                LPI_FEED_INFO   FeedInfo,
    [in,out,unique]     LPDWORD         ParmErr
    );

NET_API_STATUS
NET_API_FUNCTION
NntprAddFeed(
    [in,string,unique]  NNTP_HANDLE     ServerName,
    [in]				DWORD           InstanceId,
    [in]                LPI_FEED_INFO   FeedInfo,
    [in,out,unique]     LPDWORD         ParmErr,
	[out]				LPDWORD			pdwFeedId
    );

NET_API_STATUS
NET_API_FUNCTION
NntprDeleteFeed(
    [in,string,unique]  NNTP_HANDLE     ServerName,
    [in]				DWORD           InstanceId,
    [in]                DWORD           FeedId
    );

NET_API_STATUS
NET_API_FUNCTION
NntprEnableFeed(
	[in,string,unique]	NNTP_HANDLE		ServerName,
    [in]				DWORD           InstanceId,
	[in]				DWORD			FeedId,
	[in]				BOOL			Enable,
	[in]				BOOL			Refill,
	[in]				FILETIME		RefillTime 
	) ;

typedef struct _NNTP_SESS_ENUM_STRUCT {
    DWORD   EntriesRead;
    [size_is(EntriesRead)] LPNNTP_SESSION_INFO Buffer;
} NNTP_SESS_ENUM_STRUCT, *LPNNTP_SESS_ENUM_STRUCT;


//
// Session APIs
//

NET_API_STATUS
NET_API_FUNCTION
NntprEnumerateSessions(
    [in,string,unique]  NNTP_HANDLE      ServerName,
    [in]				DWORD            InstanceId,
    [out]               LPNNTP_SESS_ENUM_STRUCT Buffer
    );

NET_API_STATUS
NET_API_FUNCTION
NntprTerminateSession(
    [in,string,unique]  NNTP_HANDLE     ServerName,
    [in]				DWORD           InstanceId,
    [in,string,unique]  LPSTR           UserName,
    [in,string,unique]  LPSTR           IPAddress
    );


//
//	Expiration structures and APIs
//


typedef	struct	_I_EXPIRE_INFO	{
	//
	//	Expiration policies are numbered
	//
	DWORD		ExpireId ;

	//
	//	Units of Megabytes
	//
	DWORD		ExpireSizeHorizon ;

	//
	//	In retail builds - units of hours, debug builds - units of ??
	//
	DWORD		ExpireTime ;

	DWORD		cbNewsgroups ;
	[size_is(cbNewsgroups)] PUCHAR Newsgroups;

	//
	//	Expire policy name
	//
    [string] LPWSTR ExpirePolicy;

} I_EXPIRE_INFO, *LPI_EXPIRE_INFO ;

typedef struct _NNTP_EXPIRE_ENUM_STRUCT	{
    DWORD   EntriesRead;
    [size_is(EntriesRead)] LPI_EXPIRE_INFO	Buffer;
} NNTP_EXPIRE_ENUM_STRUCT, *LPNNTP_EXPIRE_ENUM_STRUCT ;

NET_API_STATUS
NET_API_FUNCTION
NntprEnumerateExpires(
	[in,string,unique]	NNTP_HANDLE					ServerName,
    [in]				DWORD                       InstanceId,
	[out]				LPNNTP_EXPIRE_ENUM_STRUCT	Buffer 
	) ;

NET_API_STATUS
NET_API_FUNCTION
NntprAddExpire(
	[in,string,unique]	NNTP_HANDLE			ServerName,
    [in]				DWORD               InstanceId,
	[in]				LPI_EXPIRE_INFO		ExpireInfo,
	[in,out,unique]		LPDWORD				ParmErr,
	[out]				LPDWORD				pdwExpireId
	) ;


NET_API_STATUS
NET_API_FUNCTION
NntprDeleteExpire(
	[in,string,unique]	NNTP_HANDLE			ServerName,
    [in]				DWORD               InstanceId,
	[in]				DWORD				ExpireId 
	) ;

//
//	For some reason this approach generates bad stubs - try another !
//
//NET_API_STATUS
//NET_API_FUNCTION
//NntprGetExpireInformation(
//	[in,string,unique]	NNTP_HANDLE			ServerName,
//	[in]				DWORD				ExpireId,
//	[out]				LPI_EXPIRE_INFO		*Buffer
//	) ;


NET_API_STATUS
NET_API_FUNCTION
NntprGetExpireInformation(
	[in,string,unique]	NNTP_HANDLE			ServerName,
    [in]				DWORD               InstanceId,
	[in]				DWORD				ExpireId,
	[out]				LPNNTP_EXPIRE_ENUM_STRUCT	Buffer
	) ;


NET_API_STATUS
NET_API_FUNCTION
NntprSetExpireInformation(
	[in,string,unique]	NNTP_HANDLE			ServerName,
    [in]				DWORD               InstanceId,
	[in]				LPI_EXPIRE_INFO		ExpireInfo,
	[in,out,unique]		LPDWORD				ParmErr
	) ;


typedef	struct	_I_NEWSGROUP_INFO	{

	//
	//	Name of the newsgroup - must always be provided
	//
	DWORD		cbNewsgroup ;
	[size_is(cbNewsgroup)]	PUCHAR	Newsgroup ;
		
	DWORD		cbDescription ;
	[size_is(cbDescription),unique]	PUCHAR	Description ;

	DWORD		cbModerator ;
	[size_is(cbModerator),unique]	PUCHAR	Moderator ;

	BOOL		fIsModerated ;
	
	BOOL		ReadOnly ;
	
	DWORD		cbPrettyname ;
	[size_is(cbPrettyname),unique]	PUCHAR	Prettyname ;

	FILETIME	ftCreationDate;

}	I_NEWSGROUP_INFO,	*LPI_NEWSGROUP_INFO ;

NET_API_STATUS
NET_API_FUNCTION
NntprGetNewsgroup(	
		[in,string,unique]	NNTP_HANDLE	ServerName,
		[in]				DWORD       InstanceId,
		[in,out]			LPI_NEWSGROUP_INFO	*NewsgroupInfo 
		) ;

NET_API_STATUS
NET_API_FUNCTION
NntprSetNewsgroup(	
		[in,string,unique]	NNTP_HANDLE	ServerName,
		[in]				DWORD       InstanceId,
		[in]				LPI_NEWSGROUP_INFO	NewsgroupInfo 
		) ;

NET_API_STATUS
NET_API_FUNCTION
NntprCreateNewsgroup(
		[in,string,unique]	NNTP_HANDLE	ServerName,
		[in]				DWORD       InstanceId,
		[in]				LPI_NEWSGROUP_INFO	NewsgroupInfo
		) ;

NET_API_STATUS
NET_API_FUNCTION
NntprDeleteNewsgroup(
		[in,string,unique]	NNTP_HANDLE	ServerName,
		[in]				DWORD       InstanceId,
		[in]				LPI_NEWSGROUP_INFO	NewsgroupInfo
		) ;

//
// Find APIs
//

NET_API_STATUS
NntprFindNewsgroup(
    [in,string,unique] NNTP_HANDLE      ServerName,
    [in]			   DWORD            InstanceId,
    [in,string,unique] NNTP_HANDLE      NewsgroupPrefix,
	[in]  DWORD							MaxResults,
	[out] LPDWORD						pdwResultsFound,
    [out] LPNNTP_FIND_LIST				*ppFindList
    );

//
// Admin APIs
//

typedef	struct	_I_NNTP_CONFIG_INFO	{

    DWORD		FieldControl;

	BOOL		AllowClientPosting ;

	BOOL		AllowFeedPosting ;

	[string] LPSTR		Organization ;

	DWORD		ServerPostHardLimit ;		
	DWORD		ServerPostSoftLimit ;

	DWORD		ServerFeedHardLimit ;
	DWORD		ServerFeedSoftLimit ;

	DWORD		dwEncCaps;

	[string] LPWSTR		SmtpServerAddress;

	[string] LPWSTR		UucpServerName;

	BOOL		AllowControlMessages;

	[string] LPWSTR		DefaultModerator;

}	I_NNTP_CONFIG_INFO,	*LPI_NNTP_CONFIG_INFO ;




NET_API_STATUS
NET_API_FUNCTION
NntprGetAdminInformation(
    [in,string,unique] NNTP_HANDLE          ServerName,
    [in]			   DWORD                InstanceId,
    [out]              LPI_NNTP_CONFIG_INFO* ConfigInfo
    );

NET_API_STATUS
NET_API_FUNCTION
NntprSetAdminInformation(
    [in,string,unique]  NNTP_HANDLE     ServerName,
    [in]				DWORD           InstanceId,
    [in]	    LPI_NNTP_CONFIG_INFO    ConfigInfo,
    [in,out,unique]     LPDWORD         ParmErr
    );

//
//	Nntpbld structs and RPCs
//

typedef struct _I_NNTPBLD_INFO	{

	//
	//	Verbosity of reporting
	//
	BOOL	Verbose ;

	//
	//	Specify whether to blow away all old data structures 
	//
	BOOL	DoClean ;

	//
	//	If TRUE then don't delete the history file regardless of other settings.
	//
	BOOL	NoHistoryDelete ;

	//
	//	0x00000000 for thorough ie delete all index files
	//	0x00000001 for standard ie reuse all index files
	//  0x00000010 for medium   ie validate index files
	//
	DWORD	ReuseIndexFiles ;

	//
	//	If TRUE, omit non-leaf dirs
	//
	BOOL	OmitNonleafDirs ;

	//
	//	Name of a file containing either an INN style 'Active' file or 
	//	a tool generated newsgroup list file.  Either way, we will suck
	//	newsgroups out of this file and use them to build a news tree.	
	//
	DWORD	cbGroupFile ;
	[string] LPWSTR	szGroupFile ;
	
	//
	//	Name of report file
	//
	DWORD	cbReportFile ;
	[string] LPWSTR	szReportFile ;

	//
	//	If TRUE then szGroupFile specifies an INN style Active file,
	//	otherwise it specifies a tool generated human edit newsgroup list.
	//
	BOOL IsActiveFile ;	

	//
	//	Number of rebuild threads
	//

	DWORD NumThreads ;

} I_NNTPBLD_INFO, *LPI_NNTPBLD_INFO ;

//
// Nntpbld RPCs
//
//

NET_API_STATUS
NET_API_FUNCTION
NntprStartRebuild(
    [in,string,unique]	NNTP_HANDLE			ServerName,
    [in]				DWORD				InstanceId,
    [in]				LPI_NNTPBLD_INFO	pBuildInfo,
    [in,out,unique]     LPDWORD				ParmErr
    );

NET_API_STATUS
NET_API_FUNCTION
NntprGetBuildStatus(
    [in,string,unique]	NNTP_HANDLE			ServerName,
    [in]				DWORD				InstanceId,
    [in]				BOOL				fCancel,
    [out]				LPDWORD				pdwProgress
    );

#if 0
//
// Directory Drop APIs
//
NET_API_STATUS
NET_API_FUNCTION
NntprAddDropNewsgroup(
	[in,string,unique]	NNTP_HANDLE			ServerName,
	[in]				DWORD				InstanceId,
	[in,string]			LPCSTR				szNewsgroup);

NET_API_STATUS
NET_API_FUNCTION
NntprRemoveDropNewsgroup(
	[in,string,unique]	NNTP_HANDLE			ServerName,
	[in]				DWORD				InstanceId,
	[in,string]			LPCSTR				szNewsgroup);
#endif

//
// CancelMessage API
//
NET_API_STATUS
NET_API_FUNCTION
NntprCancelMessageID(
	[in,string,unique]	NNTP_HANDLE			ServerName,
	[in]				DWORD				InstanceId,
	[in,string]			LPCSTR				szMessageID);

//
// VRoot status API
NET_API_STATUS
NET_API_FUNCTION
NntprGetVRootWin32Error(
    [in,string,unique]  NNTP_HANDLE         ServerName,
    [in]                DWORD               InstanceId,
    [in,string]         LPWSTR              wszVRootPath,
    [out]               DWORD*              pdwWin32Error );
}