Leaked source code of windows server 2003
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.

265 lines
9.2 KiB

  1. #ifndef _JRGP_H_
  2. #define _JRGP_H_
  3. #ifdef __TANDEM
  4. #pragma columns 79
  5. #pragma page "jrgp.h - T9050 - external declarations for Regroup Module"
  6. #endif
  7. /* @@@ START COPYRIGHT @@@
  8. ** Tandem Confidential: Need to Know only
  9. ** Copyright (c) 1995, Tandem Computers Incorporated
  10. ** Protected as an unpublished work.
  11. ** All Rights Reserved.
  12. **
  13. ** The computer program listings, specifications, and documentation
  14. ** herein are the property of Tandem Computers Incorporated and shall
  15. ** not be reproduced, copied, disclosed, or used in whole or in part
  16. ** for any reason without the prior express written permission of
  17. ** Tandem Computers Incorporated.
  18. **
  19. ** @@@ END COPYRIGHT @@@
  20. **/
  21. /*---------------------------------------------------------------------------
  22. * This file (jrgp.h) contains all the type and function declarations exported
  23. * by Regroup.
  24. *---------------------------------------------------------------------------*/
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif /* __cplusplus */
  28. #include <jrgpos.h>
  29. /* The following literals define the various events that may impinge
  30. * upon the regroup algorithm main state.
  31. */
  32. enum
  33. {
  34. RGP_EVT_POWERFAIL = 1,
  35. RGP_EVT_NODE_UNREACHABLE = 2,
  36. RGP_EVT_PHASE1_CLEANUP_DONE = 3,
  37. RGP_EVT_PHASE2_CLEANUP_DONE = 4,
  38. RGP_EVT_LATEPOLLPACKET = 5,
  39. RGP_EVT_CLOCK_TICK = 6,
  40. RGP_EVT_RECEIVED_PACKET = 7,
  41. RGP_EVT_BANISH_NODE = 8,
  42. RGP_EVT_IGNORE_MASK = 9
  43. };
  44. /* Detailed description of event codes:
  45. * -----------------------------------
  46. *
  47. * RGP_EVT_POWERFAIL
  48. *
  49. * After a power failure, regroup must start or be restarted.
  50. * This event can also be used when a power fail shout packet
  51. * indicating a power failure is received from another node,
  52. * even though our own node hasn't detected a power failure.
  53. *
  54. * RGP_EVT_NODE_UNREACHABLE
  55. *
  56. * When all paths to a node are down, the message system reports
  57. * this event.
  58. *
  59. * RGP_EVT_PHASE1_CLEANUP_DONE,
  60. * RGP_EVT_PHASE2_CLEANUP_DONE
  61. *
  62. * Regroup provides two phases for the message system or cluster manager
  63. * to clean up messages on all nodes. The first phase of cleanup begins
  64. * after regroup reports one or more node failures. The second phase
  65. * begins when a node learns that all nodes have completed phase 1
  66. * clean up.
  67. *
  68. * The message system or cluster manager on each node must inform
  69. * regroup when the local cleanup for each phase is complete using
  70. * the following events.
  71. *
  72. * The NSK message system uses phase 1 to cancel all incoming (server)
  73. * messages and phase 2 to terminate all outgoing (requester) messages.
  74. *
  75. *
  76. * The remaining events are for internal use by the Regroup algorithm.
  77. * ------------------------------------------------------------------
  78. *
  79. * RGP_EVT_LATEPOLLPACKET
  80. *
  81. * When a node is late with its IamAlive messages, regroup must start a
  82. * new round of regrouping.
  83. *
  84. * RGP_EVT_CLOCK_TICK
  85. *
  86. * Once regroup is active, it needs to get clock ticks at periodic
  87. * intervals.
  88. *
  89. * RGP_EVT_RECEIVED_PACKET
  90. *
  91. * When a regroup packet arrives, it must be processed.
  92. *
  93. * RGP_EVT_BANISH_NODE
  94. *
  95. * When regroup is restarted with the reason RGP_EVT_BANISH_NODE,
  96. * each node participating in this regroup event shall install the
  97. * causing node into its Banished mask.
  98. *
  99. * RGP_EVT_IGNORE_MASK
  100. *
  101. * When regroup's ignore mask has changed, the reason code is set
  102. * to RGP_EVT_IGNORE_MASK. This will allow UnpackIgnoreScreen routine
  103. * to process causingnode and reason fields in a special way.
  104. * If the reason is less than RGP_EVT_IGNORE_MASK, ignore mask is
  105. * considered to be empty.
  106. */
  107. /************************************************************************
  108. * rgp_info_t (used to get and set regroup parameters)
  109. * ---------------------------------------------------
  110. * This structure is used to get the current regroup parameters in order to
  111. * pass them to a new node being brought up. The structure can also be
  112. * used to modify regroup timing parameters before a cluster is formed
  113. * (that is, more than one node is booted).
  114. *
  115. * ___________________________________________________________
  116. * wd0 | version |
  117. * |___________________________________________________________|
  118. * wd1 | seqnum |
  119. * |___________________________________________________________|
  120. * wd2 | a_tick | imalive_ticks |
  121. * |_____________________________|_____________________________|
  122. * wd3 | check_ticks | min_stage1_ticks |
  123. * |_____________________________|_____________________________|
  124. * wd4 | cluster | unused |
  125. * |_____________________________|_____________________________|
  126. *
  127. *
  128. * version - version# of this data structure
  129. * seqnum - sequence number for coordinating regroup
  130. * incidents between nodes
  131. * a_tick - regroup clockperiod. in milliseconds.
  132. * iamalive_ticks - # of regroup clock ticks between IamAlive
  133. * messages
  134. * check_ticks - # of imalive ticks by which at least 1 imalive must arrive
  135. * min_stage1_ticks - precomputed to be (imalive_ticks*check_ticks)
  136. * cluster - current cluster membership mask
  137. */
  138. #ifdef __TANDEM
  139. #pragma fieldalign shared8 rgpinfo
  140. #endif /* __TANDEM */
  141. typedef struct rgpinfo
  142. {
  143. uint32 version;
  144. uint32 seqnum;
  145. uint16 a_tick; /* in ms.== clockPeriod */
  146. uint16 iamalive_ticks; /* number of ticks between imalive sends == sendHBRate */
  147. uint16 check_ticks; /* number of imalive ticks before at least 1 imalive == rcvHBRate */
  148. uint16 Min_Stage1_ticks; /* precomputed to be imalive_ticks*check_ticks */
  149. cluster_t cluster;
  150. } rgpinfo_t;
  151. typedef struct rgpinfo *rgpinfo_p;
  152. /*---------------------------------------------------------------------------*/
  153. /* Routines exported by the Regroup Module
  154. * ---------------------------------------
  155. *
  156. * These routine names are in upper case to enable them to be called from
  157. * routines written in the PTAL language which is case insensitive and
  158. * converts all symbols to upper case.
  159. */
  160. _priv _resident extern int
  161. RGP_ESTIMATE_MEMORY(void);
  162. #define rgp_estimate_memory RGP_ESTIMATE_MEMORY
  163. _priv _resident extern void
  164. RGP_INIT(node_t this_node,
  165. unsigned int num_nodes,
  166. void *rgp_buffer,
  167. int rgp_buflen,
  168. rgp_msgsys_p rgp_msgsys_p);
  169. #define rgp_init RGP_INIT
  170. _priv _resident extern void
  171. RGP_CLEANUP(void);
  172. #define rgp_cleanup RGP_CLEANUP
  173. _priv _resident extern uint32
  174. RGP_SEQUENCE_NUMBER(void);
  175. #define rgp_sequence_number RGP_SEQUENCE_NUMBER
  176. _priv _resident extern int
  177. RGP_GETRGPINFO(rgpinfo_t *rgpinfo);
  178. #define rgp_getrgpinfo RGP_GETRGPINFO
  179. _priv _resident extern int
  180. RGP_SETRGPINFO(rgpinfo_t *rgpinfo);
  181. #define rgp_setrgpinfo RGP_SETRGPINFO
  182. _priv _resident extern void
  183. RGP_START(void (*nodedown_callback)(cluster_t failed_nodes),
  184. int (*select_cluster)(cluster_t cluster_choices[],
  185. int num_clusters));
  186. #define rgp_start RGP_START
  187. _priv _resident extern int
  188. RGP_ADD_NODE(node_t node);
  189. #define rgp_add_node RGP_ADD_NODE
  190. _priv _resident extern int
  191. RGP_MONITOR_NODE(node_t node);
  192. #define rgp_monitor_node RGP_MONITOR_NODE
  193. _priv _resident extern int
  194. RGP_REMOVE_NODE(node_t node);
  195. #define rgp_remove_node RGP_REMOVE_NODE
  196. _priv _resident extern int
  197. RGP_IS_PERTURBED(void);
  198. #define rgp_is_perturbed RGP_IS_PERTURBED
  199. _priv _resident extern void
  200. RGP_PERIODIC_CHECK(void);
  201. #define rgp_periodic_check RGP_PERIODIC_CHECK
  202. _priv _resident extern void
  203. RGP_RECEIVED_PACKET(node_t node, void *packet, int packetlen);
  204. #define rgp_received_packet RGP_RECEIVED_PACKET
  205. _priv _resident extern void
  206. RGP_EVENT_HANDLER_EX(int event, node_t causingnode, void* arg);
  207. #define RGP_EVENT_HANDLER(_event, _causingnode) RGP_EVENT_HANDLER_EX(_event, _causingnode, NULL)
  208. #define rgp_event_handler RGP_EVENT_HANDLER
  209. /*---------------------------------------------------------------------------*/
  210. #ifdef __cplusplus
  211. }
  212. #endif /* __cplusplus */
  213. #if 0
  214. History of changes to this file:
  215. -------------------------------------------------------------------------
  216. 1995, December 13 F40:KSK0610 /*F40:KSK06102.1*/
  217. This file is part of the portable Regroup Module used in the NonStop
  218. Kernel (NSK) and Loosely Coupled UNIX (LCU) operating systems. There
  219. are 10 files in the module - jrgp.h, jrgpos.h, wrgp.h, wrgpos.h,
  220. srgpif.c, srgpos.c, srgpsm.c, srgputl.c, srgpcli.c and srgpsvr.c.
  221. The last two are simulation files to test the Regroup Module on a
  222. UNIX workstation in user mode with processes simulating processor nodes
  223. and UDP datagrams used to send unacknowledged datagrams.
  224. This file was first submitted for release into NSK on 12/13/95.
  225. ------------------------------------------------------------------------------
  226. #endif /* 0 - change descriptions */
  227. #endif /* _JRGP_H_ defined */
  228.