#ifndef _CCHANNEL_H
#define _CCHANNEL_H

/* Virtual Channel Client API definitions */

#include <pchannel.h>

#ifdef __cplusplus
extern "C" {
#endif

#define VCAPITYPE  _stdcall
#define VCEXPORT

#define CHANNEL_EVENT_INITIALIZED  0
#define CHANNEL_EVENT_CONNECTED  1
#define CHANNEL_EVENT_V1_CONNECTED  2
#define CHANNEL_EVENT_DISCONNECTED  3
#define CHANNEL_EVENT_TERMINATED  4

#define CHANNEL_EVENT_DATA_RECEIVED  10
#define CHANNEL_EVENT_WRITE_COMPLETE  11
#define CHANNEL_EVENT_WRITE_CANCELLED  12

#define CHANNEL_RC_OK  0
#define CHANNEL_RC_ALREADY_INITIALIZED  1
#define CHANNEL_RC_NOT_INITIALIZED  2
#define CHANNEL_RC_ALREADY_CONNECTED  3
#define CHANNEL_RC_NOT_CONNECTED  4
#define CHANNEL_RC_TOO_MANY_CHANNELS  5
#define CHANNEL_RC_BAD_CHANNEL  6
#define CHANNEL_RC_BAD_CHANNEL_HANDLE  7
#define CHANNEL_RC_NO_BUFFER  8
#define CHANNEL_RC_BAD_INIT_HANDLE  9
#define CHANNEL_RC_NOT_OPEN  10
#define CHANNEL_RC_BAD_PROC  11
#define CHANNEL_RC_NO_MEMORY  12
#define CHANNEL_RC_UNKNOWN_CHANNEL_NAME  13
#define CHANNEL_RC_ALREADY_OPEN  14
#define CHANNEL_RC_NOT_IN_VIRTUALCHANNELENTRY  15
#define CHANNEL_RC_NULL_DATA  16
#define CHANNEL_RC_ZERO_LENGTH  17

#define VIRTUAL_CHANNEL_VERSION_WIN2000  1

typedef struct tagCHANNEL_ENTRY_POINTS {
    DWORD cbSize;
    DWORD protocolVersion;
    PVIRTUALCHANNELINIT pVirtualChannelInit;
    PVIRTUALCHANNELOPEN pVirtualChannelOpen;
    PVIRTUALCHANNELCLOSE pVirtualChannelClose;
    PVIRTUALCHANNELWRITE pVirtualChannelWrite;
} CHANNEL_ENTRY_POINTS, *PCHANNEL_ENTRY_POINTS;

typedef VOID VCAPITYPE CHANNEL_INIT_EVENT_FN(LPVOID,UINT,LPVOID,UINT);
typedef CHANNEL_INIT_EVENT_FN *PCHANNEL_INIT_EVENT_FN;
typedef VOID VCAPITYPE CHANNEL_OPEN_EVENT_FN(DWORD,UINT,LPVOID,UINT32,UINT32,UINT32);
typedef CHANNEL_OPEN_EVENT_FN *PCHANNEL_OPEN_EVENT_FN;
typedef UINT VCAPITYPE VIRTUALCHANNELINIT(LPVOID*,PCHANNEL_DEF,INT,ULONG,PCHANNEL_INIT_EVENT_FN);
typedef VIRTUALCHANNELINIT *PVIRTUALCHANNELINIT;
typedef UINT VCAPITYPE VIRTUALCHANNELOPEN(LPVOID,LPDWORD,PCHAR,PCHANNEL_OPEN_EVENT_FN);
typedef VIRTUALCHANNELOPEN *PVIRTUALCHANNELOPEN;
typedef UINT VCAPITYPE VIRTUALCHANNELCLOSE(DWORD);
typedef VIRTUALCHANNELCLOSE *PVIRTUALCHANNELCLOSE;
typedef UINT VCAPITYPE VIRTUALCHANNELWRITE(DWORD,LPVOID,ULONG,LPVOID);
typedef VIRTUALCHANNELWRITE *PVIRTUALCHANNELWRITE;
typedef BOOL VCAPITYPE VIRTUALCHANNELENTRY(PCHANNEL_ENTRY_POINTS);
typedef VIRTUALCHANNELENTRY *PVIRTUALCHANNELENTRY;

#ifdef __cplusplus
}
#endif

#endif /* _CCHANNEL_H */
