home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 May / PCP163A.iso / Runimage / Cbuilder4 / Include / RASSAPI.H < prev    next >
Encoding:
C/C++ Source or Header  |  1999-01-26  |  10.5 KB  |  395 lines

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