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.

508 lines
13 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name:
  4. net\routing\ipx\sap\intfdb.h
  5. Abstract:
  6. Header file for interface maintenance module.
  7. Author:
  8. Vadim Eydelman 05-15-1995
  9. Revision History:
  10. --*/
  11. #ifndef _SAP_INTFDB_
  12. #define _SAP_INTFDB_
  13. #define INTERNAL_INTERFACE_INDEX 0L
  14. #define INTERNAL_ADAPTER_INDEX 0L
  15. #define INVALID_ADAPTER_INDEX 0xFFFFFFFFL
  16. #define INVALID_INTERFACE_INDEX 0xFFFFFFFFL
  17. // Number of additional recv requests to post when binding the interface
  18. // that has listen enabled
  19. extern ULONG NewRequestsPerInterface;
  20. // Default filtering mode (for standalone service only)
  21. extern UCHAR FilterOutMode;
  22. // Externally visible part of interface control block
  23. typedef struct _INTERFACE_DATA {
  24. LPWSTR name; // Name
  25. ULONG index; // Unique index
  26. BOOLEAN enabled; // enabled flag
  27. UCHAR filterOut; // supply filtering node
  28. UCHAR filterIn; // listen filtering node
  29. #define SAP_DONT_FILTER 0
  30. #define SAP_FILTER_PERMIT IPX_SERVICE_FILTER_PERMIT
  31. #define SAP_FILTER_DENY IPX_SERVICE_FILTER_DENY
  32. #if ((SAP_DONT_FILTER==SAP_FILTER_PERMIT) || (SAP_DONT_FILTER==SAP_FILTER_DENY))
  33. #error "Sap filter constant mismatch!!!!"
  34. #endif
  35. SAP_IF_INFO info; // Configuration info
  36. IPX_ADAPTER_BINDING_INFO adapter; // Net params of adapter
  37. // to which interface is bound
  38. SAP_IF_STATS stats; // Interface statistics
  39. } INTERFACE_DATA, *PINTERFACE_DATA;
  40. // Exported internal network parameters
  41. extern UCHAR INTERNAL_IF_NODE[6];
  42. extern UCHAR INTERNAL_IF_NET[4];
  43. /*++
  44. *******************************************************************
  45. C r e a t e I n t e r f a c e T a b l e
  46. Routine Description:
  47. Allocates resources for interface table
  48. Arguments:
  49. None
  50. Return Value:
  51. NO_ERROR - resources were allocated successfully
  52. other - reason of failure (windows error code)
  53. *******************************************************************
  54. --*/
  55. DWORD
  56. CreateInterfaceTable (
  57. );
  58. /*++
  59. *******************************************************************
  60. S h u t d o w n I n t e r f a c e s
  61. Routine Description:
  62. Initiates orderly shutdown of SAP interfaces
  63. Stop reception of new packets
  64. Arguments:
  65. None
  66. Return Value:
  67. None
  68. *******************************************************************
  69. --*/
  70. VOID
  71. ShutdownInterfaces (
  72. HANDLE doneEvent
  73. );
  74. /*++
  75. *******************************************************************
  76. S t o p I n t e r f a c e s
  77. Routine Description:
  78. Stops all sap interfaces if not already stopped.
  79. Arguments:
  80. None
  81. Return Value:
  82. None
  83. *******************************************************************
  84. --*/
  85. VOID
  86. StopInterfaces (
  87. void
  88. );
  89. /*++
  90. *******************************************************************
  91. D e l e t e I n t e r f a c e T a b l e
  92. Routine Description:
  93. Release all resources associated with interface table
  94. Arguments:
  95. None
  96. Return Value:
  97. NO_ERROR - operation completed OK
  98. *******************************************************************
  99. --*/
  100. VOID
  101. DeleteInterfaceTable (
  102. void
  103. );
  104. /*++
  105. *******************************************************************
  106. S a p C r e a t e S a p I n t e r f a c e
  107. Routine Description:
  108. Add interface control block for new interface
  109. Arguments:
  110. InterfaceIndex - unique number that indentifies new interface
  111. SapIfConfig - interface configuration info
  112. Return Value:
  113. NO_ERROR - interface was created OK
  114. ERROR_ALREADY_EXISTS - interface with this index already exists
  115. other - operation failed (windows error code)
  116. *******************************************************************
  117. --*/
  118. DWORD
  119. SapCreateSapInterface (
  120. LPWSTR InterfaceName,
  121. ULONG InterfaceIndex,
  122. NET_INTERFACE_TYPE InterfaceType,
  123. PSAP_IF_INFO SapIfConfig
  124. );
  125. /*++
  126. *******************************************************************
  127. S a p D e l e t e S a p I n t e r f a c e
  128. Routine Description:
  129. Delete existing interface control block
  130. Arguments:
  131. InterfaceIndex - unique number that indentifies the interface
  132. Return Value:
  133. NO_ERROR - interface was created OK
  134. IPX_ERROR_NO_INTERFACE - interface with this index does not exist
  135. other - operation failed (windows error code)
  136. *******************************************************************
  137. --*/
  138. DWORD
  139. SapDeleteSapInterface (
  140. ULONG InterfaceIndex
  141. );
  142. /*++
  143. *******************************************************************
  144. S a p G e t S a p I n t e r f a c e
  145. Routine Description:
  146. Retrieves configuration and statistic info associated with interface
  147. Arguments:
  148. InterfaceIndex - unique number that indentifies new interface
  149. SapIfConfig - buffer to store configuration info
  150. SapIfStats - buffer to store statistic info
  151. Return Value:
  152. NO_ERROR - info was retrieved OK
  153. IPX_ERROR_NO_INTERFACE - interface with this index does not exist
  154. other - operation failed (windows error code)
  155. *******************************************************************
  156. --*/
  157. DWORD
  158. SapGetSapInterface (
  159. IN ULONG InterfaceIndex,
  160. OUT PSAP_IF_INFO SapIfConfig OPTIONAL,
  161. OUT PSAP_IF_STATS SapIfStats OPTIONAL
  162. );
  163. /*++
  164. *******************************************************************
  165. S a p S e t S a p I n t e r f a c e
  166. Routine Description:
  167. Compares existing interface configuration with the new one and
  168. performs an update if necessary.
  169. Arguments:
  170. InterfaceIndex - unique number that indentifies new interface
  171. SapIfConfig - new interface configuration info
  172. Return Value:
  173. NO_ERROR - config info was changed OK
  174. IPX_ERROR_NO_INTERFACE - interface with this index does not exist
  175. other - operation failed (windows error code)
  176. *******************************************************************
  177. --*/
  178. DWORD
  179. SapSetSapInterface (
  180. ULONG InterfaceIndex,
  181. PSAP_IF_INFO SapIfConfig
  182. );
  183. /*++
  184. *******************************************************************
  185. S a p S e t I n t e r f a c e E n a b l e
  186. Routine Description:
  187. Enables/disables interface
  188. Arguments:
  189. InterfaceIndex - unique number that indentifies new interface
  190. Enable - TRUE-enable, FALSE-disable
  191. Return Value:
  192. NO_ERROR - config info was changed OK
  193. IPX_ERROR_NO_INTERFACE - interface with this index does not exist
  194. other - operation failed (windows error code)
  195. *******************************************************************
  196. --*/
  197. DWORD
  198. SapSetInterfaceEnable (
  199. ULONG InterfaceIndex,
  200. BOOL Enable
  201. );
  202. /*++
  203. *******************************************************************
  204. S a p S e t I n t e r f a c e F i l t e r s
  205. Routine Description:
  206. Compares existing interface configuration with the new one and
  207. performs an update if necessary.
  208. Arguments:
  209. Return Value:
  210. NO_ERROR - config info was changed OK
  211. ERROR_INVALID_PARAMETER - interface with this index does not exist
  212. other - operation failed (windows error code)
  213. *******************************************************************
  214. --*/
  215. DWORD
  216. SapSetInterfaceFilters (
  217. IN ULONG InterfaceIndex,
  218. IN PSAP_IF_FILTERS SapIfFilters
  219. );
  220. /*++
  221. *******************************************************************
  222. S a p G e t I n t e r f a c e F i l t e r s
  223. Routine Description:
  224. Compares existing interface configuration with the new one and
  225. performs an update if necessary.
  226. Arguments:
  227. Return Value:
  228. NO_ERROR - config info was changed OK
  229. ERROR_INVALID_PARAMETER - interface with this index does not exist
  230. other - operation failed (windows error code)
  231. *******************************************************************
  232. --*/
  233. DWORD
  234. SapGetInterfaceFilters (
  235. IN ULONG InterfaceIndex,
  236. OUT PSAP_IF_FILTERS SapIfFilters,
  237. OUT PULONG FilterBufferSize
  238. );
  239. /*++
  240. *******************************************************************
  241. S a p B i n d S a p I n t e r f a c e T o A d a p t e r
  242. Routine Description:
  243. Establishes association between interface and physical adapter
  244. and starts sap on the interface if its admin state is enabled
  245. Arguments:
  246. InterfaceIndex - unique number that indentifies new interface
  247. AdapterInfo - info associated with adapter to bind to
  248. Return Value:
  249. NO_ERROR - interface was bound OK
  250. IPX_ERROR_NO_INTERFACE - interface with this index does not exist
  251. other - operation failed (windows error code)
  252. *******************************************************************
  253. --*/
  254. DWORD
  255. SapBindSapInterfaceToAdapter (
  256. ULONG InterfaceIndex,
  257. PIPX_ADAPTER_BINDING_INFO AdptInternInfo
  258. );
  259. /*++
  260. *******************************************************************
  261. S a p U n b i n d S a p I n t e r f a c e F r o m A d a p t e r
  262. Routine Description:
  263. Breaks association between interface and physical adapter
  264. and stops sap on the interface if it was on
  265. Arguments:
  266. InterfaceIndex - unique number that indentifies new interface
  267. Return Value:
  268. NO_ERROR - interface was bound OK
  269. IPX_ERROR_NO_INTERFACE - interface with this index does not exist
  270. other - operation failed (windows error code)
  271. *******************************************************************
  272. --*/
  273. DWORD
  274. SapUnbindSapInterfaceFromAdapter (
  275. ULONG InterfaceIndex
  276. );
  277. /*++
  278. *******************************************************************
  279. S a p R e q u e s t U p d a t e
  280. Routine Description:
  281. Initiates update of services information over the interface
  282. Completion of this update will be indicated by signalling
  283. NotificationEvent passed at StartProtocol. GetEventMessage
  284. can be used then to get the results of autostatic update
  285. Arguments:
  286. InterfaceIndex - unique index identifying interface to do
  287. update on
  288. Return Value:
  289. NO_ERROR - operation was initiated ok
  290. ERROR_INVALID_PARAMETER - the interface does not support updates
  291. IPX_ERROR_NO_INTERFACE - interface with this index does not exist
  292. other - operation failed (windows error code)
  293. *******************************************************************
  294. --*/
  295. DWORD
  296. SapRequestUpdate (
  297. ULONG InterfaceIndex
  298. );
  299. /*++
  300. *******************************************************************
  301. S a p G e t F i r s t S a p I n t e r f a c e
  302. Routine Description:
  303. Retrieves configuration and statistic info associated with first
  304. interface in InterfaceIndex order
  305. Arguments:
  306. InterfaceIndex - buffer to store unique number that indentifies interface
  307. SapIfConfig - buffer to store configuration info
  308. SapIfStats - buffer to store statistic info
  309. Return Value:
  310. NO_ERROR - info was retrieved OK
  311. IPX_ERROR_NO_INTERFACE - no interfaces in the table
  312. other - operation failed (windows error code)
  313. *******************************************************************
  314. --*/
  315. DWORD
  316. SapGetFirstSapInterface (
  317. OUT PULONG InterfaceIndex,
  318. OUT PSAP_IF_INFO SapIfConfig OPTIONAL,
  319. OUT PSAP_IF_STATS SapIfStats OPTIONAL
  320. );
  321. /*++
  322. *******************************************************************
  323. S a p G e t N e x t S a p I n t e r f a c e
  324. Routine Description:
  325. Retrieves configuration and statistic info associated with first
  326. interface in following interface with InterfaceIndex order in interface
  327. index order
  328. Arguments:
  329. InterfaceIndex - on input - interface number to search from
  330. on output - interface number of next interface
  331. SapIfConfig - buffer to store configuration info
  332. SapIfStats - buffer to store statistic info
  333. Return Value:
  334. NO_ERROR - info was retrieved OK
  335. IPX_ERROR_NO_INTERFACE - no more interfaces in the table
  336. other - operation failed (windows error code)
  337. *******************************************************************
  338. --*/
  339. DWORD
  340. SapGetNextSapInterface (
  341. IN OUT PULONG InterfaceIndex,
  342. OUT PSAP_IF_INFO SapIfConfig OPTIONAL,
  343. OUT PSAP_IF_STATS SapIfStats OPTIONAL
  344. );
  345. /*++
  346. *******************************************************************
  347. A c q u i r e I n t e r f a c e R e f e n c e
  348. Routine Description:
  349. Increments reference count of interface block.
  350. If reference count is grater than 0, the externally visible
  351. data in the block are locked (can't be modified)
  352. Arguments:
  353. intf - pointer to externally visible part of interface control block
  354. Return Value:
  355. None
  356. *******************************************************************
  357. --*/
  358. VOID
  359. AcquireInterfaceReference (
  360. IN PINTERFACE_DATA intf
  361. );
  362. /*++
  363. *******************************************************************
  364. R e l e a s e I n t e r f a c e R e f e n c e
  365. Routine Description:
  366. Decrements reference count of interface block.
  367. When reference count drops to 0, cleanup routine gets called to
  368. dispose of all resources allocated at bind time and if interface
  369. control block is already removed from the table it gets disposed of
  370. as well
  371. Arguments:
  372. intf - pointer to externally visible part of interface control block
  373. Return Value:
  374. None
  375. *******************************************************************
  376. --*/
  377. VOID
  378. ReleaseInterfaceReference (
  379. IN PINTERFACE_DATA intf
  380. );
  381. /*++
  382. *******************************************************************
  383. G e t I n t e r f a c e R e f e r e n c e
  384. Routine Description:
  385. Finds interface control block that bound to adapter and increments reference
  386. count on it (to prevent it from deletion while it is used).
  387. Arguments:
  388. AdapterIndex - unique number that indentifies adapter
  389. Return Value:
  390. Pointer to externally visible part of interface control block
  391. NULL if no interface is bound to the adapter
  392. *******************************************************************
  393. --*/
  394. PINTERFACE_DATA
  395. GetInterfaceReference (
  396. ULONG AdapterIndex
  397. );
  398. /*++
  399. *******************************************************************
  400. S a p I s S a p I n t e r f a c e
  401. Routine Description:
  402. Checks if interface with given index exists
  403. Arguments:
  404. InterfaceIndex - unique number that indentifies new interface
  405. Return Value:
  406. TRUE - exist
  407. FALSE - does not
  408. *******************************************************************
  409. --*/
  410. BOOL
  411. SapIsSapInterface (
  412. ULONG InterfaceIndex
  413. );
  414. #endif