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.

272 lines
9.7 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. #define CVY_ASSERT_CODE 0xbfc0a55e
  20. #if DBG
  21. #define UNIV_PRINT_INFO(msg) { \
  22. DbgPrint ("NLB (Information) [%s:%d] ", __FILE__, __LINE__); \
  23. DbgPrint msg; \
  24. DbgPrint ("\n"); \
  25. }
  26. #define UNIV_PRINT_CRIT(msg) { \
  27. DbgPrint ("NLB (Error) [%s:%d] ", __FILE__, __LINE__); \
  28. DbgPrint msg; \
  29. DbgPrint ("\n"); \
  30. }
  31. #if 0 /* Turn off these debug prints by default. */
  32. #define UNIV_PRINT_VERB(msg) { \
  33. DbgPrint ("NLB (Verbose) [%s:%d] ", __FILE__, __LINE__); \
  34. DbgPrint msg; \
  35. DbgPrint ("\n"); \
  36. }
  37. #else
  38. #define UNIV_PRINT_VERB(msg)
  39. #endif
  40. #define UNIV_ASSERT(c) if (!(c)) KeBugCheckEx (CVY_ASSERT_CODE, log_module_id, __LINE__, 0, 0);
  41. #define UNIV_ASSERT_VAL(c,v) if (!(c)) KeBugCheckEx (CVY_ASSERT_CODE, log_module_id, __LINE__, v, 0);
  42. #define UNIV_ASSERT_VAL2(c,v1,v2) if (!(c)) KeBugCheckEx (CVY_ASSERT_CODE, log_module_id, __LINE__, v1, v2);
  43. /* TRACE_... defines below toggle emmition of particular types of debug output */
  44. #if 0
  45. #define TRACE_PARAMS /* registry parameter initialization (params.c) */
  46. #define TRACE_RCT /* remote control request processing (main.c) */
  47. #define TRACE_RCVRY /* packet filtering (load.c) */
  48. #define TRACE_FRAGS /* IP packet fragmentation (main.c) */
  49. #define TRACE_ARP /* ARP packet processing (main.c) */
  50. #define TRACE_OID /* OID info/set requests (nic.c) */
  51. #define TRACE_DSCR /* descriptor timeout and removal (load.c) */
  52. #define TRACE_CVY /* Convoy packet processing (main.c) */
  53. #define PERIODIC_RESET /* reset underlying NIC periodically for testing see main.c, prot.c for usage */
  54. #define NO_CLEANUP /* do not cleanup host map (load.c) */
  55. #endif
  56. #else /* DBG */
  57. #define UNIV_PRINT_INFO(msg)
  58. #define UNIV_PRINT_VERB(msg)
  59. #define UNIV_PRINT_CRIT(msg)
  60. #define UNIV_ASSERT(c)
  61. #define UNIV_ASSERT_VAL(c,v)
  62. #define UNIV_ASSERT_VAL2(c,v1,v2)
  63. #endif /* DBG */
  64. #define UNIV_POOL_TAG 'SBLW'
  65. /* constants for some NDIS routines */
  66. #define UNIV_WAIT_TIME 0
  67. #define UNIV_NDIS_MAJOR_VERSION_OLD 4
  68. #define UNIV_NDIS_MAJOR_VERSION 5 /* #ps# */
  69. #define UNIV_NDIS_MINOR_VERSION 1 /* NT 5.1 */
  70. /* Convoy protocol name to be reported to NDIS during binding */
  71. #define UNIV_NDIS_PROTOCOL_NAME NDIS_STRING_CONST ("WLBS")
  72. /* supported medium types */
  73. #define UNIV_NUM_MEDIUMS 1
  74. #define UNIV_MEDIUMS { NdisMedium802_3 }
  75. /* number of supported OIDs (some are supported by Convoy directly and some
  76. are passed down to the underlying drivers) */
  77. #define UNIV_NUM_OIDS 56
  78. /* TYPES */
  79. /* some procedure types */
  80. typedef NDIS_STATUS (* UNIV_IOCTL_HDLR) (PVOID, PVOID);
  81. /* GLOBALS */
  82. /* The global teaming list spin lock. */
  83. extern NDIS_SPIN_LOCK univ_bda_teaming_lock;
  84. extern UNIV_IOCTL_HDLR univ_ioctl_hdlr; /* preserved NDIS IOCTL handler */
  85. extern PVOID univ_driver_ptr; /* driver pointer passed during
  86. initialization */
  87. extern NDIS_HANDLE univ_driver_handle; /* driver handle */
  88. extern NDIS_HANDLE univ_wrapper_handle; /* NDIS wrapper handle */
  89. extern NDIS_HANDLE univ_prot_handle; /* NDIS protocol handle */
  90. extern NDIS_HANDLE univ_ctxt_handle; /* Convoy context handle */
  91. extern UNICODE_STRING DriverEntryRegistryPath; /* registry path name passed during initialization
  92. (i.e. DriverEntry()) */
  93. extern PWSTR univ_reg_path; /* registry path name passed during initialization
  94. (i.e. DriverEntry()) + "\\Parameters\\Interface" */
  95. extern ULONG univ_reg_path_len;
  96. extern NDIS_SPIN_LOCK univ_bind_lock; /* protects access to univ_bound
  97. and univ_announced */
  98. extern ULONG univ_changing_ip; /* IP address change in process */
  99. extern NDIS_PHYSICAL_ADDRESS univ_max_addr; /* maximum physical address
  100. constant to be passed to
  101. NDIS memory allocation calls */
  102. extern NDIS_MEDIUM univ_medium_array [];/* supported medium types */
  103. extern NDIS_OID univ_oids []; /* list of supported OIDs */
  104. extern WCHAR empty_str [];
  105. extern NDIS_HANDLE univ_device_handle;
  106. extern PDEVICE_OBJECT univ_device_object;
  107. extern ULONG univ_tcp_cleanup; /* Whether or not TCP cleanup polling should be performed. */
  108. /* Use this macro to determine whether or not TCP connection state purging is enabled.
  109. This cleanup is always on unless IPNAT.sys is detected, in which case querying TCP
  110. is unreliable; this is not configurable via the registry or an IOCTL. */
  111. #define NLB_TCP_CLEANUP_ON() (univ_tcp_cleanup)
  112. #if defined (NLB_TCP_NOTIFICATION)
  113. extern ULONG univ_notification; /* What notification scheme is in use, if any.
  114. 0 = NLB_CONNECTION_CALLBACK_NONE
  115. 1 = NLB_CONNECTION_CALLBACK_TCP
  116. 2 = NLB_CONNECTION_CALLBACK_ALTERNATE */
  117. extern PCALLBACK_OBJECT univ_tcp_callback_object; /* The TCP connection notification callback object. */
  118. extern PVOID univ_tcp_callback_function; /* The TCP connection notification callback function.
  119. Needed to de-register the callback function later. */
  120. extern PCALLBACK_OBJECT univ_alternate_callback_object; /* The NLB public connection notification callback object. */
  121. extern PVOID univ_alternate_callback_function; /* The NLB public connection notification callback function.
  122. Needed to de-register the callback function later. */
  123. /* Use this macro to determine whether or not connection notifications have been enabled. */
  124. #define NLB_NOTIFICATIONS_ON() ((univ_notification == NLB_CONNECTION_CALLBACK_TCP) || (univ_notification == NLB_CONNECTION_CALLBACK_ALTERNATE))
  125. #define NLB_TCP_NOTIFICATION_ON() (univ_notification == NLB_CONNECTION_CALLBACK_TCP)
  126. #define NLB_ALTERNATE_NOTIFICATION_ON() (univ_notification == NLB_CONNECTION_CALLBACK_ALTERNATE)
  127. #endif
  128. /* PROCEDURES */
  129. extern VOID Univ_ndis_string_alloc (
  130. PNDIS_STRING string,
  131. PCHAR src);
  132. /*
  133. Allocates NDIS string and copies contents of character string to it
  134. returns VOID:
  135. function:
  136. */
  137. extern VOID Univ_ndis_string_free (
  138. PNDIS_STRING string);
  139. /*
  140. Frees memory previously allocated for the NDIS string
  141. returns VOID:
  142. function:
  143. */
  144. extern VOID Univ_ansi_string_alloc (
  145. PANSI_STRING string,
  146. PWCHAR src);
  147. /*
  148. Allocates NDIS string and copies contents of character string to it
  149. returns VOID:
  150. function:
  151. */
  152. extern VOID Univ_ansi_string_free (
  153. PANSI_STRING string);
  154. /*
  155. Frees memory previously allocated for the NDIS string
  156. returns VOID:
  157. function:
  158. */
  159. extern ULONG Univ_str_to_ulong (
  160. PULONG retp,
  161. PWCHAR start_ptr,
  162. PWCHAR * end_ptr,
  163. ULONG width,
  164. ULONG base);
  165. /*
  166. Converts string representaion of a number to a ULONG value
  167. returns ULONG :
  168. TRUE => success
  169. FALSE => failure
  170. function:
  171. */
  172. extern PWCHAR Univ_ulong_to_str (
  173. ULONG val,
  174. PWCHAR buf,
  175. ULONG base);
  176. /*
  177. Converts ULONG value to a string representation in specified base
  178. returns PWCHAR:
  179. <pointer to the symbol in the string following the converted number>
  180. function:
  181. */
  182. /* Compare "length" characters of two unicode strings - case insensitive. */
  183. extern BOOL Univ_equal_unicode_string (PWSTR string1, PWSTR string2, ULONG length);
  184. /* Converts an ip address of integer type to string(with '.'s) */
  185. extern void Univ_ip_addr_ulong_to_str (
  186. ULONG val,
  187. PWCHAR buf);
  188. #endif /* _Univ_h_ */