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.

461 lines
12 KiB

  1. /*++
  2. Copyright (c) 1991-1998 Microsoft Corporation
  3. Module Name:
  4. nspapi.h
  5. Abstract:
  6. Name Space Provider API prototypes and manifests. See the
  7. "Windows NT NameSpace Provider Specification" document for
  8. details.
  9. Environment:
  10. User Mode -Win32
  11. Notes:
  12. You must include "basetyps.h" first. Some types should
  13. use definitions from base files rather than redefine here.
  14. Unfortunately, so such base file exists.
  15. --*/
  16. #ifndef _NSPAPI_INCLUDED
  17. #define _NSPAPI_INCLUDED
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif /* __cplusplus */
  21. #ifndef _tagBLOB_DEFINED
  22. #define _tagBLOB_DEFINED
  23. #define _BLOB_DEFINED
  24. #define _LPBLOB_DEFINED
  25. typedef struct _BLOB {
  26. ULONG cbSize ;
  27. #ifdef MIDL_PASS
  28. [size_is(cbSize)] BYTE *pBlobData;
  29. #else // MIDL_PASS
  30. BYTE *pBlobData ;
  31. #endif // MIDL_PASS
  32. } BLOB, *LPBLOB ;
  33. #endif
  34. #ifndef GUID_DEFINED
  35. #define GUID_DEFINED
  36. typedef struct _GUID
  37. {
  38. unsigned long Data1;
  39. unsigned short Data2;
  40. unsigned short Data3;
  41. unsigned char Data4[8];
  42. } GUID;
  43. #endif /* GUID_DEFINED */
  44. #ifndef __LPGUID_DEFINED__
  45. #define __LPGUID_DEFINED__
  46. typedef GUID *LPGUID;
  47. #endif
  48. //
  49. // Service categories
  50. //
  51. #define SERVICE_RESOURCE (0x00000001)
  52. #define SERVICE_SERVICE (0x00000002)
  53. #define SERVICE_LOCAL (0x00000004)
  54. //
  55. // Operation used when calling SetService()
  56. //
  57. #define SERVICE_REGISTER (0x00000001)
  58. #define SERVICE_DEREGISTER (0x00000002)
  59. #define SERVICE_FLUSH (0x00000003)
  60. #define SERVICE_ADD_TYPE (0x00000004)
  61. #define SERVICE_DELETE_TYPE (0x00000005)
  62. //
  63. // Flags that affect the operations above
  64. //
  65. #define SERVICE_FLAG_DEFER (0x00000001)
  66. #define SERVICE_FLAG_HARD (0x00000002)
  67. //
  68. // Used as input to GetService() for setting the dwProps parameter
  69. //
  70. #define PROP_COMMENT (0x00000001)
  71. #define PROP_LOCALE (0x00000002)
  72. #define PROP_DISPLAY_HINT (0x00000004)
  73. #define PROP_VERSION (0x00000008)
  74. #define PROP_START_TIME (0x00000010)
  75. #define PROP_MACHINE (0x00000020)
  76. #define PROP_ADDRESSES (0x00000100)
  77. #define PROP_SD (0x00000200)
  78. #define PROP_ALL (0x80000000)
  79. //
  80. // Flags that describe attributes of Service Addresses
  81. //
  82. #define SERVICE_ADDRESS_FLAG_RPC_CN (0x00000001)
  83. #define SERVICE_ADDRESS_FLAG_RPC_DG (0x00000002)
  84. #define SERVICE_ADDRESS_FLAG_RPC_NB (0x00000004)
  85. //
  86. // Name Spaces
  87. //
  88. #define NS_DEFAULT (0)
  89. #define NS_SAP (1)
  90. #define NS_NDS (2)
  91. #define NS_PEER_BROWSE (3)
  92. #define NS_TCPIP_LOCAL (10)
  93. #define NS_TCPIP_HOSTS (11)
  94. #define NS_DNS (12)
  95. #define NS_NETBT (13)
  96. #define NS_WINS (14)
  97. #define NS_NBP (20)
  98. #define NS_MS (30)
  99. #define NS_STDA (31)
  100. #define NS_NTDS (32)
  101. #define NS_X500 (40)
  102. #define NS_NIS (41)
  103. #define NS_VNS (50)
  104. //
  105. // Name space attributes.
  106. //
  107. #define NSTYPE_HIERARCHICAL (0x00000001)
  108. #define NSTYPE_DYNAMIC (0x00000002)
  109. #define NSTYPE_ENUMERABLE (0x00000004)
  110. #define NSTYPE_WORKGROUP (0x00000008)
  111. //
  112. // Transport attributes.
  113. //
  114. #define XP_CONNECTIONLESS (0x00000001)
  115. #define XP_GUARANTEED_DELIVERY (0x00000002)
  116. #define XP_GUARANTEED_ORDER (0x00000004)
  117. #define XP_MESSAGE_ORIENTED (0x00000008)
  118. #define XP_PSEUDO_STREAM (0x00000010)
  119. #define XP_GRACEFUL_CLOSE (0x00000020)
  120. #define XP_EXPEDITED_DATA (0x00000040)
  121. #define XP_CONNECT_DATA (0x00000080)
  122. #define XP_DISCONNECT_DATA (0x00000100)
  123. #define XP_SUPPORTS_BROADCAST (0x00000200)
  124. #define XP_SUPPORTS_MULTICAST (0x00000400)
  125. #define XP_BANDWIDTH_ALLOCATION (0x00000800)
  126. #define XP_FRAGMENTATION (0x00001000)
  127. #define XP_ENCRYPTS (0x00002000)
  128. //
  129. // Resolution flags for GetAddressByName().
  130. //
  131. #define RES_SOFT_SEARCH (0x00000001)
  132. #define RES_FIND_MULTIPLE (0x00000002)
  133. #define RES_SERVICE (0x00000004)
  134. //
  135. // Well known value names for Service Types
  136. //
  137. #define SERVICE_TYPE_VALUE_SAPIDA "SapId"
  138. #define SERVICE_TYPE_VALUE_SAPIDW L"SapId"
  139. #define SERVICE_TYPE_VALUE_CONNA "ConnectionOriented"
  140. #define SERVICE_TYPE_VALUE_CONNW L"ConnectionOriented"
  141. #define SERVICE_TYPE_VALUE_TCPPORTA "TcpPort"
  142. #define SERVICE_TYPE_VALUE_TCPPORTW L"TcpPort"
  143. #define SERVICE_TYPE_VALUE_UDPPORTA "UdpPort"
  144. #define SERVICE_TYPE_VALUE_UDPPORTW L"UdpPort"
  145. #ifdef UNICODE
  146. #define SERVICE_TYPE_VALUE_SAPID SERVICE_TYPE_VALUE_SAPIDW
  147. #define SERVICE_TYPE_VALUE_CONN SERVICE_TYPE_VALUE_CONNW
  148. #define SERVICE_TYPE_VALUE_TCPPORT SERVICE_TYPE_VALUE_TCPPORTW
  149. #define SERVICE_TYPE_VALUE_UDPPORT SERVICE_TYPE_VALUE_UDPPORTW
  150. #else // not UNICODE
  151. #define SERVICE_TYPE_VALUE_SAPID SERVICE_TYPE_VALUE_SAPIDA
  152. #define SERVICE_TYPE_VALUE_CONN SERVICE_TYPE_VALUE_CONNA
  153. #define SERVICE_TYPE_VALUE_TCPPORT SERVICE_TYPE_VALUE_TCPPORTA
  154. #define SERVICE_TYPE_VALUE_UDPPORT SERVICE_TYPE_VALUE_UDPPORTA
  155. #endif
  156. //
  157. // status flags returned by SetService
  158. //
  159. #define SET_SERVICE_PARTIAL_SUCCESS (0x00000001)
  160. //
  161. // Name Space Information
  162. //
  163. typedef struct _NS_INFO% {
  164. DWORD dwNameSpace ;
  165. DWORD dwNameSpaceFlags ;
  166. LPTSTR% lpNameSpace ;
  167. } NS_INFO%, * PNS_INFO%, FAR * LPNS_INFO%;
  168. //
  169. // Service Type Values. The structures are used to define named Service
  170. // Type specific values. This structure is self relative and has no pointers.
  171. //
  172. typedef struct _SERVICE_TYPE_VALUE {
  173. DWORD dwNameSpace ;
  174. DWORD dwValueType ;
  175. DWORD dwValueSize ;
  176. DWORD dwValueNameOffset ;
  177. DWORD dwValueOffset ;
  178. } SERVICE_TYPE_VALUE, *PSERVICE_TYPE_VALUE, FAR *LPSERVICE_TYPE_VALUE ;
  179. //
  180. // An absolute version of above. This structure does contain pointers.
  181. //
  182. typedef struct _SERVICE_TYPE_VALUE_ABS% {
  183. DWORD dwNameSpace ;
  184. DWORD dwValueType ;
  185. DWORD dwValueSize ;
  186. LPTSTR% lpValueName ;
  187. PVOID lpValue ;
  188. } SERVICE_TYPE_VALUE_ABS%,
  189. *PSERVICE_TYPE_VALUE_ABS%,
  190. FAR *LPSERVICE_TYPE_VALUE_ABS%;
  191. //
  192. // Service Type Information. Contains the name of the Service Type and
  193. // and an array of SERVICE_NS_TYPE_VALUE structures. This structure is self
  194. // relative and has no pointers in it.
  195. //
  196. typedef struct _SERVICE_TYPE_INFO {
  197. DWORD dwTypeNameOffset ;
  198. DWORD dwValueCount ;
  199. SERVICE_TYPE_VALUE Values[1] ;
  200. } SERVICE_TYPE_INFO, *PSERVICE_TYPE_INFO, FAR *LPSERVICE_TYPE_INFO ;
  201. typedef struct _SERVICE_TYPE_INFO_ABS% {
  202. LPTSTR% lpTypeName ;
  203. DWORD dwValueCount ;
  204. SERVICE_TYPE_VALUE_ABS% Values[1] ;
  205. } SERVICE_TYPE_INFO_ABS%,
  206. *PSERVICE_TYPE_INFO_ABS%,
  207. FAR *LPSERVICE_TYPE_INFO_ABS% ;
  208. //
  209. // A Single Address definition.
  210. //
  211. typedef struct _SERVICE_ADDRESS {
  212. DWORD dwAddressType ;
  213. DWORD dwAddressFlags ;
  214. DWORD dwAddressLength ;
  215. DWORD dwPrincipalLength ;
  216. #ifdef MIDL_PASS
  217. [size_is(dwAddressLength)] BYTE *lpAddress;
  218. #else // MIDL_PASS
  219. BYTE *lpAddress ;
  220. #endif // MIDL_PASS
  221. #ifdef MIDL_PASS
  222. [size_is(dwPrincipalLength)] BYTE *lpPrincipal;
  223. #else // MIDL_PASS
  224. BYTE *lpPrincipal ;
  225. #endif // MIDL_PASS
  226. } SERVICE_ADDRESS, *PSERVICE_ADDRESS, *LPSERVICE_ADDRESS;
  227. //
  228. // Addresses used by the service. Contains array of SERVICE_ADDRESS.
  229. //
  230. typedef struct _SERVICE_ADDRESSES {
  231. DWORD dwAddressCount ;
  232. #ifdef MIDL_PASS
  233. [size_is(dwAddressCount)] SERVICE_ADDRESS Addressses[*];
  234. #else // MIDL_PASS
  235. SERVICE_ADDRESS Addresses[1] ;
  236. #endif // MIDL_PASS
  237. } SERVICE_ADDRESSES, *PSERVICE_ADDRESSES, *LPSERVICE_ADDRESSES;
  238. //
  239. // Service Information.
  240. //
  241. typedef struct _SERVICE_INFO% {
  242. LPGUID lpServiceType ;
  243. LPTSTR% lpServiceName ;
  244. LPTSTR% lpComment ;
  245. LPTSTR% lpLocale ;
  246. DWORD dwDisplayHint ;
  247. DWORD dwVersion ;
  248. DWORD dwTime ;
  249. LPTSTR% lpMachineName ;
  250. LPSERVICE_ADDRESSES lpServiceAddress ;
  251. BLOB ServiceSpecificInfo ;
  252. } SERVICE_INFO%, *PSERVICE_INFO%, FAR * LPSERVICE_INFO% ;
  253. //
  254. // Name Space & Service Information
  255. //
  256. typedef struct _NS_SERVICE_INFO% {
  257. DWORD dwNameSpace ;
  258. SERVICE_INFO% ServiceInfo ;
  259. } NS_SERVICE_INFO%, *PNS_SERVICE_INFO%, FAR * LPNS_SERVICE_INFO% ;
  260. #ifndef __CSADDR_DEFINED__
  261. #define __CSADDR_DEFINED__
  262. //
  263. // SockAddr Information
  264. //
  265. typedef struct _SOCKET_ADDRESS {
  266. LPSOCKADDR lpSockaddr ;
  267. INT iSockaddrLength ;
  268. } SOCKET_ADDRESS, *PSOCKET_ADDRESS, FAR * LPSOCKET_ADDRESS ;
  269. //
  270. // CSAddr Information
  271. //
  272. typedef struct _CSADDR_INFO {
  273. SOCKET_ADDRESS LocalAddr ;
  274. SOCKET_ADDRESS RemoteAddr ;
  275. INT iSocketType ;
  276. INT iProtocol ;
  277. } CSADDR_INFO, *PCSADDR_INFO, FAR * LPCSADDR_INFO ;
  278. #endif
  279. //
  280. // Protocol Information
  281. //
  282. typedef struct _PROTOCOL_INFO% {
  283. DWORD dwServiceFlags ;
  284. INT iAddressFamily ;
  285. INT iMaxSockAddr ;
  286. INT iMinSockAddr ;
  287. INT iSocketType ;
  288. INT iProtocol ;
  289. DWORD dwMessageSize ;
  290. LPTSTR% lpProtocol ;
  291. } PROTOCOL_INFO%, *PPROTOCOL_INFO%, FAR * LPPROTOCOL_INFO% ;
  292. //
  293. // NETRESOURCE2 Structure
  294. //
  295. typedef struct _NETRESOURCE2% {
  296. DWORD dwScope ;
  297. DWORD dwType ;
  298. DWORD dwUsage ;
  299. DWORD dwDisplayType ;
  300. LPTSTR% lpLocalName ;
  301. LPTSTR% lpRemoteName ;
  302. LPTSTR% lpComment ;
  303. NS_INFO ns_info ;
  304. GUID ServiceType ;
  305. DWORD dwProtocols ;
  306. LPINT lpiProtocols ;
  307. } NETRESOURCE2%, *PNETRESOURCE2%, FAR * LPNETRESOURCE2% ;
  308. typedef DWORD (* LPFN_NSPAPI) (VOID ) ;
  309. //
  310. // Structures for using the service routines asynchronously.
  311. //
  312. typedef
  313. VOID
  314. (*LPSERVICE_CALLBACK_PROC) (
  315. IN LPARAM lParam,
  316. IN HANDLE hAsyncTaskHandle
  317. );
  318. typedef struct _SERVICE_ASYNC_INFO {
  319. LPSERVICE_CALLBACK_PROC lpServiceCallbackProc;
  320. LPARAM lParam;
  321. HANDLE hAsyncTaskHandle;
  322. } SERVICE_ASYNC_INFO, *PSERVICE_ASYNC_INFO, FAR * LPSERVICE_ASYNC_INFO;
  323. //
  324. // Public NSP API prototypes.
  325. //
  326. INT
  327. APIENTRY
  328. EnumProtocols% (
  329. IN LPINT lpiProtocols,
  330. IN OUT LPVOID lpProtocolBuffer,
  331. IN OUT LPDWORD lpdwBufferLength
  332. );
  333. INT
  334. APIENTRY
  335. GetAddressByName% (
  336. IN DWORD dwNameSpace,
  337. IN LPGUID lpServiceType,
  338. IN LPTSTR% lpServiceName OPTIONAL,
  339. IN LPINT lpiProtocols OPTIONAL,
  340. IN DWORD dwResolution,
  341. IN LPSERVICE_ASYNC_INFO lpServiceAsyncInfo OPTIONAL,
  342. IN OUT LPVOID lpCsaddrBuffer,
  343. IN OUT LPDWORD lpdwBufferLength,
  344. IN OUT LPTSTR% lpAliasBuffer OPTIONAL,
  345. IN OUT LPDWORD lpdwAliasBufferLength OPTIONAL
  346. );
  347. INT
  348. APIENTRY
  349. GetTypeByName% (
  350. IN LPTSTR% lpServiceName,
  351. IN OUT LPGUID lpServiceType
  352. );
  353. INT
  354. APIENTRY
  355. GetNameByType% (
  356. IN LPGUID lpServiceType,
  357. IN OUT LPTSTR% lpServiceName,
  358. IN DWORD dwNameLength
  359. );
  360. INT
  361. APIENTRY
  362. SetService% (
  363. IN DWORD dwNameSpace,
  364. IN DWORD dwOperation,
  365. IN DWORD dwFlags,
  366. IN LPSERVICE_INFO% lpServiceInfo,
  367. IN LPSERVICE_ASYNC_INFO lpServiceAsyncInfo,
  368. IN OUT LPDWORD lpdwStatusFlags
  369. );
  370. INT
  371. APIENTRY
  372. GetService% (
  373. IN DWORD dwNameSpace,
  374. IN LPGUID lpGuid,
  375. IN LPTSTR% lpServiceName,
  376. IN DWORD dwProperties,
  377. IN OUT LPVOID lpBuffer,
  378. IN OUT LPDWORD lpdwBufferSize,
  379. IN LPSERVICE_ASYNC_INFO lpServiceAsyncInfo
  380. );
  381. #ifdef __cplusplus
  382. }
  383. #endif /* __cplusplus */
  384. #endif // _NSPAPI_INCLUDED