1 /***********************************************************************\
2 * rassapi.d *
3 * *
4 * Windows API header module *
5 * *
6 * Translated from MinGW Windows headers *
7 * by Stewart Gordon *
8 * *
9 * Placed into public domain *
10 \***********************************************************************/
11 module win32.rassapi;
12 version(Windows):
13
14 private import win32.lmcons, win32.windef;
15
16 // FIXME: check types of constants
17
18 const size_t
19 RASSAPI_MAX_PHONENUMBER_SIZE = 128,
20 RASSAPI_MAX_MEDIA_NAME = 16,
21 RASSAPI_MAX_PORT_NAME = 16,
22 RASSAPI_MAX_DEVICE_NAME = 128,
23 RASSAPI_MAX_DEVICETYPE_NAME = 16,
24 RASSAPI_MAX_PARAM_KEY_SIZE = 32;
25
26 const RASPRIV_NoCallback = 0x01;
27 const RASPRIV_AdminSetCallback = 0x02;
28 const RASPRIV_CallerSetCallback = 0x04;
29 const RASPRIV_DialinPrivilege = 0x08;
30 const RASPRIV_CallbackType = 0x07;
31
32 enum {
33 RAS_MODEM_OPERATIONAL = 1,
34 RAS_MODEM_NOT_RESPONDING,
35 RAS_MODEM_HARDWARE_FAILURE,
36 RAS_MODEM_INCORRECT_RESPONSE,
37 RAS_MODEM_UNKNOWN // = 5
38 }
39
40 enum {
41 RAS_PORT_NON_OPERATIONAL = 1,
42 RAS_PORT_DISCONNECTED,
43 RAS_PORT_CALLING_BACK,
44 RAS_PORT_LISTENING,
45 RAS_PORT_AUTHENTICATING,
46 RAS_PORT_AUTHENTICATED,
47 RAS_PORT_INITIALIZING // = 7
48 }
49
50 enum {
51 MEDIA_UNKNOWN,
52 MEDIA_SERIAL,
53 MEDIA_RAS10_SERIAL,
54 MEDIA_X25,
55 MEDIA_ISDN
56 }
57
58 const USER_AUTHENTICATED = 0x0001;
59 const MESSENGER_PRESENT = 0x0002;
60 const PPP_CLIENT = 0x0004;
61 const GATEWAY_ACTIVE = 0x0008;
62 const REMOTE_LISTEN = 0x0010;
63 const PORT_MULTILINKED = 0x0020;
64
65 const size_t
66 RAS_IPADDRESSLEN = 15,
67 RAS_IPXADDRESSLEN = 22,
68 RAS_ATADDRESSLEN = 32;
69
70 // FIXME: should these be grouped together?
71 enum {
72 RASDOWNLEVEL = 10,
73 RASADMIN_35 = 35,
74 RASADMIN_CURRENT = 40
75 }
76
77 alias ULONG IPADDR;
78
79 enum RAS_PARAMS_FORMAT {
80 ParamNumber = 0,
81 ParamString
82 }
83
84 union RAS_PARAMS_VALUE {
85 DWORD Number;
86 struct _String {
87 DWORD Length;
88 PCHAR Data;
89 }
90 _String String;
91 }
92
93 struct RAS_PARAMETERS {
94 CHAR[RASSAPI_MAX_PARAM_KEY_SIZE] P_Key;
95 RAS_PARAMS_FORMAT P_Type;
96 BYTE P_Attributes;
97 RAS_PARAMS_VALUE P_Value;
98 }
99
100 struct RAS_USER_0 {
101 BYTE bfPrivilege;
102 WCHAR[RASSAPI_MAX_PHONENUMBER_SIZE + 1] szPhoneNumber;
103 }
104 alias RAS_USER_0* PRAS_USER_0;
105
106 struct RAS_PORT_0 {
107 WCHAR[RASSAPI_MAX_PORT_NAME] wszPortName;
108 WCHAR[RASSAPI_MAX_DEVICETYPE_NAME] wszDeviceType;
109 WCHAR[RASSAPI_MAX_DEVICE_NAME] wszDeviceName;
110 WCHAR[RASSAPI_MAX_MEDIA_NAME] wszMediaName;
111 DWORD reserved;
112 DWORD Flags;
113 WCHAR[UNLEN + 1] wszUserName;
114 WCHAR[NETBIOS_NAME_LEN] wszComputer;
115 DWORD dwStartSessionTime; // seconds from 1/1/1970
116 WCHAR[DNLEN + 1] wszLogonDomain;
117 BOOL fAdvancedServer;
118 }
119 alias RAS_PORT_0* PRAS_PORT_0;
120
121 struct RAS_PPP_NBFCP_RESULT {
122 DWORD dwError;
123 DWORD dwNetBiosError;
124 CHAR[NETBIOS_NAME_LEN + 1] szName;
125 WCHAR[NETBIOS_NAME_LEN + 1] wszWksta;
126 }
127
128 struct RAS_PPP_IPCP_RESULT {
129 DWORD dwError;
130 WCHAR[RAS_IPADDRESSLEN + 1] wszAddress;
131 }
132
133 struct RAS_PPP_IPXCP_RESULT {
134 DWORD dwError;
135 WCHAR[RAS_IPXADDRESSLEN + 1] wszAddress;
136 }
137
138 struct RAS_PPP_ATCP_RESULT {
139 DWORD dwError;
140 WCHAR[RAS_ATADDRESSLEN + 1] wszAddress;
141 }
142
143 struct RAS_PPP_PROJECTION_RESULT {
144 RAS_PPP_NBFCP_RESULT nbf;
145 RAS_PPP_IPCP_RESULT ip;
146 RAS_PPP_IPXCP_RESULT ipx;
147 RAS_PPP_ATCP_RESULT at;
148 }
149
150 struct RAS_PORT_1 {
151 RAS_PORT_0 rasport0;
152 DWORD LineCondition;
153 DWORD HardwareCondition;
154 DWORD LineSpeed;
155 WORD NumStatistics;
156 WORD NumMediaParms;
157 DWORD SizeMediaParms;
158 RAS_PPP_PROJECTION_RESULT ProjResult;
159 }
160 alias RAS_PORT_1* PRAS_PORT_1;
161
162 struct RAS_PORT_STATISTICS {
163 DWORD dwBytesXmited;
164 DWORD dwBytesRcved;
165 DWORD dwFramesXmited;
166 DWORD dwFramesRcved;
167 DWORD dwCrcErr;
168 DWORD dwTimeoutErr;
169 DWORD dwAlignmentErr;
170 DWORD dwHardwareOverrunErr;
171 DWORD dwFramingErr;
172 DWORD dwBufferOverrunErr;
173 DWORD dwBytesXmitedUncompressed;
174 DWORD dwBytesRcvedUncompressed;
175 DWORD dwBytesXmitedCompressed;
176 DWORD dwBytesRcvedCompressed;
177 DWORD dwPortBytesXmited;
178 DWORD dwPortBytesRcved;
179 DWORD dwPortFramesXmited;
180 DWORD dwPortFramesRcved;
181 DWORD dwPortCrcErr;
182 DWORD dwPortTimeoutErr;
183 DWORD dwPortAlignmentErr;
184 DWORD dwPortHardwareOverrunErr;
185 DWORD dwPortFramingErr;
186 DWORD dwPortBufferOverrunErr;
187 DWORD dwPortBytesXmitedUncompressed;
188 DWORD dwPortBytesRcvedUncompressed;
189 DWORD dwPortBytesXmitedCompressed;
190 DWORD dwPortBytesRcvedCompressed;
191 }
192 alias RAS_PORT_STATISTICS* PRAS_PORT_STATISTICS;
193
194 struct RAS_SERVER_0 {
195 WORD TotalPorts;
196 WORD PortsInUse;
197 DWORD RasVersion;
198 }
199 alias RAS_SERVER_0* PRAS_SERVER_0;
200
201 extern (Windows) {
202 DWORD RasAdminServerGetInfo(const(WCHAR)*, PRAS_SERVER_0);
203 DWORD RasAdminGetUserAccountServer(const(WCHAR)*, const(WCHAR)*, LPWSTR);
204 DWORD RasAdminUserGetInfo(const(WCHAR)*, const(WCHAR)*, PRAS_USER_0);
205 DWORD RasAdminUserSetInfo(const(WCHAR)*, const(WCHAR)*, PRAS_USER_0);
206 DWORD RasAdminPortEnum(WCHAR*, PRAS_PORT_0*, WORD*);
207 DWORD RasAdminPortGetInfo(const(WCHAR)*, const(WCHAR)*, RAS_PORT_1*,
208 RAS_PORT_STATISTICS*, RAS_PARAMETERS**);
209 DWORD RasAdminPortClearStatistics(const(WCHAR)*, const(WCHAR)*);
210 DWORD RasAdminPortDisconnect(const(WCHAR)*, const(WCHAR)*);
211 DWORD RasAdminFreeBuffer(PVOID);
212 DWORD RasAdminGetErrorString(UINT, WCHAR*, DWORD);
213 BOOL RasAdminAcceptNewConnection(RAS_PORT_1*, RAS_PORT_STATISTICS*,
214 RAS_PARAMETERS*);
215 VOID RasAdminConnectionHangupNotification(RAS_PORT_1*,
216 RAS_PORT_STATISTICS*, RAS_PARAMETERS*);
217 DWORD RasAdminGetIpAddressForUser (WCHAR*, WCHAR*, IPADDR*, BOOL*);
218 VOID RasAdminReleaseIpAddress (WCHAR*, WCHAR*,IPADDR*);
219 DWORD RasAdminGetUserParms(WCHAR*, PRAS_USER_0);
220 DWORD RasAdminSetUserParms(WCHAR*, DWORD, PRAS_USER_0);
221 }