00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
#ifndef CHAMELEON_IPCMESSAGELAYER_H
00030 #define CHAMELEON_IPCMESSAGELAYER_H "$Id"
00031
00032
#include <chameleon/ipctransportlayer.h>
00033
#include <chameleon/ipcmessage.h>
00034
00035
#ifdef __cplusplus
00036
extern "C" {
00037
#endif
00038
00039 CHIPCARD_API typedef struct IPCMESSAGELAYERSTRUCT IPCMESSAGELAYER;
00040 CHIPCARD_API typedef ERRORCODE (*IPCMESSAGELAYER_FREEPTR)(
IPCMESSAGELAYER *ml);
00041
00042
00043 CHIPCARD_API typedef enum {
00044
StateIdle=0,
00045
StateConnecting,
00046
StateListening,
00047
StateReading,
00048
StateWriting,
00049
StateDisconnected,
00050
StateUnreachable
00051 }
IPCMESSAGELAYERSTATE;
00052
00053
00054 CHIPCARD_API struct IPCMESSAGELAYERSTRUCT {
00055 int id;
00056 IPCTRANSPORTLAYERTABLE *
transportLayer;
00057 IPCMESSAGELAYERSTATE status;
00058 IPCMESSAGE *
outQueue;
00059 IPCMESSAGE *
inQueue;
00060 char headerBuffer[
IPCMESSAGE_HEADERSIZE];
00061 int readingHeader;
00062 int currentBytesLeft;
00063 char *
currentPointer;
00064 int currentReadMessageSize;
00065 char *
currentReadBuffer;
00066 IPCMESSAGE *
currentWriteMessage;
00067 unsigned int msgReadCount;
00068 unsigned int msgReadBytes;
00069 unsigned int msgWriteCount;
00070 unsigned int msgWriteBytes;
00071 void *
userData;
00072 int useEncryption;
00073 int persistent;
00074 int mark;
00075 IPCMESSAGELAYER_FREEPTR freeUserData_cb;
00076 IPCMESSAGELAYER *
next;
00077 };
00078
00079
00080
00081
CHIPCARD_API IPCMESSAGELAYER *
IPCMessageLayer_new();
00082
CHIPCARD_API void IPCMessageLayer_free(IPCMESSAGELAYER *m);
00083
00084
00085
CHIPCARD_API IPCTRANSPORTLAYERTABLE *
IPCMessageLayer_GetTransportLayer(IPCMESSAGELAYER *m);
00086
CHIPCARD_API void IPCMessageLayer_SetTransportLayer(IPCMESSAGELAYER *m,
00087 IPCTRANSPORTLAYERTABLE *tl);
00088
CHIPCARD_API int IPCMessageLayer_GetId(IPCMESSAGELAYER *m);
00089
CHIPCARD_API void IPCMessageLayer_SetId(IPCMESSAGELAYER *m,
int id);
00090
00091
CHIPCARD_API IPCMESSAGELAYERSTATE IPCMessageLayer_GetStatus(IPCMESSAGELAYER *m);
00092
CHIPCARD_API void IPCMessageLayer_SetStatus(IPCMESSAGELAYER *m,
00093 IPCMESSAGELAYERSTATE s);
00094
ERRORCODE IPCMessageLayer_SendMessage(IPCMESSAGELAYER *m,
00095 IPCMESSAGE *msg);
00096
CHIPCARD_API IPCMESSAGE *
IPCMessageLayer_NextMessage(IPCMESSAGELAYER *m);
00097
CHIPCARD_API ERRORCODE IPCMessageLayer_Work(IPCMESSAGELAYER *m);
00098
00099
CHIPCARD_API void IPCMessageLayer_ResetStats(IPCMESSAGELAYER *m);
00100
CHIPCARD_API unsigned int IPCMessageLayer_GetMessageReadCount(IPCMESSAGELAYER *m);
00101
CHIPCARD_API unsigned int IPCMessageLayer_GetMessageWriteCount(IPCMESSAGELAYER *m);
00102
CHIPCARD_API unsigned int IPCMessageLayer_GetMessageReadBytes(IPCMESSAGELAYER *m);
00103
CHIPCARD_API unsigned int IPCMessageLayer_GetMessageWriteBytes(IPCMESSAGELAYER *m);
00104
00105
CHIPCARD_API int IPCMessageLayer_GetAutoRemove(IPCMESSAGELAYER *m);
00106
CHIPCARD_API void IPCMessageLayer_SetAutoRemove(IPCMESSAGELAYER *m,
int b);
00107
00108
CHIPCARD_API void *
IPCMessageLayer_GetUserData(IPCMESSAGELAYER *m);
00109
CHIPCARD_API void IPCMessageLayer_SetUserData(IPCMESSAGELAYER *m,
void* u);
00110
00111
CHIPCARD_API ERRORCODE IPCMessageLayer_ShutDown(IPCMESSAGELAYER *m);
00112
00113
CHIPCARD_API void IPCMessageLayer_SetFreeUserDataCallback(IPCMESSAGELAYER *m,
00114 IPCMESSAGELAYER_FREEPTR p);
00115
00116
CHIPCARD_API ERRORCODE IPCMessageLayer_IdleCheck(IPCMESSAGELAYER *m);
00117
00118
CHIPCARD_API TransportLayerType IPCMessageLayer_GetType(IPCMESSAGELAYER *m);
00119
00120
CHIPCARD_API int IPCMessageLayer_UsesEncryption(IPCMESSAGELAYER *m);
00121
CHIPCARD_API void IPCMessageLayer_UseEncryption(IPCMESSAGELAYER *m,
00122
int b);
00123
CHIPCARD_API void IPCMessageLayer_SetPersistence(IPCMESSAGELAYER *m,
00124
int p);
00125
CHIPCARD_API int IPCMessageLayer_IsPersistent(IPCMESSAGELAYER *m);
00126
00127
CHIPCARD_API void IPCMessageLayer_SetMark(IPCMESSAGELAYER *m,
00128
int mark);
00129
CHIPCARD_API int IPCMessageLayer_GetMark(IPCMESSAGELAYER *m);
00130
00131
00132
#ifdef __cplusplus
00133
}
00134
#endif
00135
00136
#endif
00137
00138