home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / rassapi.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  10.5 KB  |  399 lines

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