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.

263 lines
8.1 KiB

  1. /*++
  2. Copyright(c) 1998,99 Microsoft Corporation
  3. Module Name:
  4. univ.h
  5. Abstract:
  6. Windows Load Balancing Service (WLBS)
  7. Driver - global definitions
  8. Author:
  9. kyrilf
  10. --*/
  11. #ifndef _Univ_h_
  12. #define _Univ_h_
  13. #include <ndis.h>
  14. #include "wlbsparm.h"
  15. /* CONSTANTS */
  16. /* debugging constants and macros */
  17. #undef ASSERT
  18. #define ASSERT(v)
  19. #if DBG
  20. #define UNIV_TODO(s) DbgPrint ("Convoy ToDo (%s, %d) - %s\n", __FILE__, __LINE__, s)
  21. #define UNIV_PRINT(msg) { DbgPrint ("Convoy [%d @ %s] ", \
  22. __LINE__, __FILE__); \
  23. DbgPrint msg; DbgPrint ("\n"); }
  24. #define UNIV_DBG_ASSERT(c,m,d1,d2) if (!(c)) { DbgPrint ("Convoy (%s) [%X, %X] failed [%d @ %s] ", \
  25. #c, d1, d2, __LINE__, __FILE__); \
  26. DbgPrint m; DbgPrint ("\n"); }
  27. #define CVY_ASSERT_CODE 0xbfc0a55e
  28. #define UNIV_ASSERT(c) if (!(c)) \
  29. KeBugCheckEx (CVY_ASSERT_CODE, \
  30. log_module_id, __LINE__, \
  31. 0, 0);
  32. #define UNIV_ASSERT_VAL(c,v) if (!(c)) \
  33. KeBugCheckEx (CVY_ASSERT_CODE, \
  34. log_module_id, __LINE__, \
  35. v, 0);
  36. #define UNIV_ASSERT_VAL2(c,v1,v2) if (!(c)) \
  37. KeBugCheckEx (CVY_ASSERT_CODE, \
  38. log_module_id, __LINE__, \
  39. v1, v2);
  40. /* TRACE_... defines below toggle emmition of particular types of debug
  41. output */
  42. /* enabled trace types */
  43. #define TRACE_PARAMS /* registry parameter initialization (params.c) */
  44. #define TRACE_RCT /* remote control request processing (main.c) */
  45. #define TRACE_RCVRY /* packet filtering (load.c) */
  46. #define TRACE_FRAGS /* IP packet fragmentation (main.c) */
  47. /* disabled trace types */
  48. #if 0
  49. #define TRACE_GRE /* GRE packet processing (main.c) */
  50. #define TRACE_IPSEC /* IPSEC packet processing (main.c) */
  51. #define TRACE_TCP /* TCP packet processing (main.c) */
  52. #define TRACE_UDP /* UDP packet processing (main.c) */
  53. #define TRACE_ARP /* ARP packet processing (main.c) */
  54. #define TRACE_OID /* OID info/set requests (nic.c) */
  55. #define TRACE_DIRTY /* dirty connection processing (load.c) */
  56. #define TRACE_IP /* IP packet processing (main.c) */
  57. #define TRACE_CVY /* Convoy packet processing (main.c) */
  58. #define TRACE_CNCT /* TCP connection boundaries (main.c) */
  59. #define TRACE_LOAD /* packet filtering (load.c) */
  60. #define PERIODIC_RESET /* reset underlying NIC periodically for testing
  61. see main.c, prot.c for usage */
  62. #define NO_CLEANUP /* do not cleanup host map (load.c) */
  63. #endif
  64. #else /* DBG */
  65. #define UNIV_TODO(s)
  66. #define UNIV_PRINT(msg)
  67. #define UNIV_DBG_ASSERT(c,m,d1,d2)
  68. #define UNIV_ASSERT(c)
  69. #define UNIV_ASSERT_VAL(c,v)
  70. #define UNIV_ASSERT_VAL2(c,v1,v2)
  71. #endif /* DBG */
  72. #define UNIV_POOL_TAG 'SBLW'
  73. /* constants for some NDIS routines */
  74. #define UNIV_WAIT_TIME 0
  75. #define UNIV_NDIS_MAJOR_VERSION_OLD 4
  76. #define UNIV_NDIS_MAJOR_VERSION 5 /* #ps# */
  77. #define UNIV_NDIS_MINOR_VERSION 1 /* NT 5.1 */
  78. /* Convoy protocol name to be reported to NDIS during binding */
  79. #define UNIV_NDIS_PROTOCOL_NAME NDIS_STRING_CONST ("WLBS")
  80. /* supported medium types */
  81. #define UNIV_NUM_MEDIUMS 1
  82. #define UNIV_MEDIUMS { NdisMedium802_3 }
  83. /* number of supported OIDs (some are supported by Convoy directly and some
  84. are passed down to the underlying drivers) */
  85. #define UNIV_NUM_OIDS 56
  86. /* TYPES */
  87. /* some procedure types */
  88. typedef VOID (* UNIV_SYNC_CALLB) (NDIS_HANDLE, PVOID);
  89. typedef NDIS_STATUS (* UNIV_IOCTL_HDLR) (PVOID, PVOID);
  90. /* GLOBALS */
  91. /* The global teaming list spin lock. */
  92. extern NDIS_SPIN_LOCK univ_bda_teaming_lock;
  93. // extern UNIV_ADAPTER univ_adapters [CVY_MAX_ADAPTERS]; /* list of adapters */
  94. extern UNIV_IOCTL_HDLR univ_ioctl_hdlr; /* preserved NDIS IOCTL handler */
  95. extern PVOID univ_driver_ptr; /* driver pointer passed during
  96. initialization */
  97. extern NDIS_HANDLE univ_driver_handle; /* driver handle */
  98. extern NDIS_HANDLE univ_wrapper_handle; /* NDIS wrapper handle */
  99. extern NDIS_HANDLE univ_prot_handle; /* NDIS protocol handle */
  100. extern NDIS_HANDLE univ_ctxt_handle; /* Convoy context handle */
  101. // ###### ramkrish extern ULONG univ_convoy_enabled; /* clustering mode enabled */
  102. extern PWSTR univ_reg_path; /* registry path name passed
  103. during initialization */
  104. extern ULONG univ_reg_path_len;
  105. // ###### ramkrish extern ULONG univ_bound; /* Convoy has been bound into
  106. // the network stack */
  107. // ###### ramkrish extern ULONG univ_announced; /* TCP/IP has been bound to
  108. // Convoy */
  109. extern NDIS_SPIN_LOCK univ_bind_lock; /* protects access to univ_bound
  110. and univ_announced */
  111. extern ULONG univ_changing_ip; /* IP address change in process */
  112. // ###### ramkrish extern ULONG univ_inited; /* context initialized */
  113. extern NDIS_PHYSICAL_ADDRESS univ_max_addr; /* maximum physical address
  114. constant to be passed to
  115. NDIS memory allocation calls */
  116. extern NDIS_MEDIUM univ_medium_array [];/* supported medium types */
  117. // ###### ramkrish extern CVY_PARAMS univ_params; /* registry parameters */
  118. // ###### ramkrish extern ULONG univ_params_valid; /* paramter structure contains
  119. // valid data */
  120. // ###### ramkrish extern ULONG univ_optimized_frags;/* port rules allow for optimized
  121. // handling of IP fragments */
  122. extern NDIS_OID univ_oids []; /* list of supported OIDs */
  123. extern WCHAR empty_str [];
  124. extern NDIS_HANDLE univ_device_handle;
  125. extern PDEVICE_OBJECT univ_device_object;
  126. /* PROCEDURES */
  127. extern VOID Univ_ndis_string_alloc (
  128. PNDIS_STRING string,
  129. PCHAR src);
  130. /*
  131. Allocates NDIS string and copies contents of character string to it
  132. returns VOID:
  133. function:
  134. */
  135. extern VOID Univ_ndis_string_free (
  136. PNDIS_STRING string);
  137. /*
  138. Frees memory previously allocated for the NDIS string
  139. returns VOID:
  140. function:
  141. */
  142. extern VOID Univ_ansi_string_alloc (
  143. PANSI_STRING string,
  144. PWCHAR src);
  145. /*
  146. Allocates NDIS string and copies contents of character string to it
  147. returns VOID:
  148. function:
  149. */
  150. extern VOID Univ_ansi_string_free (
  151. PANSI_STRING string);
  152. /*
  153. Frees memory previously allocated for the NDIS string
  154. returns VOID:
  155. function:
  156. */
  157. extern ULONG Univ_str_to_ulong (
  158. PULONG retp,
  159. PWCHAR start_ptr,
  160. PWCHAR * end_ptr,
  161. ULONG width,
  162. ULONG base);
  163. /*
  164. Converts string representaion of a number to a ULONG value
  165. returns ULONG :
  166. TRUE => success
  167. FALSE => failure
  168. function:
  169. */
  170. extern PWCHAR Univ_ulong_to_str (
  171. ULONG val,
  172. PWCHAR buf,
  173. ULONG base);
  174. /*
  175. Converts ULONG value to a string representation in specified base
  176. returns PWCHAR:
  177. <pointer to the symbol in the string following the converted number>
  178. function:
  179. */
  180. #endif /* _Univ_h_ */