#ifndef _DLLDef_H_
#define _DLLDef_H_
#pragma pack(push)
#pragma pack(4)
//Connection specific information
typedef struct _ConnectionInfo
{
DWORD dwPID;
bool bIncomingConnection;
bool bSSL;
DWORD dwOutgoingAddress;
unsigned short usOutgoingPort;
DWORD dwLocalAddress; //Reserved, not implemented
unsigned short usLocalPort; //Reserved, not implemented
} ConnectionInfo;
#pragma pack(pop)
//The callback function
//If the callback is called with NULL data and 0 data size it means that the socket was closed
typedef DWORD (_stdcall *DLLCallback)(const ConnectionInfo& rConnectionInfo,
DWORD dwID,
const char* pData,
DWORD dwDataSize,
bool bOutgoingData,
DWORD dwTickCount);
typedef DLLCallback PDLLCallback;
//Call back for HTTP decoder
//Request HTTP information
typedef struct _HTTPRequestInformation
{
const char* pVerb; //Get, post
const char* pURL;
const char* pHost;
} HTTPRequestInformation;
//This will be called for HTTP request
typedef DWORD (_stdcall *DLLCallbackHTTPRequest)(const ConnectionInfo& rConnectionInfo,
DWORD dwID,
const HTTPRequestInformation& rInformation,
const char* pRequest,
DWORD dwRequestSize,
DWORD dwFirstTickCount,
DWORD dwLastTickCount,
bool& rProcess);
typedef DLLCallbackHTTPRequest PDLLCallbackHTTPRequest;
//Reply HTTP information
typedef struct _HTTPReplyInformation
{
DWORD dwReplyCode;
const char* pContentType;
} HTTPReplyInformation;
//This will be called for HTTP reply
typedef DWORD (_stdcall *DLLCallbackHTTPReply)(const ConnectionInfo& rConnectionInfo,
DWORD dwID,
const HTTPReplyInformation& rInformation,
const char* pReplyHeader,
DWORD dwReplyHeaderSize,
const char* pReply,
DWORD dwReplySize,
DWORD dwTotalReplyOriginalSize,
DWORD dwFirstTickCount,
DWORD dwLastTickCount,
bool& rServerCheck);
typedef DLLCallbackHTTPReply PDLLCallbackHTTPReply;
//Callbacks to modify the data structures
//The initialize function
typedef bool (_stdcall *InitializeProto)(PDLLCallback pCallback,
DWORD dwReg);
typedef InitializeProto PInitializeProto;
//HTTP initialize function
typedef bool (_stdcall *InitializeHTTPProto)(PDLLCallback pCallback,
PDLLCallbackHTTPRequest pRequestCallback,
PDLLCallbackHTTPReply pReplyCallback,
DWORD dwReg);
typedef InitializeHTTPProto PInitializeHTTPProto;
//The uninitialize function
typedef void (_stdcall *UninitializeProto)();
typedef UninitializeProto PUninitializeProto;
//The license function
typedef DWORD (_stdcall *GetInfoProto)();
typedef GetInfoProto PGetInfoProto;
//Load/save func
typedef bool (_stdcall *LoadSaveProto)();
typedef LoadSaveProto PLoadSaveProto;
//Clear data
typedef void (_stdcall *ClearDataProto)();
typedef ClearDataProto PClearDataProto;
//Enum of the add data
typedef enum _AddDataType
{
adApplication=0,
adPort,
adIP,
adApplicationInv,
adPortInv,
adIPInv
} AddDataType;
//Inv types
typedef enum _InvType
{
itApp,
itPort,
itIP
} InvType;
//Add data
typedef void (_stdcall *AddDataProto)(AddDataType aType,
const unsigned short* pData);
typedef AddDataProto PAddDataProto;
//
Query data
typedef bool (_stdcall *DoesDataExistsProto)(AddDataType aType,
const unsigned short* pData);
typedef DoesDataExistsProto PDoesDataExistsProto;
//Set inv
typedef void (_stdcall *SetInvProto)(InvType aType,
bool bSet);
typedef SetInvProto PSetInvProto;
//Set inv
typedef bool (_stdcall *GetInvProto)(InvType aType);
typedef GetInvProto PGetInvProto;
#endif