distTBufLib.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:3k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* distTBufLibP.h - telegram buffer library header (VxFusion) */
  2. /* Copyright 1999 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01b,29oct98,drm  moved distTBufLibInit() to private header file
  7. 01a,12aug98,drm  initial version - portions moved from private header file
  8. */
  9. #ifndef __INCdistTBufLibh
  10. #define __INCdistTBufLibh
  11. #include "vxWorks.h"
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif /* __cplusplus */
  15. /* defines */
  16. #ifdef DIST_DIAGNOSTIC
  17. #define tBufHeader tBufGen.tBufGenHeader
  18. #define tBufHdrHeader tBufGen.tBufGenHeader
  19. #endif
  20. #define DIST_TBUF_FLAG_HDR 0x01  /* telegram is header */
  21. #define DIST_TBUF_FLAG_MF 0x02             /* more fragments */
  22. #define DIST_TBUF_FLAG_BROADCAST 0x04             /* broadcast telegram */
  23. #define DIST_TBUF_IS_HDR(pTBuf) 
  24. ((pTBuf)->tBufFlags & DIST_TBUF_FLAG_HDR)  /* check if hdr flag set */
  25. #define DIST_TBUF_HAS_MF(pTBuf) 
  26. ((pTBuf)->tBufFlags & DIST_TBUF_FLAG_MF)         /* check if MF flag set */
  27. #define DIST_TBUF_IS_BROADCAST(pTBuf) 
  28. ((pTBuf)->tBufFlags & DIST_TBUF_FLAG_BROADCAST)  /* check if bcast flg set*/
  29. #define DIST_TBUF_TTYPE_DTA 0      /* data */
  30. #define DIST_TBUF_TTYPE_ACK 1      /* acknowledge */
  31. #define DIST_TBUF_TTYPE_BDTA 2      /* broadcast data */
  32. #define DIST_TBUF_TTYPE_BACK 3      /* broadcast acknowledge */
  33. #define DIST_TBUF_TTYPE_BOOTSTRAP 4      /* bootstrap message */
  34. #define DIST_TBUF_TTYPE_NACK 5      /* negative acknowledge */
  35. /* typedefs */
  36. typedef struct _DIST_TBUF_GEN /* DIST_TBUF_GEN */
  37. {
  38. struct _DIST_TBUF_GEN *pTBufGenNext; /* next TBuf */
  39. struct _DIST_TBUF_GEN *pTBufGenLast; /* previous TBuf */
  40. #ifdef DIST_DIAGNOSTIC
  41. BOOL tBufGenHeader;
  42. #endif
  43. } DIST_TBUF_GEN;
  44. typedef struct /* DIST_TBUF */
  45. {
  46. DIST_TBUF_GEN tBufGen;    /* TBufGen struct */
  47. void *pTBufData; /* pointer to the data */
  48. uint16_t tBufId;     /* id of the packet */
  49. uint16_t tBufAck;    /* id of packet last received and */
  50.                                         /* ackowledged without error */
  51. uint16_t tBufSeq;    /* sequence number of the fragment */
  52. uint16_t tBufNBytes; /* number of non-network header data */
  53.                                         /* bytes */ 
  54. uint16_t tBufType;   /* type of telegram */
  55. uint16_t tBufFlags;  /* telegrams flags */
  56. } DIST_TBUF;
  57. /* function declarations */
  58. #if defined(__STDC__) || defined(__cplusplus)
  59. DIST_TBUF *distTBufAlloc (void);
  60. void distTBufFree (DIST_TBUF *pTBuf);
  61. #else /* __STDC__ */
  62. DIST_TBUF *distTBufAlloc ();
  63. void distTBufFree ();
  64. #endif /* __STDC__ */
  65. #ifdef __cplusplus
  66. }
  67. #endif /* __cplusplus */
  68. #endif  /* __INCdistTBufLibh */