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.

368 lines
9.6 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. rassapi.h
  5. Description:
  6. This file contains the RASADMIN structures, defines and
  7. function prototypes for the following APIs and they can
  8. be imported from RASSAPI.DLL:
  9. RasAdminServerGetInfo
  10. RasAdminGetUserAccountServer
  11. RasAdminUserSetInfo
  12. RasAdminUserGetInfo
  13. RasAdminPortEnum
  14. RasAdminPortGetInfo
  15. RasAdminPortClearStatistics
  16. RasAdminPortDisconnect
  17. RasAdminFreeBuffer
  18. Note:
  19. This header file and the sources containing the APIs will work
  20. only with UNICODE strings.
  21. --*/
  22. #ifndef _RASSAPI_H_
  23. #define _RASSAPI_H_
  24. #if _MSC_VER > 1000
  25. #pragma once
  26. #endif
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. #ifndef UNLEN
  31. #include <lmcons.h>
  32. #endif
  33. #define RASSAPI_MAX_PHONENUMBER_SIZE 128
  34. #define RASSAPI_MAX_MEDIA_NAME 16
  35. #define RASSAPI_MAX_PORT_NAME 16
  36. #define RASSAPI_MAX_DEVICE_NAME 128
  37. #define RASSAPI_MAX_DEVICETYPE_NAME 16
  38. #define RASSAPI_MAX_PARAM_KEY_SIZE 32
  39. // Bits indicating user's Remote Access privileges and mask to isolate
  40. // call back privilege.
  41. //
  42. // Note: Bit 0 MUST represent NoCallback due to a quirk of the "userparms"
  43. // storage method. When a new LAN Manager user is created, bit 0 of the
  44. // userparms field is set to 1 and all other bits are 0. These bits are
  45. // arranged so this "no Dial-In info" state maps to the "default Dial-In
  46. // privilege" state.
  47. #define RASPRIV_NoCallback 0x01
  48. #define RASPRIV_AdminSetCallback 0x02
  49. #define RASPRIV_CallerSetCallback 0x04
  50. #define RASPRIV_DialinPrivilege 0x08
  51. #define RASPRIV_CallbackType (RASPRIV_AdminSetCallback \
  52. | RASPRIV_CallerSetCallback \
  53. | RASPRIV_NoCallback)
  54. //
  55. // Modem condition codes
  56. //
  57. #define RAS_MODEM_OPERATIONAL 1 // No modem errors.
  58. #define RAS_MODEM_NOT_RESPONDING 2
  59. #define RAS_MODEM_HARDWARE_FAILURE 3
  60. #define RAS_MODEM_INCORRECT_RESPONSE 4
  61. #define RAS_MODEM_UNKNOWN 5
  62. //
  63. // Line condition codes
  64. //
  65. #define RAS_PORT_NON_OPERATIONAL 1
  66. #define RAS_PORT_DISCONNECTED 2
  67. #define RAS_PORT_CALLING_BACK 3
  68. #define RAS_PORT_LISTENING 4
  69. #define RAS_PORT_AUTHENTICATING 5
  70. #define RAS_PORT_AUTHENTICATED 6
  71. #define RAS_PORT_INITIALIZING 7
  72. // The following three structures are same as the ones
  73. // defined in rasman.h and have been renamed to prevent
  74. // redefinitions when both header files are included.
  75. enum RAS_PARAMS_FORMAT {
  76. ParamNumber = 0,
  77. ParamString = 1
  78. } ;
  79. typedef enum RAS_PARAMS_FORMAT RAS_PARAMS_FORMAT ;
  80. union RAS_PARAMS_VALUE {
  81. DWORD Number ;
  82. struct {
  83. DWORD Length ;
  84. PCHAR Data ;
  85. } String ;
  86. } ;
  87. typedef union RAS_PARAMS_VALUE RAS_PARAMS_VALUE ;
  88. struct RAS_PARAMETERS {
  89. CHAR P_Key [RASSAPI_MAX_PARAM_KEY_SIZE] ;
  90. RAS_PARAMS_FORMAT P_Type ;
  91. BYTE P_Attributes ;
  92. RAS_PARAMS_VALUE P_Value ;
  93. } ;
  94. typedef struct RAS_PARAMETERS RAS_PARAMETERS ;
  95. // structures used by the RASADMIN APIs
  96. typedef struct _RAS_USER_0
  97. {
  98. BYTE bfPrivilege;
  99. WCHAR szPhoneNumber[ RASSAPI_MAX_PHONENUMBER_SIZE + 1];
  100. } RAS_USER_0, *PRAS_USER_0;
  101. typedef struct _RAS_PORT_0
  102. {
  103. WCHAR wszPortName[RASSAPI_MAX_PORT_NAME];
  104. WCHAR wszDeviceType[RASSAPI_MAX_DEVICETYPE_NAME];
  105. WCHAR wszDeviceName[RASSAPI_MAX_DEVICE_NAME];
  106. WCHAR wszMediaName[RASSAPI_MAX_MEDIA_NAME];
  107. DWORD reserved;
  108. DWORD Flags;
  109. WCHAR wszUserName[UNLEN + 1];
  110. WCHAR wszComputer[NETBIOS_NAME_LEN];
  111. DWORD dwStartSessionTime; // seconds from 1/1/1970
  112. WCHAR wszLogonDomain[DNLEN + 1];
  113. BOOL fAdvancedServer;
  114. } RAS_PORT_0, *PRAS_PORT_0;
  115. // Possible values for MediaId
  116. #define MEDIA_UNKNOWN 0
  117. #define MEDIA_SERIAL 1
  118. #define MEDIA_RAS10_SERIAL 2
  119. #define MEDIA_X25 3
  120. #define MEDIA_ISDN 4
  121. // Possible bits set in Flags field
  122. #define USER_AUTHENTICATED 0x0001
  123. #define MESSENGER_PRESENT 0x0002
  124. #define PPP_CLIENT 0x0004
  125. #define GATEWAY_ACTIVE 0x0008
  126. #define REMOTE_LISTEN 0x0010
  127. #define PORT_MULTILINKED 0x0020
  128. typedef ULONG IPADDR;
  129. // The following PPP structures are same as the ones
  130. // defined in rasppp.h and have been renamed to prevent
  131. // redefinitions when both header files are included
  132. // in a module.
  133. /* Maximum length of address string, e.g. "255.255.255.255" for IP.
  134. */
  135. #define RAS_IPADDRESSLEN 15
  136. #define RAS_IPXADDRESSLEN 22
  137. #define RAS_ATADDRESSLEN 32
  138. typedef struct _RAS_PPP_NBFCP_RESULT
  139. {
  140. DWORD dwError;
  141. DWORD dwNetBiosError;
  142. CHAR szName[ NETBIOS_NAME_LEN + 1 ];
  143. WCHAR wszWksta[ NETBIOS_NAME_LEN + 1 ];
  144. } RAS_PPP_NBFCP_RESULT;
  145. typedef struct _RAS_PPP_IPCP_RESULT
  146. {
  147. DWORD dwError;
  148. WCHAR wszAddress[ RAS_IPADDRESSLEN + 1 ];
  149. } RAS_PPP_IPCP_RESULT;
  150. typedef struct _RAS_PPP_IPXCP_RESULT
  151. {
  152. DWORD dwError;
  153. WCHAR wszAddress[ RAS_IPXADDRESSLEN + 1 ];
  154. } RAS_PPP_IPXCP_RESULT;
  155. typedef struct _RAS_PPP_ATCP_RESULT
  156. {
  157. DWORD dwError;
  158. WCHAR wszAddress[ RAS_ATADDRESSLEN + 1 ];
  159. } RAS_PPP_ATCP_RESULT;
  160. typedef struct _RAS_PPP_PROJECTION_RESULT
  161. {
  162. RAS_PPP_NBFCP_RESULT nbf;
  163. RAS_PPP_IPCP_RESULT ip;
  164. RAS_PPP_IPXCP_RESULT ipx;
  165. RAS_PPP_ATCP_RESULT at;
  166. } RAS_PPP_PROJECTION_RESULT;
  167. typedef struct _RAS_PORT_1
  168. {
  169. RAS_PORT_0 rasport0;
  170. DWORD LineCondition;
  171. DWORD HardwareCondition;
  172. DWORD LineSpeed; // in bits/second
  173. WORD NumStatistics;
  174. WORD NumMediaParms;
  175. DWORD SizeMediaParms;
  176. RAS_PPP_PROJECTION_RESULT ProjResult;
  177. } RAS_PORT_1, *PRAS_PORT_1;
  178. typedef struct _RAS_PORT_STATISTICS
  179. {
  180. // The connection statistics are followed by port statistics
  181. // A connection is across multiple ports.
  182. DWORD dwBytesXmited;
  183. DWORD dwBytesRcved;
  184. DWORD dwFramesXmited;
  185. DWORD dwFramesRcved;
  186. DWORD dwCrcErr;
  187. DWORD dwTimeoutErr;
  188. DWORD dwAlignmentErr;
  189. DWORD dwHardwareOverrunErr;
  190. DWORD dwFramingErr;
  191. DWORD dwBufferOverrunErr;
  192. DWORD dwBytesXmitedUncompressed;
  193. DWORD dwBytesRcvedUncompressed;
  194. DWORD dwBytesXmitedCompressed;
  195. DWORD dwBytesRcvedCompressed;
  196. // the following are the port statistics
  197. DWORD dwPortBytesXmited;
  198. DWORD dwPortBytesRcved;
  199. DWORD dwPortFramesXmited;
  200. DWORD dwPortFramesRcved;
  201. DWORD dwPortCrcErr;
  202. DWORD dwPortTimeoutErr;
  203. DWORD dwPortAlignmentErr;
  204. DWORD dwPortHardwareOverrunErr;
  205. DWORD dwPortFramingErr;
  206. DWORD dwPortBufferOverrunErr;
  207. DWORD dwPortBytesXmitedUncompressed;
  208. DWORD dwPortBytesRcvedUncompressed;
  209. DWORD dwPortBytesXmitedCompressed;
  210. DWORD dwPortBytesRcvedCompressed;
  211. } RAS_PORT_STATISTICS, *PRAS_PORT_STATISTICS;
  212. //
  213. // Server version numbers
  214. //
  215. #define RASDOWNLEVEL 10 // identifies a LM RAS 1.0 server
  216. #define RASADMIN_35 35 // Identifies a NT RAS 3.5 server or client
  217. #define RASADMIN_CURRENT 40 // Identifies a NT RAS 4.0 server or client
  218. typedef struct _RAS_SERVER_0
  219. {
  220. WORD TotalPorts; // Total ports configured on the server
  221. WORD PortsInUse; // Ports currently in use by remote clients
  222. DWORD RasVersion; // version of RAS server
  223. } RAS_SERVER_0, *PRAS_SERVER_0;
  224. //
  225. // function prototypes
  226. //
  227. DWORD APIENTRY RasAdminServerGetInfo(
  228. IN const WCHAR * lpszServer,
  229. OUT PRAS_SERVER_0 pRasServer0
  230. );
  231. DWORD APIENTRY RasAdminGetUserAccountServer(
  232. IN const WCHAR * lpszDomain,
  233. IN const WCHAR * lpszServer,
  234. OUT LPWSTR lpszUserAccountServer
  235. );
  236. DWORD APIENTRY RasAdminUserGetInfo(
  237. IN const WCHAR * lpszUserAccountServer,
  238. IN const WCHAR * lpszUser,
  239. OUT PRAS_USER_0 pRasUser0
  240. );
  241. DWORD APIENTRY RasAdminUserSetInfo(
  242. IN const WCHAR * lpszUserAccountServer,
  243. IN const WCHAR * lpszUser,
  244. IN const PRAS_USER_0 pRasUser0
  245. );
  246. DWORD APIENTRY RasAdminPortEnum(
  247. IN const WCHAR * lpszServer,
  248. OUT PRAS_PORT_0 * ppRasPort0,
  249. OUT WORD * pcEntriesRead
  250. );
  251. DWORD APIENTRY RasAdminPortGetInfo(
  252. IN const WCHAR * lpszServer,
  253. IN const WCHAR * lpszPort,
  254. OUT RAS_PORT_1 * pRasPort1,
  255. OUT RAS_PORT_STATISTICS * pRasStats,
  256. OUT RAS_PARAMETERS ** ppRasParams
  257. );
  258. DWORD APIENTRY RasAdminPortClearStatistics(
  259. IN const WCHAR * lpszServer,
  260. IN const WCHAR * lpszPort
  261. );
  262. DWORD APIENTRY RasAdminPortDisconnect(
  263. IN const WCHAR * lpszServer,
  264. IN const WCHAR * lpszPort
  265. );
  266. DWORD APIENTRY RasAdminFreeBuffer(
  267. PVOID Pointer
  268. );
  269. BOOL APIENTRY RasAdminAcceptNewConnection (
  270. IN RAS_PORT_1 * pRasPort1,
  271. IN RAS_PORT_STATISTICS * pRasStats,
  272. IN RAS_PARAMETERS * pRasParams
  273. );
  274. VOID APIENTRY RasAdminConnectionHangupNotification (
  275. IN RAS_PORT_1 * pRasPort1,
  276. IN RAS_PORT_STATISTICS * pRasStats,
  277. IN RAS_PARAMETERS * pRasParams
  278. );
  279. DWORD APIENTRY RasAdminGetIpAddressForUser (
  280. IN WCHAR * lpszUserName,
  281. IN WCHAR * lpszPortName,
  282. IN OUT IPADDR * pipAddress,
  283. OUT BOOL * bNotifyRelease
  284. );
  285. VOID APIENTRY RasAdminReleaseIpAddress (
  286. IN WCHAR * lpszUserName,
  287. IN WCHAR * lpszPortName,
  288. IN IPADDR * pipAddress
  289. );
  290. #ifdef __cplusplus
  291. }
  292. #endif
  293. #endif // _RASSAPI_H_