home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / stm.h < prev    next >
C/C++ Source or Header  |  1998-04-25  |  9KB  |  276 lines

  1. /*++
  2.  
  3. Copyright (c) 1995-1997 Microsoft Corporation
  4.  
  5. Module Name:
  6.  
  7.     stm.h
  8.  
  9. Abstract:
  10.  
  11.     This module contains the definitions of the IPX Service Table Manger APIs
  12.  
  13. Author:
  14.  
  15.  
  16. Revision History:
  17.  
  18.  
  19. --*/
  20.  
  21. #ifndef __ROUTING_STM_H__
  22. #define __ROUTING_STM_H__
  23.  
  24. //////////////////////////////////////////////////////////////////////////////
  25. //                                                                          //
  26. // Supported functionality flags                                            //
  27. //                                                                          //
  28. // ROUTING                  Imports Routing Table Manager APIs              //
  29. // SERVICES                 Exports Service Table Manager APIs              //
  30. // DEMAND_UPDATE_ROUTES     IP and IPX RIP support for Autostatic           //
  31. // DEMAND_UPDATE_SERVICES   IPX SAP, NLSP support for Autostatic            //
  32. //                                                                          //
  33. //////////////////////////////////////////////////////////////////////////////
  34.  
  35. #define SERVICES                0x00000002
  36. #define DEMAND_UPDATE_SERVICES  0x00000008
  37.  
  38. //
  39. // Server Entry 
  40. //
  41.  
  42. typedef struct _IPX_SERVER_ENTRY
  43. {
  44.     USHORT    Type;
  45.     UCHAR    Name[48];
  46.     UCHAR    Network[4];
  47.     UCHAR    Node[6];
  48.     UCHAR    Socket[2];
  49.     USHORT    HopCount;
  50. } IPX_SERVER_ENTRY, *PIPX_SERVER_ENTRY;
  51.  
  52. typedef struct _IPX_SERVICE
  53. {
  54.     ULONG                InterfaceIndex;
  55.     ULONG                Protocol;    // protocol from which knowledge of the service was obatined
  56.     IPX_SERVER_ENTRY    Server;
  57. } IPX_SERVICE, *PIPX_SERVICE;
  58.  
  59. // Function which returns TRUE if the service exists
  60.  
  61. typedef
  62. BOOL
  63. (WINAPI * PIS_SERVICE)(
  64.       IN USHORT     Type,
  65.       IN PUCHAR     Name,
  66.       OUT PIPX_SERVICE    Service OPTIONAL
  67.       );
  68.  
  69. // Exclusion flags.  Limit enumeration to only servers that
  70. // have same values of the specified by flags parameter(s) as those of
  71. // criterea service.
  72.  
  73. #define STM_ONLY_THIS_INTERFACE     0x00000001
  74. #define STM_ONLY_THIS_PROTOCOL        0x00000002
  75. #define STM_ONLY_THIS_TYPE            0x00000004
  76. #define STM_ONLY_THIS_NAME            0x00000008
  77.  
  78. // Ordering methods. Specify the order in which services should be
  79. // retreived (methods are mutually exclusive).
  80.  
  81. #define STM_ORDER_BY_TYPE_AND_NAME            0
  82. #define STM_ORDER_BY_INTERFACE_TYPE_NAME    1
  83.  
  84.  
  85. // Create handle to start enumeration of the services in the STM table.
  86. // Returns handle to be used for enumerations or NULL if operation failed
  87. //    GetLastError () returns the follwing error codes in case of failure:
  88. //        ERROR_CAN_NOT_COMPLETE
  89. //        ERROR_NOT_ENOUGH_MEMORY
  90.  
  91. typedef
  92. HANDLE
  93. (WINAPI * PCREATE_SERVICE_ENUMERATION_HANDLE)(
  94.     IN  DWORD           ExclusionFlags, // Flags to limit enumeration to certain
  95.                                         // types of servers
  96.     IN    PIPX_SERVICE  CriteriaService    // Criteria for exclusion flags
  97.     );
  98.  
  99. // Get next service in the enumeration started by CreateServiceEnumerationHandle
  100. // Returns NO_ERROR if next service was placed in provided buffer or
  101. // ERROR_NO_MORE_ITEMS when there are no more services to be
  102. // returned in the enumeration; ERROR_CAN_NOT_COMPLETE will be
  103. // returned if operation failed.
  104.  
  105. typedef
  106. DWORD
  107. (WINAPI * PENUMERATE_GET_NEXT_SERVICE)(
  108.     IN  HANDLE          EnumerationHandle, // Handle that identifies this
  109.                                            // enumeration
  110.     OUT PIPX_SERVICE  Service            // buffer to place parameters of next service entry
  111.                                         // to be returned by enumeration
  112.     );
  113.  
  114. // Frees resources associated with enumeration.
  115. // Returns NO_ERROR if operation succeded, ERROR_CAN_NOT_COMPLETE
  116. // otherwise
  117.  
  118. typedef
  119. DWORD
  120. (WINAPI * PCLOSE_SERVICE_ENUMERATION_HANDLE)(
  121.     IN    HANDLE           EnumerationHandle
  122.     );
  123.  
  124. // Get total number of known services
  125.  
  126. typedef
  127. ULONG
  128. (WINAPI * PGET_SERVICE_COUNT)(
  129.     VOID
  130.     );
  131.  
  132. //    Add service of IPX_PROTOCOL_STATIC to the table
  133.  
  134. typedef
  135. DWORD
  136. (WINAPI * PCREATE_STATIC_SERVICE)(IN ULONG        InterfaceIndex,
  137.                IN PIPX_SERVER_ENTRY        ServerEntry);
  138.  
  139. //    Delete service of IPX_PROTOCOL_STATIC from the table
  140.  
  141. typedef
  142. DWORD
  143. (WINAPI * PDELETE_STATIC_SERVICE)(IN ULONG        InterfaceIndex,
  144.                IN PIPX_SERVER_ENTRY        ServerEntry);
  145.  
  146.  
  147. //    Converts protocol of all services associated with given interface to
  148. //    IPX_PROTOCOL_STATIC
  149.  
  150. typedef
  151. DWORD
  152. (WINAPI * PBLOCK_CONVERT_SERVICES_TO_STATIC) (
  153.     IN ULONG        InterfaceIndex
  154.     );
  155.  
  156. //    Delete all services of IPX_PROTOCOL_STATIC
  157. //    associated with  given interface from the table
  158.  
  159. typedef
  160. DWORD
  161. (WINAPI * PBLOCK_DELETE_STATIC_SERVICES)(
  162.     IN ULONG        InterfaceIndex
  163.     );
  164.  
  165.  
  166. // Find and return first service in the order specified by the ordering method.
  167. // Search is limited only to ceratin types of services as specified by the
  168. // exclusion flags end corresponding fields in Service parameter.
  169. // Returns ERROR_NO_MORE_ITEMS if there are no services in the
  170. // table that meet specified criteria.
  171.  
  172. typedef
  173. DWORD
  174. (WINAPI * PGET_FIRST_ORDERED_SERVICE)(
  175.     IN  DWORD           OrderingMethod,     // What ordering to use
  176.     IN  DWORD           ExclusionFlags,     // Flags to limit search to ceratin
  177.                                             // types of servers
  178.     IN OUT PIPX_SERVICE Service         // On input: criteria for exclusion
  179.                                             //          flags
  180.                                             // On output: first service entry
  181.                                             //          in the specified order
  182.     );
  183.  
  184. // Find and return next service in the order specified by the ordering method.
  185. // Search starts from specified service and is limited only to ceratin types
  186. // of services as specified by the exclusion flags and corresponding fields 
  187. // in Service parameter.
  188. // Returns ERROR_NO_MORE_ITEMS if there are no services in table
  189. // table that meet specified criteria.
  190.  
  191. typedef
  192. DWORD
  193. (WINAPI * PGET_NEXT_ORDERED_SERVICE)(
  194.     IN  DWORD           OrderingMethod,     // What ordering to use
  195.     IN  DWORD           ExclusionFlags,     // Flags to limit search to ceratin
  196.                                             // types of servers
  197.     IN OUT PIPX_SERVICE Service         // On input: service to start the
  198.                                             //          search from and 
  199.                                             //          criteria for exclusion
  200.                                             //          flags
  201.                                             // On output: next service entry
  202.                                             //          in the specified order
  203.     );
  204.  
  205. typedef
  206. DWORD
  207. (WINAPI * PDO_UPDATE_SERVICES) (
  208.     IN ULONG    InterfaceIndex
  209.     );
  210.  
  211. typedef
  212. BOOL
  213. (WINAPI * PGET_SERVICE_ID)(
  214.       IN USHORT     Type,
  215.       IN PUCHAR     Name,
  216.       OUT PULONG    ServiceID
  217.       );
  218.     
  219. typedef
  220. BOOL
  221. (WINAPI * PGET_SERVICE_FROM_ID)(
  222.       IN ULONG            ServiceID,
  223.       OUT PIPX_SERVICE  Service
  224.       );
  225.     
  226. typedef
  227. DWORD
  228. (WINAPI * PGET_NEXT_SERVICE_FROM_ID)(
  229.       IN ULONG            ServiceID,
  230.       OUT PIPX_SERVICE  NextService,
  231.       OUT PULONG        NextServiceID
  232.       );
  233.  
  234. typedef struct _MPR40_SERVICE_CHARACTERISTICS
  235. {
  236.     DWORD                               dwVersion;
  237.     DWORD                               dwProtocolId;
  238.     DWORD                               fSupportedFunctionality;
  239.     PIS_SERVICE                         pfnIsService;
  240.     PDO_UPDATE_SERVICES                 pfnUpdateServices;
  241.     PCREATE_SERVICE_ENUMERATION_HANDLE  pfnCreateServiceEnumerationHandle;
  242.     PENUMERATE_GET_NEXT_SERVICE         pfnEnumerateGetNextService;
  243.     PCLOSE_SERVICE_ENUMERATION_HANDLE   pfnCloseServiceEnumerationHandle;
  244.     PGET_SERVICE_COUNT                  pfnGetServiceCount;
  245.     PCREATE_STATIC_SERVICE              pfnCreateStaticService;
  246.     PDELETE_STATIC_SERVICE              pfnDeleteStaticService;
  247.     PBLOCK_CONVERT_SERVICES_TO_STATIC   pfnBlockConvertServicesToStatic;
  248.     PBLOCK_DELETE_STATIC_SERVICES       pfnBlockDeleteStaticServices;
  249.     PGET_FIRST_ORDERED_SERVICE          pfnGetFirstOrderedService;
  250.     PGET_NEXT_ORDERED_SERVICE           pfnGetNextOrderedService;
  251. }MPR40_SERVICE_CHARACTERISTICS;
  252.  
  253. typedef struct _MPR50_SERVICE_CHARACTERISTICS
  254. {
  255.  
  256. #ifdef __cplusplus
  257.     MPR40_SERVICE_CHARACTERISTICS       mscMpr40ServiceChars;
  258. #else
  259.     MPR40_SERVICE_CHARACTERISTICS;
  260. #endif
  261.  
  262. }MPR50_SERVICE_CHARACTERISTICS;
  263.  
  264. #if MPR50
  265.     typedef MPR50_SERVICE_CHARACTERISTICS MPR_SERVICE_CHARACTERISTICS;
  266. #else
  267.     #if MPR40
  268.     typedef MPR40_SERVICE_CHARACTERISTICS MPR_SERVICE_CHARACTERISTICS;
  269.     #endif
  270. #endif
  271.  
  272. typedef MPR_SERVICE_CHARACTERISTICS *PMPR_SERVICE_CHARACTERISTICS;
  273.  
  274. #endif
  275.  
  276.