distNameLibP.h
上传用户:nvosite88
上传日期:2007-01-17
资源大小:4983k
文件大小:3k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* distNameLibP.h - distributed name database private header (VxFusion) */
  2. /* Copyright 1999 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01d,24may99,drm  added vxfusion to VxFusion related includes
  7. 01c,12aug98,drm  changed distTBufLibP.h to distTBufLib.h
  8. 01b,09may98,ur   removed 8 bit node id restriction
  9. 01a,10jun97,ur   written.
  10. */
  11. #ifndef __INCdistNameLibPh
  12. #define __INCdistNameLibPh
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. #include "hashLib.h"
  17. #include "vxfusion/distNameLib.h"
  18. #include "vxfusion/distTBufLib.h"
  19. #include "vxfusion/private/distPktLibP.h"
  20. #include "vxfusion/private/distNodeLibP.h"
  21. #include "vxfusion/private/distObjLibP.h"
  22. /* defines */
  23. #define DIST_DNDB_SERV_NAME "tServDndb"
  24. #define DIST_DNDB_SERV_TASK_PRIO 50
  25. #define DIST_DNDB_SERV_TASK_STACK_SZ 5000
  26. #define DIST_DNDB_SERV_NET_PRIO 0
  27. #define DIST_NAME_MAX_LENGTH 19
  28. #define DIST_VALUE_MAX_LENGTH 8
  29. #define DIST_PKT_DNDB_PRIO (servTable[DIST_ID_DNDB_SERV].servNetPrio)
  30. #define DIST_PKT_TYPE_DNDB_ADD 0
  31. #define DIST_PKT_TYPE_DNDB_RM 1
  32. #define DIST_NAME_STATUS_OK OK
  33. #define DIST_NAME_STATUS_PROTOCOL_ERROR 1
  34. #define distNameLclLock() semTake (&distNameDbLock, WAIT_FOREVER)
  35. #define distNameLclUnlock() semGive (&distNameDbLock)
  36. #define distNameLclBlockOnAdd() semTake (&distNameDbUpdate, WAIT_FOREVER)
  37. #define distNameLclSigAdd() semFlush (&distNameDbUpdate)
  38. /* typedefs */
  39. typedef union /* DIST_NAME_TYPE_ALL */
  40. {
  41. uint8_t uint8;
  42. uint16_t uint16;
  43. uint32_t uint32;
  44. uint32_t uint64[2];
  45. float float32;
  46. double float64;
  47. uint8_t field[DIST_VALUE_MAX_LENGTH];
  48. DIST_OBJ_UNIQ_ID objUniqId; /* for complex objects */
  49. } DIST_NAME_TYPE_ALL;
  50. typedef union /* DIST_NAME_DB_VALUE */
  51. {
  52. uint8_t uint8;
  53. uint16_t uint16;
  54. uint32_t uint32;
  55. uint32_t uint64[2];
  56. float float32;
  57. double float64;
  58. uint8_t field[DIST_VALUE_MAX_LENGTH];
  59. MSG_Q_ID msgQId;
  60. } DIST_NAME_DB_VALUE;
  61. typedef struct /* DIST_NAME_DB_NODE */
  62. {
  63. HASH_NODE node;
  64. DIST_NAME_TYPE type;
  65. int valueLen;
  66. DIST_NAME_DB_VALUE value;
  67. char symName[DIST_NAME_MAX_LENGTH + 1];
  68. } DIST_NAME_DB_NODE;
  69. /* packets sent by name DNDB */
  70. typedef struct /* DIST_PKT_DNDB_ADD */
  71. {
  72. DIST_PKT dndbAddHdr;
  73. DIST_NAME_TYPE dndbAddType;
  74. uint8_t dndbAddValueLen;
  75. uint8_t dndbAddNameLen;
  76. __DIST_PKT_HDR_END__
  77. /* value follows */
  78. /* name follows  */
  79. } DIST_PKT_DNDB_ADD;
  80. typedef struct /* DIST_PKT_DNDB_RM */
  81. {
  82. DIST_PKT dndbRmHdr;
  83. uint8_t dndbRmNameLen;
  84. __DIST_PKT_HDR_END__
  85. /* name follows */
  86. } DIST_PKT_DNDB_RM;
  87. /* some helping structures */
  88. typedef struct /* DIST_NAME_MATCH */
  89. {
  90. void *pMatchValue;
  91. DIST_NAME_TYPE matchType;
  92. } DIST_NAME_MATCH;
  93. typedef struct /* DIST_NAME_BURST */
  94. {
  95. DIST_NODE_ID burstNodeId;
  96. STATUS burstStatus;
  97. } DIST_NAME_BURST;
  98. /* function declarations */
  99. #if defined(__STDC__) || defined(__cplusplus)
  100. DIST_NAME_DB_NODE *distNameEach (FUNCPTR routine, int routineArg);
  101. STATUS distNameBurst (DIST_NODE_ID nodeId);
  102. #else   /* __STDC__ */
  103. DIST_NAME_DB_NODE *distNameEach ();
  104. STATUS distNameBurst ();
  105. #endif  /* __STDC__ */
  106. #ifdef __cplusplus
  107. }
  108. #endif
  109. #endif /* __INCdistNameLibPh */