Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

140 lines
2.6 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. msg.h
  5. Abstract:
  6. msg definition
  7. Author:
  8. Ahmed Mohamed (ahmedm) 12, 01, 2000
  9. Revision History:
  10. --*/
  11. #ifndef GS_MSG_H
  12. #define GS_MSG_H
  13. #include "type.h"
  14. #define GS_MSG_TYPE_SEQALLOC 0
  15. #define GS_MSG_TYPE_SEQREPLY 1
  16. #define GS_MSG_TYPE_MCAST 2
  17. #define GS_MSG_TYPE_REPLY 3
  18. #define GS_MSG_TYPE_UCAST 4
  19. #define GS_MSG_TYPE_ACK 5
  20. #define GS_MSG_TYPE_INFO 6
  21. #define GS_MSG_TYPE_MM 7
  22. #define GS_MSG_TYPE_JOIN_REQUEST 8
  23. #define GS_MSG_TYPE_JOIN 9
  24. #define GS_MSG_TYPE_UP 10
  25. #define GS_MSG_TYPE_EVICT_REQUEST 11
  26. #define GS_MSG_TYPE_EVICT 12
  27. #define GS_MSG_TYPE_RECOVERY 13
  28. #define GS_MSG_TYPE_SYNC 14
  29. #define GS_MSG_TYPE_ABORT 244
  30. #define GS_MSG_TYPE_SKIP 255
  31. #define GS_MSG_STATE_FREE 0
  32. #define GS_MSG_STATE_NEW 1
  33. #define GS_MSG_STATE_READY 2
  34. #define GS_MSG_STATE_DELIVERED 3
  35. #define GS_MSG_STATE_DONE 4
  36. typedef struct gs_msg_hdr {
  37. UINT16 h_len; // payload size
  38. UINT16 h_type; // msg type
  39. UINT16 h_flags; // msg flags
  40. UINT16 h_viewnum; // generation number, drop this msg if no match
  41. UINT16 h_rlen; // for delivered msgs, how big can sender accept reply
  42. gs_cookie_t h_cid; // sender cookie for reply packets
  43. gs_gid_t h_gid; // group id
  44. gs_sequence_t h_mseq; // global sequence
  45. gs_sequence_t h_bnum; // this msg batch number
  46. gs_sequence_t h_lseq; // sender sequence number
  47. gs_memberid_t h_mid; // master member id
  48. gs_memberid_t h_sid; // sender member id
  49. char h_tag[64];
  50. }gs_msg_hdr_t;
  51. #define MSG_TYPE_HDR 1
  52. #define MSG_TYPE_DATA 2
  53. typedef struct gs_msg {
  54. struct gs_msg *m_next; // next msg in queue
  55. UINT8 m_type; // type
  56. UINT8 m_refcnt; // refcnt
  57. UINT16 m_buflen; // length of buffer
  58. gs_msg_hdr_t m_hdr; // msg header
  59. char *m_buf;
  60. }gs_msg_t;
  61. int
  62. WINAPI
  63. msg_addnode(int id, char *n, char *a);
  64. gs_msg_t * msg_alloc(const char *buf, int len);
  65. int msg_send(gs_memberid_t, gs_msg_hdr_t *, const char *, int);
  66. void msg_mcast(ULONG, gs_msg_hdr_t *, const char *, int);
  67. void msg_smcast(ULONG, gs_msg_hdr_t *, const char *, int);
  68. void msg_free(gs_msg_t *);
  69. int msg_init();
  70. void msg_exit();
  71. int msg_getsize();
  72. typedef void(*gs_msg_handler_t)(gs_msg_t *);
  73. typedef enum {
  74. MSG_NODE_ID,
  75. MSG_NODE_JOIN,
  76. MSG_NODE_UP,
  77. MSG_NODE_DOWN
  78. }gs_node_event_t;
  79. typedef void(*gs_node_handler_t)(int);
  80. void
  81. msg_set_uport(int uport);
  82. void
  83. msg_set_mport(int mport);
  84. void
  85. msg_set_uipaddr(char *addr);
  86. void
  87. msg_set_mipaddr(char *addr);
  88. void
  89. msg_set_bufcount(int count);
  90. void
  91. msg_set_bufsize(int size);
  92. void
  93. msg_start(ULONG mask);
  94. #endif