00001 #ifndef __DECLARATIONS_H_INCLUDED__
00002 #define __DECLARATIONS_H_INCLUDED__
00003
00004 #include "Platform.h"
00005
00006
00007 #ifndef _SW_RELEASE_
00008 #define _DEBUG_(a) a;
00009 #else
00010 #define _DEBUG_(a)
00011
00012 #ifndef NDEBUG
00013 #define NDEBUG
00014 #endif
00015
00016 #endif
00017
00019 #define MAX_PACKET_SIZE 1472
00020
00022 #define DEFAULT_PACKETQUEUE_SIZE 10
00023
00024
00025
00026
00033
00038
00039 #define ERR_PL_NONE 0
00041 #define ERR_PL_LOCK 1
00043 #define ERR_PL_FULL 2
00045 #define ERR_PL_NOTFOUND 3
00047 #define ERR_PL_INDEXNOTSET 4
00048
00052
00057
00058 #define ERR_PQ_NONE 0
00060 #define ERR_PQ_LOCK 1
00062 #define ERR_PQ_FULL 2
00064 #define ERR_PQ_NOTFOUND 3
00066 #define ERR_PQ_BADPARAM 4
00067
00068
00069
00070
00072
00073
00075 #define ERR_RWQ_NONE 0
00077 #define ERR_RWQ_LOCK 1
00079 #define ERR_RWQ_FULL 2
00081 #define ERR_RWQ_NOTFOUND 3
00082
00083
00084
00085
00086 #define ERR_NQ_BASE 0
00087 #define ERR_NQ_NUMERRORS 28
00088
00089
00090
00091
00093 #define ERR_NQ_NONE (ERR_NQ_BASE+0)
00095 #define ERR_NQ_ALREADY (ERR_NQ_BASE+1)
00097 #define ERR_NQ_BADPOOL (ERR_NQ_BASE+2)
00099 #define ERR_NQ_BADIP (ERR_NQ_BASE+3)
00101 #define ERR_NQ_SOCREATE (ERR_NQ_BASE+4)
00103 #define ERR_NQ_SOBIND (ERR_NQ_BASE+5)
00105 #define ERR_NQ_ADDPEER (ERR_NQ_BASE+6)
00107 #define ERR_NQ_SONONBLOCK (ERR_NQ_BASE+7)
00109 #define ERR_NQ_SEMCREATESEND (ERR_NQ_BASE+8)
00111 #define ERR_NQ_SEMCREATERECV (ERR_NQ_BASE+9)
00113 #define ERR_NQ_THRDCREATESEND (ERR_NQ_BASE+10)
00115 #define ERR_NQ_THRDCREATERECV (ERR_NQ_BASE+11)
00117 #define ERR_NQ_THRDCLEANUP (ERR_NQ_BASE+12)
00119 #define ERR_NQ_SOCLOSE (ERR_NQ_BASE+13)
00121 #define ERR_NQ_SEMCLEANUP (ERR_NQ_BASE+14)
00123 #define ERR_NQ_MSGINVALID (ERR_NQ_BASE+15)
00125 #define ERR_NQ_SENDQUEUEFULL (ERR_NQ_BASE+16)
00127 #define ERR_NQ_SENDQUEUE (ERR_NQ_BASE+17)
00129 #define ERR_NQ_SEMNOTIFY (ERR_NQ_BASE+18)
00131 #define ERR_NQ_EMPTY (ERR_NQ_BASE+19)
00133 #define ERR_NQ_RECVQUEUE (ERR_NQ_BASE+20)
00135 #define ERR_NQ_TIMEOUT (ERR_NQ_BASE+21)
00137 #define ERR_NQ_SEMCREATE (ERR_NQ_BASE+22)
00139 #define ERR_NQ_RESPTROUBLE (ERR_NQ_BASE+23)
00141 #define ERR_NQ_SEMDELETE (ERR_NQ_BASE+24)
00143 #define ERR_NQ_INVALIDPEER (ERR_NQ_BASE+25)
00145 #define ERR_NQ_ACKQUEUE (ERR_NQ_BASE+26)
00147 #define ERR_NQ_RESPWAITQUEUE (ERR_NQ_BASE+27)
00148
00152
00153
00158
00159
00164 #define NQ_PT_NONE 0x00
00165 #define NQ_PT_REQUEST 0x01
00166 #define NQ_PT_RESPONSE 0x02
00167 #define NQ_PT_TELEGRAM 0x03
00168
00175
00176
00177 #define NQ_LT_NONE 0x00
00179 #define NQ_LT_GET 0x01
00181 #define NQ_LT_PUT 0x02
00183 #define NQ_LT_CALL 0x03
00185 #define NQ_LT_TRAP 0x04
00187 #define NQ_LT_UPDATE 0x05
00188
00190
00191 #define PACKET_SPECIAL_BITS_VALID_MASK 0xFFFC
00192 #define PACKET_SPECIAL_BITS_DEFAULT_VALUE 0x0000
00193 #define PACKET_BIT_WANT_ACK 0x0002
00194 #define PACKET_BIT_IS_ACKPACKET 0x0001
00195
00196 #define MIN_VARTYPE 1
00197 #define MAX_VARTYPE (VARTYPE_TEXT)
00198
00207
00208 #define VARTYPE_BINARY (MIN_VARTYPE)
00210 #define VARTYPE_FLOAT (MIN_VARTYPE+1)
00212 #define VARTYPE_DOUBLE (MIN_VARTYPE+2)
00214 #define VARTYPE_INT8 (MIN_VARTYPE+3)
00216 #define VARTYPE_UINT8 (MIN_VARTYPE+4)
00218 #define VARTYPE_INT16 (MIN_VARTYPE+5)
00220 #define VARTYPE_UINT16 (MIN_VARTYPE+6)
00222 #define VARTYPE_INT32 (MIN_VARTYPE+7)
00224 #define VARTYPE_UINT32 (MIN_VARTYPE+8)
00226 #define VARTYPE_TEXT (MIN_VARTYPE+9)
00227
00229 #define MAX_PACKETPAYLOAD_SIZE (MAX_PACKET_SIZE-SIZE_MESSAGE_FILL_STUFF-SIZE_PACKET_FILL_STUFF)
00230
00232 #define MIN_SIZE_DATA (16)
00233
00235 #define MIN_SIZE_DATA_NET (12)
00236
00239 #define MAX_NUM_ENTRIES (MAX_PACKETPAYLOAD_SIZE / MIN_SIZE_DATA_NET)
00240
00242 #define SIZE_ADD_LINKEDLIST (4*MAX_NUM_ENTRIES)
00243
00244
00245 #define SENDQUEUE_SIZE 10
00246 #define RECVQUEUE_SIZE 10
00247 #define ACKQUEUE_SIZE 10
00248 #define NUM_CMESSAGEBUFFERS 40
00249
00250 #define SEND_SEMAPHORE_TIMEOUT_MS 500
00251 #define SEND_SELECT_TIMEOUT_MS 200
00252 #define RECV_SELECT_TIMEOUT_MS 100
00253
00254 #define SEND_THREAD_PRIORITY SW_THREAD_PRIORITY_BELOW_NORMAL
00255
00256 #define RECV_THREAD_PRIORITY SW_THREAD_PRIORITY_NORMAL
00257
00258
00259 #define SIZE_MESSAGE_FILL_STUFF 16
00260
00261
00262 #define SIZE_PACKET_FILL_STUFF 10
00263
00264
00265 #define PACKET_MAGIC_TOP 0xA51C
00266 #define PACKET_MAGIC_TAIL 0xC15A
00267 #define PACKET_VERSIONS_SUPPORTED 0x0001
00268
00269 #define NO_SEMAPHORE NULL
00270
00271
00272 #define RESPONSEWAITQUEUE_MAX_SIZE 10
00273
00274
00275 #define PEERLIST_MAX_SIZE 10
00276
00279
00280
00281 typedef struct
00282 {
00283 INT32 tv_sec;
00284 INT32 tv_usec;
00285 } PI_TIMEVAL;
00286
00287
00289 typedef struct
00290 {
00296 UINT32 RcvInvalidPeerAddress;
00297
00299 UINT32 RcvSocketErrors;
00300 UINT32 RcvNoBuffersLeft;
00302 UINT32 RcvNoDataReceived;
00304 UINT32 RcvSelectErrors;
00305
00307 UINT32 RcvDroppedPacketsBadChecksum;
00309 UINT32 RcvNumTelegrams;
00311 UINT32 RcvNumRequests;
00313 UINT32 RcvNumResponses;
00314 UINT32 RcvNumPacketsWantAck;
00315 UINT32 RcvAckPackets;
00319 UINT32 RcvPacketsMissedByIndex;
00320
00323 UINT32 RcvResponsesWithSemaphore;
00324
00326 UINT32 RcvResponsesWithoutSemaphore;
00327
00329 UINT32 RcvDroppedPacketsQueueFull;
00331 UINT32 RcvQueueErrors;
00332
00340 UINT32 SntTelegrams;
00341 UINT32 SntRequests;
00342 UINT32 SntResponses;
00343 UINT32 SntAckPackets;
00344
00345 UINT32 SntSocketErrors;
00346 UINT32 SntEncodingErrors;
00347
00348 UINT32 SntQueueErrors;
00349 UINT32 SntQueueFull;
00352 UINT32 BlockingCallResponseTimeout;
00353 UINT32 BlockingCallResponseReceivedOnTime;
00354 UINT32 BlockingCallRequestSent;
00355
00356 UINT32 AckTimeout;
00357
00359 PI_TIMEVAL StartTime;
00360
00361 } STATISTICS;
00362
00364 typedef struct
00365 {
00366 UINT16 requestid;
00367 HANDLE semaphore_to_signal;
00368 } WAITFORRESPONSE;
00369
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00405
00406
00407
00409
00410
00411
00412
00413
00414
00415 #endif //__DECLARATIONS_H_INCLUDED__