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.

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