
/*
 * AVMNWAPI.H
 *
 * Header file to be used with AVMNWAPI.LIB
 *
 * windows.h (or stdafx.h) required for some basic definitions
 * 
 * Version: 1.83 20.12.2002
 */

#ifdef _INC_WINDOWS

#ifndef __AVMNWAPI_H__
#define __AVMNWAPI_H__


// --------------------------------------------------------------------------
// General Definitions
// --------------------------------------------------------------------------

typedef unsigned int AVMNW_RESULT;

#ifndef AVMNWAPI_INC_DATA

// DON'T define AVMNWAPI_IMPLEMENT when you just use the API
#ifdef AVMNWAPI_IMPLEMENT
#define AVMNWFUNC __declspec(dllexport) AVMNW_RESULT PASCAL
#else
#define AVMNWFUNC __declspec(dllimport) AVMNW_RESULT PASCAL
#endif

#endif // AVMNWAPI_INC_DATA


#define AVMNW_OK					0
#define AVMNW_ERROR					1
#define AVMNW_ERROR_FAILED			2
#define AVMNW_ERROR_PARAM			3
#define AVMNW_ERROR_BUSY			4
#define AVMNW_ERROR_DB				5
#define AVMNW_ERROR_NOTFOUND		6
#define AVMNW_ERROR_NOTSUPPORTED	7
#define AVMNW_ERROR_CONFIG			8
#define AVMNW_ERROR_ATTRIB			9
#define AVMNW_ERROR_EXIST			10
#define AVMNW_ERROR_PARTLY			11
#define AVMNW_ERROR_MEM				12
#define AVMNW_ERROR_NONE			13



// --------------------------------------------------------------------------
// General Functions
// --------------------------------------------------------------------------

#ifndef AVMNWAPI_INC_DATA

AVMNWFUNC AVMNW_Register(void *pReserved);
AVMNWFUNC AVMNW_Unregister(void);

#endif // AVMNWAPI_INC_DATA

// --------------------------------------------------------------------------
// Configuration
// --------------------------------------------------------------------------

typedef DWORD	AVMNW_IP_ADDRESS;
typedef BYTE	AVMNW_IP_MASK;


#pragma pack(4)
struct AVMNW_IPRoute {
	unsigned int nSize; // sizeof(IPRoute)
	BOOL bActive;
	AVMNW_IP_ADDRESS	TargetIPAddress;
	AVMNW_IP_MASK		TargetIPMask;
	DWORD Metric;
};
#pragma pack()


// --- Object Types --------------------------------------------------------

typedef unsigned int AVMNW_ObjectType; // v1.52

#define AVMNW_ObjectType_IPWANRoute		1
#define AVMNW_ObjectType_Target			2
#define AVMNW_ObjectType_Product		3
#define AVMNW_ObjectType_Controller		4
#define AVMNW_ObjectType_IPXWANRoute	5
#define AVMNW_ObjectType_SAPService		6
#define AVMNW_ObjectType_IPXSAPFilterSet 7
#define AVMNW_ObjectType_IPXSAPFilterRule 8
#define AVMNW_ObjectType_Usergroup		9
#define AVMNW_ObjectType_User			10
#define AVMNW_ObjectType_CLI			11

#define AVMNW_ObjectType_IPSecPolicy	12
#define AVMNW_ObjectType_IPFilterSet	13
#define AVMNW_ObjectType_IPFilterRule	14
#define AVMNW_ObjectType_IPService		15
#define AVMNW_ObjectType_IPBinding		16
#define AVMNW_ObjectType_IPMasqForwardSet	17
#define AVMNW_ObjectType_IPMasqForwardRule	18


#define	AVMNW_LAST_OBJECTTYPE			18

// --- Attributes --------------------------------------------------------

typedef unsigned int AVMNW_Attrib;

// Generic Attribute
#define AVMNW_Attrib_nID						99

// Controller Attributes
#define AVMNW_Attrib_nCAPI20Controller			100 // also in Target for channel reservation
#define AVMNW_Attrib_szMSN						101
#define AVMNW_Attrib_bPBX						102
#define AVMNW_Attrib_szOutsideLineAccess		103
#define AVMNW_Attrib_nLengthOfOutsideNumbers	104
#define AVMNW_Attrib_bIgnoreIncomingCalls		105
//      AVMNW_Attrib_nMaxMonthlyCharge			// (NetWAYS only)	
//      AVMNW_Attrib_nMaxMonthlyPhysicalUpTime		// (NetWAYS only) in full hours
//      AVMNW_Attrib_nMaxMonthlyOutgoingCalls		// (NetWAYS only)


#define AVMNW_Attrib_szNumber					106
#define AVMNW_Attrib_szPBXExtension				107
#define AVMNW_Attrib_szAreaCode					109
#define AVMNW_Attrib_szCountryCode				110
#define AVMNW_Attrib_szIntDialPrefix			111

#define AVMNW_Attrib_nRetryNumber				112
#define AVMNW_Attrib_bRetryUnlimited			113
#define AVMNW_Attrib_nRetryPause				114
#define AVMNW_Attrib_bRetryCountNotAll			115
#define AVMNW_Attrib_bRetryOnConnectionerror	116	
#define AVMNW_Attrib_nRetryOnConnectionerrorPause 117
#define AVMNW_Attrib_bADSLController			118	// added 14.9.01


// Target Attributes
#define AVMNW_Attrib_szISDNNumber				120
#define AVMNW_Attrib_szOutboundUsername			121
#define AVMNW_Attrib_szOutboundPassword			122
#define AVMNW_Attrib_nInboundAuthentication		123
#define AVMNW_Attrib_szInboundUsername			124
#define AVMNW_Attrib_szInboundPassword			125
#define AVMNW_Attrib_bActive					126
#define AVMNW_Attrib_szDNSExclusivePattern		127
#define AVMNW_Attrib_FirstStaticIPRoute			128
#define AVMNW_Attrib_nShortHoldMode				129		
#define AVMNW_Attrib_nInactivityTimeout			130
#define AVMNW_Attrib_nDisconnectMode			131
#define AVMNW_Attrib_nDisconnectTimeout			132
#define AVMNW_Attrib_bIPMasquerade				133
#define AVMNW_Attrib_nIPMasqueradeAddress		134
#define AVMNW_Attrib_bIPActivated				135
#define AVMNW_Attrib_bIPXActivated				136
#define AVMNW_Attrib_nActiveMode				137
#define AVMNW_Attrib_szCLI						138 // NetWAYS/ISDN only
#define AVMNW_Attrib_nUseIPGateway				139	// NetWAYS/ISDN only
#define AVMNW_Attrib_szName						140
#define AVMNW_Attrib_bIPMasqueradeIncoming		141	// NetWAYS/ISDN only
#define AVMNW_Attrib_bSNMPOverIPFilter			142
#define AVMNW_Attrib_bSNMPOverIPXFilter			143
#define AVMNW_Attrib_nDataEncryption			144
#define AVMNW_Attrib_bRemoteNode			145	// read only, not in NetWAYS/ISDN
#define AVMNW_Attrib_szProviderCode			146
#define AVMNW_Attrib_szAlternateISDNNumber		147 // added 14.9.2001
#define AVMNW_Attrib_bSPXSpoofing			148 // NetWAYS/ISDN only added 17.09.2001
#define AVMNW_Attrib_bWatchdogSpoofing		149 // NetWAYS/ISDN only added 17.09.2001
#define AVMNW_Attrib_bIPMulticastFilter		150 // NetWAYS/ISDN only added 17.09.2001
#define AVMNW_Attrib_bNetbiosOverIPSpoofing		151
#define AVMNW_Attrib_bNetbiosOverIPOutboundFilter 152
#define AVMNW_Attrib_bHeaderCompression		153
#define AVMNW_Attrib_bDataCompression		154


// prodcut attributes
#define AVMNW_Attrib_nMaxMonthlyCharge			155
#define AVMNW_Attrib_nMaxWeeklyCharge			156
#define AVMNW_Attrib_nMaxDailyCharge			157
#define AVMNW_Attrib_nMaxMonthlyPhysicalUpTime	158
#define AVMNW_Attrib_nMaxWeeklyPhysicalUpTime	159
#define AVMNW_Attrib_nMaxDailyPhysicalUpTime	160
#define AVMNW_Attrib_nMaxMonthlyOutgoingCalls	161
#define AVMNW_Attrib_nMaxWeeklyOutgoingCalls	162
#define AVMNW_Attrib_nMaxDailyOutgoingCalls		163
#define AVMNW_Attrib_bNoWanWanRouting			164

#define AVMNW_Attrib_nIPMasqForwardSetID		165

// mixed product/target Attributes
#define AVMNW_Attrib_bCLICheck					170
#define AVMNW_Attrib_szFirstCLI					171
#define AVMNW_Attrib_nSAPInputFilterSetID		172
#define AVMNW_Attrib_nSAPOutputFilterSetID		173

#define AVMNW_Attrib_bEnableUserCLI				174

// IPWANRoute Attributes
//      AVMNW_Attrib_nID
#define AVMNW_Attrib_IPRoute					180
#define AVMNW_Attrib_nTargetID					181

// IPXWANRoute Attributes
//      AVMNW_Attrib_nID
//      AVMNW_Attrib_nTargetID
#define AVMNW_Attrib_IPXNetAddress				190
#define AVMNW_Attrib_nHopCount					191
#define AVMNW_Attrib_nTicks						192

// SAPService Attributes
//      AVMNW_Attrib_nID
//      AVMNW_Attrib_nTargetID
//      AVMNW_Attrib_IPXNetAddress
#define AVMNW_Attrib_nServiceType				196
#define AVMNW_Attrib_szServiceName				197			
#define AVMNW_Attrib_nSocket					198
//      AVMNW_Attrib_nHopCount
//      AVMNW_Attrib_nTicks

// IPXSAPFilterSet Attributes
//      AVMNW_Attrib_nID
#define AVMNW_Attrib_bIsInputFilter				200
#define AVMNW_Attrib_bDefaultPolicyAccept		201

// IPXSAPFilterRule Attributes
//      AVMNW_Attrib_nID
#define AVMNW_Attrib_nIPXSAPFilterSetID			210
#define AVMNW_Attrib_bPolicyAccept				211
//      AVMNW_Attrib_szServiceName
//      AVMNW_Attrib_nServiceType
//      AVMNW_Attrib_nTargetID

// Usergroup and User Attributes
#define AVMNW_Attrib_bDisabled					250
#define AVMNW_Attrib_nUsergroupID				251
#define AVMNW_Attrib_IPAddress					252
#define AVMNW_Attrib_szComment					253

// CLI Attributes
#define AVMNW_Attrib_nUserID					270



// IPSecPolicy Attributes
#define AVMNW_Attrib_bTunnel					280
#define AVMNW_Attrib_LocalIPAddress				281	
#define AVMNW_Attrib_RemoteIPAddress			282	
#define AVMNW_Attrib_VirtualIPAddress			283
#define AVMNW_Attrib_nIPFilterSetID				284
#define AVMNW_Attrib_nIPBindingID				285
#define AVMNW_Attrib_szIdp1local				286
#define AVMNW_Attrib_szIdp1Remote				287
#define AVMNW_Attrib_nMode						288
#define AVMNW_Attrib_szPhase1ss					289
#define AVMNW_Attrib_nKeyType					290
#define AVMNW_Attrib_szKey						291
#define AVMNW_Attrib_szIdp2local				292
#define AVMNW_Attrib_szIdp2Remote				293
#define AVMNW_Attrib_szPhase2ss					294
#define AVMNW_Attrib_szRemoteHostname			295
#define AVMNW_Attrib_bXAuth						296
#define AVMNW_Attrib_szXAuthUsername			297
#define AVMNW_Attrib_szXAuthPassword			298
#define AVMNW_Attrib_bCfgMode					299
#define AVMNW_Attrib_bRejectNotEncrypted		300
#define AVMNW_Attrib_bDontFilterNetBios			301

// IPFilterSet Attributes
#define AVMNW_Attrib_bVPN						310
#define AVMNW_Attrib_nDefaultPolicy				311

// IPFilterRule Attributes
#define AVMNW_Attrib_IPFilterSetID	320
#define AVMNW_Attrib_Policy			321
#define AVMNW_Attrib_SrcIPAddress	322
#define AVMNW_Attrib_SrcIPMask		323
#define AVMNW_Attrib_DstIPAddress	324
#define AVMNW_Attrib_DstIPMask		325
#define AVMNW_Attrib_IPServiceID	326
#define AVMNW_Attrib_PacketLogging	327

// IPService Attributes
#define AVMNW_Attrib_SrcPortRangeStart	340
#define AVMNW_Attrib_SrcPortRangeEnd	341
#define AVMNW_Attrib_DstPortRangeStart	342
#define AVMNW_Attrib_DstPortRangeEnd	343
#define AVMNW_Attrib_ProtocolFlag		344
#define AVMNW_Attrib_TCPFlag			345
#define AVMNW_Attrib_ConnectionFlag		346

// IPBinding Attributes
#define AVMNW_Attrib_BindingType		360	
#define AVMNW_Attrib_InputFilterSetID	362
#define AVMNW_Attrib_OutputFilterSetID	364
#define AVMNW_Attrib_LowInputFilterSetID	365
#define AVMNW_Attrib_LowOutputFilterSetID	366

// IPMasqForwardRule Attributes
#define AVMNW_Attrib_IPMasqForwardSetID		370
#define AVMNW_Attrib_MasqProtcol			371
#define AVMNW_Attrib_CalledIPAddress		372
#define AVMNW_Attrib_CalledPort				373
#define AVMNW_Attrib_ForwardIPAddress		374
#define AVMNW_Attrib_ForwardPort			375
#define AVMNW_Attrib_nPriority				376

// --------------------------------------------------------------------------

// Values for Authentication modes
#define AVMNW_Auth_Disabled						0
#define AVMNW_Auth_PAP							1
#define AVMNW_Auth_CHAP							2

// Values for short hold mode
#define AVMNW_ShortHold_Disabled				0
#define AVMNW_ShortHold_Profile					1
#define AVMNW_ShortHold_Inactivity				2
#define AVMNW_ShortHold_Selflearning				3

// Values for disconnect mode
#define AVMNW_Disconnect_Disabled				0
#define AVMNW_Disconnect_Immediately				1
#define AVMNW_Disconnect_Timeout				2

// Values for active mode
#define AVMNW_ActiveMode_ConnectAtServiceStart		0
#define AVMNW_ActiveMode_StandbyAtServiceStart		1
#define AVMNW_ActiveMode_ConnectAtGUIStart		2
#define AVMNW_ActiveMode_StandbyAtGUIStart		3

// Values for nUseIPGateway
#define AVMNW_UseIPGateway_WhenConnected				0
#define AVMNW_UseIPGateway_Always				1
#define AVMNW_UseIPGateway_Never					2

// Values for nDataEncyption
#define AVMNW_Encryption_Disabled				0
#define AVMNW_Encryption_Twofish				1		// 128 bit session key
#define AVMNW_Encryption_Twofish_192			2		// 192 bit session key
#define AVMNW_Encryption_Twofish_256			3		// 256 bit session key


// --- Generic Functions ----------------------------------------------

#ifndef AVMNWAPI_INC_DATA

AVMNWFUNC AVMNW_Config_Open(void);

AVMNWFUNC AVMNW_Config_Close(void);

AVMNWFUNC AVMNW_Config_Lock(BOOL bLock);

AVMNWFUNC AVMNW_Config_Lock_MPRI(BOOL bLock);

AVMNWFUNC AVMNW_Config_Object_Delete(void);

AVMNWFUNC AVMNW_Config_Object_Unuse(BOOL bCommitChanges, /*OUT*/AVMNW_Attrib *pAttribute);

AVMNWFUNC AVMNW_Config_Attribute_GetText(AVMNW_Attrib Attribute,
	/*OUT*/char *szText,
	/*INOUT*/unsigned int *pnMaxSize);
AVMNWFUNC AVMNW_Config_Attribute_SetText(AVMNW_Attrib Attribute, char *szText);

AVMNWFUNC AVMNW_Config_Attribute_GetNumber(AVMNW_Attrib Attribute,	/*OUT*/unsigned int *pNumber);
AVMNWFUNC AVMNW_Config_Attribute_SetNumber(AVMNW_Attrib Attribute,unsigned int Number);

AVMNWFUNC AVMNW_Config_Attribute_GetBool(AVMNW_Attrib Attribute, /*OUT*/BOOL *pBool);
AVMNWFUNC AVMNW_Config_Attribute_SetBool(AVMNW_Attrib Attribute, BOOL Bool);

AVMNWFUNC AVMNW_Config_Attribute_GetIPRoute(AVMNW_Attrib Attribute, /*OUT*/AVMNW_IPRoute *pIPRoute);
AVMNWFUNC AVMNW_Config_Attribute_SetIPRoute(AVMNW_Attrib Attribute, /*IN*/AVMNW_IPRoute *pIPRoute);

// --- Target Specific Functions --------------------------------------------
AVMNWFUNC AVMNW_Config_Target_Create(char *szName);
AVMNWFUNC AVMNW_Config_Target_Use(char *szName);

AVMNWFUNC AVMNW_Config_Target_FindFirst(/*OUT*/char *szName, /*INOUT*/unsigned int *pnMaxSize);

AVMNWFUNC AVMNW_Config_Target_FindNext(/*OUT*/char *szName, /*INOUT*/unsigned int *pnMaxSize);

// --- ISDN Controller Specific Functions --------------------------------------------
AVMNWFUNC AVMNW_Config_Controller_Create(unsigned int CAPI20Controller);
AVMNWFUNC AVMNW_Config_Controller_Use(unsigned int CAPI20Controller);

// --- Product Object Specific Functions --------------------------------------------
AVMNWFUNC AVMNW_Config_Product_Use(void);


// --- Generic Object Type Functions ----------------------------------------

// Create a 'temporary' new object with default attribute values.
// The new object does not have an ID until it is promoted to a persistent state.
AVMNWFUNC AVMNW_Config_Object_UseNew(AVMNW_ObjectType ObjectType); // v1.6

// promote a temporary object to a persistent state.
AVMNWFUNC AVMNW_Config_Object_Create(/*OUT*/unsigned int *pID); // v1.6

AVMNWFUNC AVMNW_Config_Object_FindFirst(AVMNW_ObjectType ObjectType, /*OUT*/unsigned int *pID); // v1.6
AVMNWFUNC AVMNW_Config_Object_FindNext(AVMNW_ObjectType ObjectType, /*OUT*/unsigned int *pID); // v1.6

AVMNWFUNC AVMNW_Config_Object_UseByNumber(AVMNW_ObjectType ObjectType, AVMNW_Attrib TextAttribute, unsigned int nNumberValue);
AVMNWFUNC AVMNW_Config_Object_UseByText(AVMNW_ObjectType ObjectType, AVMNW_Attrib TextAttribute, char *szTextValue);


// --- Helper Functions -----------------------------------------------------

AVMNWFUNC AVMNW_Config_FindUnusedStaticIPAddress(AVMNW_IP_ADDRESS *pIPAddress);

AVMNWFUNC AVMNW_Config_PutFilterRuleAfter(AVMNW_ObjectType ObjectType,
										  unsigned int FilterRuleObject, 
										  unsigned int FilterRuleAfterObject);

#endif // AVMNWAPI_INC_DATA


#ifdef AVMNWAPI_IMPLEMENT
AVMNW_RESULT _AVMNW_Config_Close(void);
#endif

// --------------------------------------------------------------------------
// Module Control
// --------------------------------------------------------------------------

enum AVMNWProductModules { eProductModulesAll=0, eProductModulesRoutingRuntime,
				eProductModulesRuntime, eProductModulesAdmin ,
				eProductModulesRoutingRuntimeAndAdmin };

#ifndef AVMNWAPI_INC_DATA

AVMNWFUNC AVMNW_Module_Start(enum AVMNWProductModules eProductModules, /*OUT*/HANDLE *pHandle);
AVMNWFUNC AVMNW_Module_Stop(enum AVMNWProductModules eProductModules);
AVMNWFUNC AVMNW_Module_GetStatus(enum AVMNWProductModules eProductModules,
		/*OUT*/char *szVersion, /*INOUT*/unsigned int *pnVersionSize,
		/*OUT*/char *szRunInfo, /*INOUT*/unsigned int *pnRunInfoSize);

#endif // AVMNWAPI_INC_DATA

// --------------------------------------------------------------------------
// Password Provider
// --------------------------------------------------------------------------

#define AVMNW_MAX_TARGETNAME	47
#define AVMNW_MAX_USERNAME	127
#define AVMNW_MAX_PASSWORD	47


#pragma pack(4)

struct AVMNWUsernameParameters {
/*INOUT*/	char szUsernameInbound[AVMNW_MAX_USERNAME+1];
/*INOUT*/	char szUsernameOutbound[AVMNW_MAX_USERNAME+1];
};

struct AVMNWPasswordParameters {
/*IN*/		BOOL bInboundAuthentication; // FALSE: it is outbound authentication
/*INOUT*/	char szPassword[AVMNW_MAX_PASSWORD+1];
};

struct AVMNWPasswordProviderParameters {
/*IN*/		unsigned int nSize;	// sizeof(AVMNWPasswordProviderParameters)
/*IN*/		unsigned long InternalHandle; // API Internal Info - don't modifiy
/*IN*/		char szTargetName[AVMNW_MAX_TARGETNAME+1];
/*IN*/		unsigned int nController;
/*IN*/		BOOL bUsernameQuery;
			union {
				struct AVMNWUsernameParameters u; // if bUsernameQuery
				struct AVMNWPasswordParameters p; // if !bUsernameQuery
			};
};
#pragma pack()


typedef void (PASCAL *AVMNW_PASSWORDCALLBACK)(
	void *pPrivate, struct AVMNWPasswordProviderParameters *pParameters);


#ifndef AVMNWAPI_INC_DATA

AVMNWFUNC AVMNW_PasswordProvider_Register(
	BOOL bRegister,
	DWORD dwFlags,
	/*OUT*/HANDLE *phSema,
	DWORD/*HWND*/ hWnd, UINT msg);

AVMNWFUNC AVMNW_PasswordProvider_Callback(
	void *pPrivate,
	AVMNW_PASSWORDCALLBACK pCallbackFunction);

#endif // AVMNWAPI_INC_DATA

// --------------------------------------------------------------------------
// Connection Control
// --------------------------------------------------------------------------

#ifndef AVMNWAPI_INC_DATA

AVMNWFUNC AVMNW_Connection_Authenticate(char *szTargetOrUserName);

AVMNWFUNC AVMNW_Connection_InvalidateSessionKey(char *szTargetOrUserName);

#endif // AVMNWAPI_INC_DATA



// --------------------------------------------------------------------------
// Crypt Provider
// --------------------------------------------------------------------------

typedef DWORD (PASCAL *CryptProvider_GetOwnCertificate) (
	/*IN*/void *pPrivate,
	/*IN*/char *szDName_Subject,
	/*IN*/BOOL	bDSA,
	/*IN*/DWORD *pCertSize,
	/*OIT*/BYTE **ppCertificate);

typedef DWORD (PASCAL *CryptProvider_ReceiveCertificate) (
	/*IN*/void *pPrivate,
	/*IN*/DWORD dwCertSize,
	/*OUT*/char **pszDName_Subject,
	/*OUT*/BOOL *pDSA);

typedef DWORD (PASCAL *CryptProvider_ForgetCertificate) (
	/*IN*/void *pPrivate,
	/*IN*/char *szDName_Subject,
	/*IN*/BOOL bDSA);

typedef DWORD (PASCAL *CryptProvider_VerifySignature) (
	/*IN*/void *pPrivate,
	/*IN*/char *szDName_Subject,
	/*IN*/BOOL bDSA,
	/*IN*/char *dwDataSize,
	/*IN*/BYTE *pData,
	/*IN*/DWORD dwSignatureSize,
	/*IN*/BYTE *pSignatureData);


typedef DWORD (PASCAL *CryptProvider_MakeSignature) (
	/*IN*/void *pPrivate,
	/*IN*/BOOL *pbDSA,
	/*IN*/DWORD dwInDataSize,
	/*IN*/BYTE *pInData,
	/*OUT*/DWORD *pdwOutDataSize,
	/*OUT*/BYTE **ppOutData);

typedef DWORD (PASCAL *CryptProvider_RSADecodeData) (
	/*IN*/void *pPrivate,
	/*IN*/char *szTargetName,
	/*IN*/DWORD dwInDataSize,
	/*IN*/BYTE *pInData,
	/*OUT*/DWORD *pdwOutDataSize,
	/*OUT*/BYTE **ppOutData);

typedef DWORD (PASCAL *CryptProvider_RSAEncodeData) (
	/*IN*/void *pPrivate,
	/*IN*/char *szTargetName,
	/*IN*/char *szDName_Subject,
	/*IN*/DWORD dwInDataSize,
	/*IN*/BYTE *pInData,
	/*OUT*/DWORD *pdwOutDataSize,
	/*OUT*/BYTE **ppOutData);


#pragma pack(4)

struct CryptProviderCallbacks {
	CryptProvider_GetOwnCertificate		pGetOwnCertificate;
	CryptProvider_ReceiveCertificate	pReceiveCertificate;
	CryptProvider_ForgetCertificate	pForgetCertificate;
	CryptProvider_VerifySignature	pVerifySignature;
	CryptProvider_MakeSignature	pMakeSignature;
	CryptProvider_RSAEncodeData	pRSAEncodeData;
	CryptProvider_RSADecodeData	pRSADecodeData;
};
#pragma pack()


#ifndef AVMNWAPI_INC_DATA

AVMNWFUNC AVMNW_CryptProvider_Register(
	/*OUT*/HANDLE *phSema,
	/*IN*/struct CryptProviderCallbacks *pCallbacks,
	/*IN*/char *szDName_Issuer,
	/*IN*/char *szDName_Subject);

AVMNWFUNC AVMNW_CryptProvider_Callback(
	void *pPrivate);

AVMNWFUNC AVMNW_CryptProvider_Unregister(void);

#endif // AVMNWAPI_INC_DATA


// --------------------------------------------------------------------------
// IPSec Provider
// --------------------------------------------------------------------------

#define AVMNW_MAX_IPSECNAME	63
#define AVMNW_MAX_IPSECUSERNAME	47
#define AVMNW_MAX_IPSECPASSWORD	64    /* (NOT 63!!!) 64 for  Shared Secret: RFC 2104, Abschnitt 2 */


#pragma pack(4)

struct AVMNWIPSecProviderParameters {
  /*IN*/		unsigned int nSize;	// sizeof(AVMNWIPSecProviderParameters)
  /*IN*/		unsigned long InternalHandle; // API Internal Info - don't modifiy
  /*IN*/		char szName[AVMNW_MAX_IPSECNAME+1];
  /*IN*/		BOOL bXAuthQuery;	// TRUE: XAuth; FALSE: Preshared Key 

  /*OUT*/		char szUsername[AVMNW_MAX_IPSECUSERNAME+1]; // only if bXAuthQuery
  /*OUT*/		char szPassword[AVMNW_MAX_IPSECPASSWORD+1]; // Preshared Key or Password for XAuth
};

#pragma pack()


typedef void (PASCAL *AVMNW_IPSECCALLBACK)(
	void *pPrivate, struct AVMNWIPSecProviderParameters *pParameters);


#ifndef AVMNWAPI_INC_DATA

AVMNWFUNC AVMNW_IPSecProvider_Register(BOOL bRegister, /*OUT*/HANDLE *phSema);

AVMNWFUNC AVMNW_IPSecProvider_Callback(void *pPrivate, AVMNW_IPSECCALLBACK pCallbackFunction);

#endif // AVMNWAPI_INC_DATA


#endif // __AVMNWAPI_H__

#endif // _INC_WINDOWS
