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.

355 lines
8.7 KiB

  1. /******************************************************************************
  2. **
  3. ** Copyright (c) 1998-1999 Microsoft Corporation
  4. **
  5. ** Module Name:
  6. **
  7. ** icsapi.h
  8. **
  9. ** Abstract:
  10. **
  11. ** External header for Internet Connection Sharing API module
  12. **
  13. ** Author:
  14. **
  15. ** Bruce Johnson (bjohnson)
  16. **
  17. **
  18. ** Environment:
  19. **
  20. ** Win32.
  21. **
  22. ** Revision History:
  23. **
  24. ** Date Author Comments
  25. ** -------- ---------- ----------------------------------------------------
  26. ** 03/08/99 bjohnson Created
  27. **
  28. ****************************************************************************/
  29. //****************************************************************************
  30. // Defines
  31. //****************************************************************************
  32. //
  33. // ICSAPI32 parameters
  34. //
  35. //****************************************************************************
  36. // ICS Return Codes
  37. //****************************************************************************
  38. #define ICS_ERROR_SUCCESS 0x00000000
  39. #define ICS_ERROR_FAILURE 0x80000001
  40. #define ICS_ERROR_NOT_IMPLEMENTED 0x80000002
  41. #define ICS_ERROR_NO_MEMORY 0x80000003
  42. #define ICS_ERROR_INVALID_OPTION 0x80000004
  43. #define ICS_ERROR_INVALID_PARAMETER 0x80000005
  44. //****************************************************************************
  45. // Options for IcsSetMapping
  46. //****************************************************************************
  47. #define ICS_PORTMAP_ENABLE 1
  48. #define ICS_PORTMAP_DISABLE 2
  49. #define ICS_PORTMAP_DISABLE_ALL 3
  50. #define ICS_PORTMAP_ENABLE_NON_PERSISTENT 4
  51. //****************************************************************************
  52. // Options for IcsDisconnect
  53. //****************************************************************************
  54. #define ICS_DISCONNECT_IMMEDIATELY 0
  55. #define ICS_DISCONNECT_IF_IDLE 1
  56. //****************************************************************************
  57. // Connect status
  58. //****************************************************************************
  59. #define ICS_CONN_STATUS_DISCONNECTED 0
  60. #define ICS_CONN_STATUS_DIALING 1
  61. #define ICS_CONN_STATUS_AUTHENTICATING 2
  62. #define ICS_CONN_STATUS_CONNECTED 3
  63. #define ICS_CONN_STATUS_LINE_IDLE 4
  64. //****************************************************************************
  65. // Autodial configuration
  66. //****************************************************************************
  67. #define ICS_AUTODIAL_OPT_NONE 0x00000000 // No options
  68. #define ICS_AUTODIAL_OPT_NEVER 0x00000001 // Never Autodial
  69. #define ICS_AUTODIAL_OPT_ALWAYS 0x00000002 // Autodial regardless
  70. #define ICS_AUTODIAL_OPT_DEMAND 0x00000004 // Autodial on demand
  71. //****************************************************************************
  72. // Miscellaneous
  73. //****************************************************************************
  74. #define ICS_MAX_NAME 255
  75. #define ICS_MAX_PORTKEY 255
  76. #define ICS_MAX_INDEX 255
  77. #define ICS_DISABLED 0
  78. #define ICS_ENABLED 1
  79. //****************************************************************************
  80. // Typedefs
  81. //****************************************************************************
  82. //
  83. // ICS Machine Information
  84. //
  85. typedef struct _ICS_MACHINE_INFO {
  86. WCHAR szName[ICS_MAX_NAME+1];
  87. BYTE bMacAddress[6];
  88. DWORD IpAddress;
  89. DWORD dwLeaseTime;
  90. DWORD dwOptions;
  91. } ICS_MACHINE_INFO, *PICS_MACHINE_INFO, *LPICS_MACHINE_INFO;
  92. //
  93. // ICS Client Options
  94. //
  95. typedef struct _ICS_CLIENT_OPTIONS {
  96. WCHAR szName[ICS_MAX_NAME+1];
  97. DWORD dwOptions;
  98. } ICS_CLIENT_OPTIONS, *PICS_CLIENT_OPTIONS, *LPICS_CLIENT_OPTIONS;
  99. //
  100. // ICS Port Mapping
  101. //
  102. typedef struct _ICS_PORT_MAPPING {
  103. WCHAR szName[ICS_MAX_NAME+1];
  104. WCHAR szPortMapping[ICS_MAX_PORTKEY+1];
  105. DWORD dwOptions;
  106. } ICS_PORT_MAPPING, *PICS_PORT_MAPPING, *LPICS_PORT_MAPPING;
  107. //
  108. // ICS Active Port Mapping
  109. //
  110. typedef struct _ICS_ACTIVE_PORT_MAPPING {
  111. ICS_PORT_MAPPING PortMap;
  112. ICS_MACHINE_INFO Client;
  113. } ICS_ACTIVE_PORT_MAPPING, *PICS_ACTIVE_PORT_MAPPING, *LPICS_ACTIVE_PORT_MAPPING;
  114. //
  115. // ICS Adapter Information
  116. //
  117. typedef struct _ICS_ADAPTER {
  118. WCHAR szAdapterIndex[ICS_MAX_INDEX+1];
  119. } ICS_ADAPTER, *PICS_ADAPTER, *LPICS_ADAPTER;
  120. //
  121. // ICS General Statistics
  122. //
  123. typedef struct _ICS_GENERAL_STATISTICS {
  124. DWORD dwBytesSent;
  125. DWORD dwBytesReceived;
  126. DWORD dwActiveClients;
  127. DWORD dwActivePortMappings;
  128. DWORD dwUpTime;
  129. DWORD dwStatusFlags;
  130. WCHAR szAutodialMachine [ICS_MAX_NAME+1];
  131. } ICS_GENERAL_STATISTICS, *PICS_GENERAL_STATISTICS, *LPICS_GENERAL_STATISTICS;
  132. //
  133. // ICS General Configuration
  134. //
  135. typedef struct _ICS_GENERAL_CONFIGURATION {
  136. DWORD dwEnabled;
  137. DWORD dwShowTrayIcon;
  138. DWORD dwDHCPEnabled;
  139. DWORD dwDNSEnabled;
  140. DWORD dwLoggingEnabled;
  141. DWORD dwDHCPSubnet;
  142. DWORD dwDHCPServerAddress;
  143. DWORD dwOptions;
  144. DWORD dwAutodialEnabled;
  145. DWORD dwAutodialTimeout;
  146. WCHAR szAutodialConnection [ICS_MAX_NAME+1];
  147. WCHAR szInternetAdapter [ICS_MAX_INDEX+1];
  148. WCHAR szHomeNetworkAdapter [ICS_MAX_INDEX+1];
  149. } ICS_GENERAL_CONFIGURATION, *PICS_GENERAL_CONFIGURATION, *LPICS_GENERAL_CONFIGURATION;
  150. typedef struct _ICS_GENERAL_CONFIGURATION ICS_CONFIG, *PICS_CONFIG, *LPICS_CONFIG;
  151. typedef enum {
  152. ICS_MSG_CONNECT_STATUS_CHANGE,
  153. ICS_MSG_ICS_STATUS_CHANGE,
  154. } ICS_MESSAGE_TYPE;
  155. typedef struct
  156. {
  157. DWORD dwConnectStatus;
  158. DWORD dwLastError;
  159. } ICS_MSG_CONNECT_STATUS_CHANGE_INFO;
  160. typedef struct
  161. {
  162. DWORD dwIcsStatus;
  163. } ICS_MSG_ICS_STATUS_CHANGE_INFO;
  164. typedef struct _ICS_MESSAGE {
  165. ICS_MESSAGE_TYPE Type;
  166. union
  167. {
  168. ICS_MSG_CONNECT_STATUS_CHANGE_INFO IcsConnectStatusChangeInfo;
  169. ICS_MSG_ICS_STATUS_CHANGE_INFO IcsStatusChangeInfo;
  170. } MsgSpecific;
  171. } ICS_MESSAGE, *LPICS_MESSAGE;
  172. #define IM_dwConnectStatus MsgSpecific.IcsConnectStatusChangeInfo.dwConnectStatus
  173. #define IM_dwLastError MsgSpecific.IcsConnectStatusChangeInfo.dwLastError
  174. #define IM_dwIcsStatus MsgSpecific.IcsStatusChangeInfo.dwIcsStatus
  175. typedef VOID (WINAPI *ICS_MSG_NOTIFIER_FN)(LPICS_MESSAGE pIcsMsg);
  176. //****************************************************************************
  177. //
  178. // Prototypes
  179. //
  180. //****************************************************************************
  181. //****************************************************************************
  182. // Configuration API's
  183. //****************************************************************************
  184. DWORD APIENTRY
  185. IcsGetConfiguration(
  186. LPICS_CONFIG lpIcsConfig
  187. );
  188. DWORD APIENTRY
  189. IcsSetConfiguration(
  190. LPICS_CONFIG lpIcsConfig
  191. );
  192. DWORD APIENTRY
  193. IcsGetAdapterList(
  194. LPICS_ADAPTER lpIcsAdapterList,
  195. LPDWORD lpdwBufferSize
  196. );
  197. DWORD APIENTRY
  198. IcsSetInternetConnection(
  199. LPICS_ADAPTER lpIcsAdapter
  200. );
  201. DWORD APIENTRY
  202. IcsSetHomenetConnection(
  203. LPICS_ADAPTER lpIcsAdapter
  204. );
  205. DWORD APIENTRY
  206. IcsEnumerateInstalledMappings(
  207. LPICS_PORT_MAPPING lpIcsPortMappings,
  208. LPDWORD lpdwBufferSize
  209. );
  210. DWORD APIENTRY
  211. IcsGetAutodialEnable(LPDWORD lpdwOpt) ;
  212. //****************************************************************************
  213. // Management API's
  214. //****************************************************************************
  215. DWORD APIENTRY
  216. IcsConnect(
  217. LPWSTR lpszPhonebook,
  218. BOOL Synchronous
  219. );
  220. DWORD APIENTRY
  221. IcsDisconnect(
  222. DWORD dwOptions
  223. );
  224. DWORD APIENTRY
  225. IcsEnable(
  226. DWORD dwOptions
  227. );
  228. DWORD APIENTRY
  229. IcsDisable(
  230. DWORD dwOptions
  231. );
  232. DWORD APIENTRY
  233. IcsGetStatistics(
  234. LPICS_GENERAL_STATISTICS lpIcsGeneralStats
  235. );
  236. DWORD APIENTRY
  237. IcsEnumerateClients(
  238. LPICS_MACHINE_INFO lpIcsClients,
  239. LPDWORD lpdwBufferSize
  240. );
  241. DWORD APIENTRY
  242. IcsEnumerateActiveMappings(
  243. LPICS_ACTIVE_PORT_MAPPING lpIcsActiveMappings,
  244. LPDWORD lpdwBufferSize
  245. );
  246. DWORD APIENTRY
  247. IcsSetMapping(
  248. LPICS_MACHINE_INFO lpIcsClient,
  249. LPICS_PORT_MAPPING lpIcsPortMap,
  250. DWORD dwOptions
  251. );
  252. DWORD APIENTRY
  253. IcsGetClientOptions(
  254. LPICS_MACHINE_INFO lpIcsClient,
  255. LPICS_CLIENT_OPTIONS lpIcsClientOptions
  256. );
  257. DWORD APIENTRY
  258. IcsSetClientOptions(
  259. LPICS_MACHINE_INFO lpIcsClient,
  260. LPICS_CLIENT_OPTIONS lpIcsClientOptions
  261. );
  262. DWORD APIENTRY
  263. IcsGetConnectStatus(
  264. LPDWORD lpdwConnectStatus,
  265. LPDWORD lpdwLastError
  266. );
  267. DWORD APIENTRY
  268. IcsRegisterNotifierCallback(
  269. LPVOID fnNotifier,
  270. DWORD Options
  271. );