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.

225 lines
6.3 KiB

  1. /*++
  2. Copyright (c) 1992-1993 Microsoft Corporation
  3. Module Name:
  4. nwmisc.h
  5. Abstract:
  6. Header which specifies the misc routines used by the workstation service.
  7. Author:
  8. Arnold Miller (arnoldm) 15-Feb-1996
  9. Revision History:
  10. --*/
  11. #ifndef __RNRDEFS_H__
  12. #define __RNRDEFS_H__
  13. #include "sapcmn.h"
  14. //
  15. // Bit defs for the protocols
  16. //
  17. #define IPX_BIT 1
  18. #define SPX_BIT 2
  19. #define SPXII_BIT 4
  20. //
  21. // forwards\
  22. //
  23. struct _SAP_RNR_CONTEXT;
  24. //
  25. // Bindery control
  26. //
  27. typedef struct _BinderyControl
  28. {
  29. LONG lIndex;
  30. } BINDERYCONTROL, *PBINDERYCONTROL;
  31. //
  32. // SAP RnR context information. This is linked off of the
  33. // SAP_BCAST_CONTROL defined ahead
  34. //
  35. typedef struct _SAP_DATA
  36. {
  37. struct _SAP_DATA * sapNext;
  38. // save everything except hop count
  39. WORD sapid; // for a sanity check
  40. CHAR sapname[48]; // what we don't know
  41. BYTE socketAddr[IPX_ADDRESS_LENGTH]; // and what we seek
  42. } SAP_DATA, *PSAP_DATA;
  43. //
  44. //
  45. // Sap bcast control
  46. // An important note. fFlags is set only by the thread executing
  47. // a LookupServiceBegin or a LookupServiceNext. It may be tested by
  48. // any thread. Its counterpart, dwControlFlags in SAP_RNR_CONTEXT
  49. // is reserved for setting by LookupServiceBegin and LookupServiceEnd. Once
  50. // again any thread may look at it. This insures no loss of data on an
  51. // MP machine without needing a critical section.
  52. //
  53. typedef struct _SAP_BCAST_CONTROL
  54. {
  55. DWORD dwIndex; // loop control
  56. DWORD dwTickCount; // tick count of last send
  57. DWORD fFlags; // various flags
  58. PVOID pvArg;
  59. SOCKET s;
  60. CRITICAL_SECTION csMonitor; // This is to keep
  61. // out internal structures sane. Note
  62. // it does not provide rational
  63. // serialization. In particular, if
  64. // multiple threads use the same
  65. // handle simultaneously, there is no
  66. // guaranteed serialization.
  67. PSAP_DATA psdNext1; // next to return
  68. PSAP_DATA psdHead; // list head
  69. PSAP_DATA psdTail;
  70. struct _SAP_RNR_CONTEXT * psrc; // need this
  71. DWORD (*Func)(PVOID pvArg1, PSAP_IDENT_HEADER pSap, PDWORD pdwErr);
  72. BOOL (*fCheckCancel)(PVOID pvArg1);
  73. WORD wQueryType;
  74. } SAP_BCAST_CONTROL, *PSAP_BCAST_CONTROL;
  75. //
  76. // Flags for above
  77. #define SBC_FLAG_NOMORE 0x1
  78. //
  79. // Structure used by the old RnR Sap lookup as the pvArg value in
  80. // SAP_BCAST control
  81. //
  82. #ifndef _NTDEF_
  83. typedef struct _STRING {
  84. USHORT Length;
  85. USHORT MaximumLength;
  86. #ifdef MIDL_PASS
  87. [size_is(MaximumLength), length_is(Length) ]
  88. #endif // MIDL_PASS
  89. PCHAR Buffer;
  90. } OEM_STRING;
  91. #endif
  92. typedef struct _OldRnRSap
  93. {
  94. OEM_STRING * poem;
  95. HANDLE hCancel;
  96. LPVOID lpCsAddrBuffer;
  97. LPDWORD lpdwBufferLength;
  98. DWORD nProt;
  99. LPDWORD lpcAddress;
  100. } OLDRNRSAP, *POLDRNRSAP;
  101. //
  102. // Return codes from the coroutine
  103. //
  104. #define dwrcDone 1 // all done, return success
  105. #define dwrcCancel 2 // all done, return cancelled
  106. #define dwrcNoWait 3 // keep going, but never wait.
  107. #define dwrcNil 4 // do whatever you want
  108. //
  109. // Sap service query packet format
  110. //
  111. typedef struct _SAP_REQUEST {
  112. USHORT QueryType;
  113. USHORT ServerType;
  114. } SAP_REQUEST, *PSAP_REQUEST;
  115. #define QT_GENERAL_QUERY 1
  116. #define QT_NEAREST_QUERY 3
  117. // The context information we put inside of an RNRNSHANDLE structure
  118. // to keep track of what we are doing
  119. // N.B. See comment on SAP_BCAST_CONTROL about the use of dwControlFlags.
  120. //
  121. typedef struct _SAP_RNR_CONTEXT
  122. {
  123. struct _SAP_RNR_CONTEXT * pNextContext;
  124. LONG lSig;
  125. LONG lInUse;
  126. DWORD dwCount; // count of queries made
  127. DWORD fFlags; // always nice to have
  128. DWORD dwControlFlags;
  129. DWORD fConnectionOriented;
  130. WORD wSapId; // the type desired
  131. HANDLE Handle; // the corresponding RnR handle
  132. DWORD nProt;
  133. GUID gdType; // the type we are seeking
  134. GUID gdProvider;
  135. HANDLE hServer;
  136. WCHAR wszContext[48];
  137. WCHAR chwName[48]; // the name, if any
  138. CHAR chName[48]; // OEM form of the name for SAP
  139. DWORD dwUnionType; // type of lookup, once we know
  140. union
  141. {
  142. SAP_BCAST_CONTROL sbc;
  143. BINDERYCONTROL bc;
  144. } u_type;
  145. PVOID pvVersion; // a trick to get the version here.
  146. } SAP_RNR_CONTEXT, *PSAP_RNR_CONTEXT;
  147. #define RNR_SIG 0xaabbccdd
  148. //
  149. // union types
  150. //
  151. #define LOOKUP_TYPE_NIL 0
  152. #define LOOKUP_TYPE_SAP 1
  153. #define LOOKUP_TYPE_BINDERY 2
  154. #define SAP_F_END_CALLED 0x1 // generic cancel
  155. //
  156. // Defs for the bindery Class info
  157. // This defines the format of each ClassInfo property segement. It looks
  158. // somewhat like an actual ClassInfo, but considerably compressed. Note
  159. // due to marshalling problems, any complex value, such as a GUID,
  160. // should be stored as a string and then imported. Hence, we define
  161. // types for what we can anticipate.
  162. //
  163. typedef struct _BinderyClasses
  164. {
  165. BYTE bType;
  166. BYTE bSizeOfType;
  167. BYTE bSizeOfString;
  168. BYTE bOffset; // where the data area begins
  169. BYTE bFlags;
  170. BYTE bFiller;
  171. WORD wNameSpace; // the applicable namespace
  172. CHAR cDataArea[120]; // where the type and string are placed
  173. } BINDERYCLASSES, *PBINDERYCLASSES;
  174. #define BT_DWORD 1 // DWORD
  175. #define BT_WORD 2 // WORD
  176. #define BT_GUID 3 // a string GUID (ASCII)
  177. #define BT_STR 3 // an OEM string
  178. #define BT_OID 4 // an object ID (TBD)
  179. #define BT_BSTR 5 // a binary string (very dangerous)
  180. #define BT_WSTR 6 // UNICODE string. Unmarshalled!
  181. #define RNRTYPE "RNR_TYPE" // prop containing the GUID
  182. #define RNRCLASSES "RNR_CLASSES" // the other property
  183. #endif