1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
/*
* Copyright 2014 Hans Leidekker for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
import "oaidl.idl";
import "objidl.idl";
#ifndef __WIDL__
#define threading(model)
#endif
interface IEnumNetworks;
interface IEnumNetworkConnections;
interface INetwork;
interface INetworkConnection;
interface INetworkCostManager;
interface INetworkListManager;
interface INetworkListManagerEvents;
typedef [v1_enum] enum NLM_CONNECTIVITY
{
NLM_CONNECTIVITY_DISCONNECTED = 0x0000,
NLM_CONNECTIVITY_IPV4_NOTRAFFIC = 0x0001,
NLM_CONNECTIVITY_IPV6_NOTRAFFIC = 0x0002,
NLM_CONNECTIVITY_IPV4_SUBNET = 0x0010,
NLM_CONNECTIVITY_IPV4_LOCALNETWORK = 0x0020,
NLM_CONNECTIVITY_IPV4_INTERNET = 0x0040,
NLM_CONNECTIVITY_IPV6_SUBNET = 0x0100,
NLM_CONNECTIVITY_IPV6_LOCALNETWORK = 0x0200,
NLM_CONNECTIVITY_IPV6_INTERNET = 0x0400
} NLM_CONNECTIVITY;
typedef [v1_enum] enum NLM_DOMAIN_TYPE
{
NLM_DOMAIN_TYPE_NON_DOMAIN_NETWORK = 0x00,
NLM_DOMAIN_TYPE_DOMAIN_NETWORK = 0x01,
NLM_DOMAIN_TYPE_DOMAIN_AUTHENTICATED = 0x02
} NLM_DOMAIN_TYPE;
typedef [v1_enum] enum NLM_ENUM_NETWORK
{
NLM_ENUM_NETWORK_CONNECTED = 0x01,
NLM_ENUM_NETWORK_DISCONNECTED = 0x02,
NLM_ENUM_NETWORK_ALL = 0x03
} NLM_ENUM_NETWORK;
typedef [v1_enum] enum NLM_CONNECTION_COST
{
NLM_CONNECTION_COST_UNKNOWN = 0x0,
NLM_CONNECTION_COST_UNRESTRICTED = 0x1,
NLM_CONNECTION_COST_FIXED = 0x2,
NLM_CONNECTION_COST_VARIABLE = 0x4,
NLM_CONNECTION_COST_OVERDATALIMIT = 0x10000,
NLM_CONNECTION_COST_CONGESTED = 0x20000,
NLM_CONNECTION_COST_ROAMING = 0x40000,
NLM_CONNECTION_COST_APPROACHINGDATALIMIT = 0x80000
} NLM_CONNECTION_COST;
typedef struct NLM_SOCKADDR
{
BYTE data[128];
} NLM_SOCKADDR;
const UINT32 NLM_UNKNOWN_DATAPLAN_STATUS = 0xffffffff;
typedef struct NLM_USAGE_DATA
{
DWORD UsageInMegabytes;
FILETIME LastSyncTime;
} NLM_USAGE_DATA;
typedef struct NLM_DATAPLAN_STATUS
{
GUID InterfaceGuid;
NLM_USAGE_DATA UsageData;
DWORD DataLimitInMegabytes;
DWORD InboundBandwidthInKbps;
DWORD OutboundBandwidthInKbps;
FILETIME NextBillingCycle;
DWORD MaxTransferSizeInMegabytes;
DWORD Reserved;
} NLM_DATAPLAN_STATUS;
[
object,
pointer_default(unique),
uuid(dcb00008-570f-4a9b-8d69-199fdba5723b)
]
interface INetworkCostManager : IUnknown
{
HRESULT GetCost(
[out] DWORD *pCost,
[in, unique] NLM_SOCKADDR *pDestIPAddr);
HRESULT GetDataPlanStatus(
[out] NLM_DATAPLAN_STATUS *pDataPlanStatus,
[in, unique] NLM_SOCKADDR *pDestIPAddr);
HRESULT SetDestinationAddresses(
[in] UINT32 length,
[in, unique, size_is(length)] NLM_SOCKADDR *pDestIPAddrList,
[in] VARIANT_BOOL bAppend);
}
[
object,
pointer_default(unique),
uuid(dcb0000a-570f-4a9b-8d69-199fdba5723b)
]
interface INetworkConnectionCost : IUnknown
{
HRESULT GetCost(
[out] DWORD *pCost);
HRESULT GetDataPlanStatus(
[out] NLM_DATAPLAN_STATUS *pDataPlanStatus);
}
[
object,
pointer_default(unique),
uuid(dcb00009-570f-4a9b-8d69-199fdba5723b)
]
interface INetworkCostManagerEvents : IUnknown
{
HRESULT CostChanged(
[in] DWORD newCost,
[in, unique] NLM_SOCKADDR *pDestAddr);
HRESULT DataPlanStatusChanged(
[in, unique] NLM_SOCKADDR *pDestAddr);
}
[
object,
oleautomation,
pointer_default(unique),
dual,
uuid(dcb00003-570f-4a9b-8d69-199fdba5723b)
]
interface IEnumNetworks : IDispatch
{
[id(DISPID_NEWENUM), propget, hidden, restricted]
HRESULT _NewEnum(
[out, retval] IEnumVARIANT **ppEnumVar);
[id(1)]
HRESULT Next(
[in] ULONG celt,
[out, size_is(celt), length_is(*pceltFetched)] INetwork **rgelt,
[in, out] ULONG *pceltFetched);
[id(2)]
HRESULT Skip(
[in] ULONG celt);
[id(3)]
HRESULT Reset();
[id(4)]
HRESULT Clone(
[out, retval] IEnumNetworks **ppEnumNetwork);
}
[
object,
oleautomation,
pointer_default(unique),
dual,
uuid(dcb00006-570f-4a9b-8d69-199fdba5723b)
]
interface IEnumNetworkConnections : IDispatch
{
[id(DISPID_NEWENUM), propget, hidden, restricted]
HRESULT _NewEnum(
[out, retval] IEnumVARIANT **ppEnumVar);
[id(1)]
HRESULT Next(
[in] ULONG celt,
[out, size_is(celt), length_is(*pceltFetched)] INetworkConnection **rgelt,
[in, out] ULONG *pceltFetched);
[id(2)]
HRESULT Skip(
[in] ULONG celt);
[id(3)]
HRESULT Reset();
[id(4)]
HRESULT Clone(
[out, retval] IEnumNetworkConnections **ppEnumNetwork);
}
[
dual,
object,
oleautomation,
pointer_default(unique),
uuid(dcb00000-570f-4a9b-8d69-199fdba5723b)
]
interface INetworkListManager : IDispatch
{
HRESULT GetNetworks(
[in] NLM_ENUM_NETWORK Flags,
[out, retval] IEnumNetworks **ppEnumNetwork);
HRESULT GetNetwork(
[in] GUID gdNetworkId,
[out, retval] INetwork **ppNetwork);
HRESULT GetNetworkConnections(
[out, retval] IEnumNetworkConnections **ppEnum);
HRESULT GetNetworkConnection(
[in] GUID gdNetworkConnectionId,
[out, retval] INetworkConnection **ppNetworkConnection);
HRESULT IsConnectedToInternet(
[out, retval] VARIANT_BOOL *pbIsConnected);
HRESULT IsConnected(
[out, retval] VARIANT_BOOL *pbIsConnected);
HRESULT GetConnectivity(
[out, retval] NLM_CONNECTIVITY *pConnectivity);
}
[
threading(both),
uuid(dcb00c01-570f-4a9b-8d69-199fdba5723b)
]
coclass NetworkListManager { interface INetworkListManager; }
[
object,
oleautomation,
pointer_default(unique),
uuid(DCB00001-570F-4A9B-8D69-199FDBA5723B)
]
interface INetworkListManagerEvents : IUnknown
{
HRESULT ConnectivityChanged(
[in] NLM_CONNECTIVITY newConnectivity);
}
[
object,
oleautomation,
pointer_default(unique),
uuid(dcb00007-570f-4a9b-8d69-199fdba5723b)
]
interface INetworkConnectionEvents : IUnknown
{
typedef enum NLM_CONNECTION_PROPERTY_CHANGE
{
NLM_CONNECTION_PROPERTY_CHANGE_AUTHENTICATION = 1
} NLM_CONNECTION_PROPERTY_CHANGE;
HRESULT NetworkConnectionConnectivityChanged(
[in] GUID connectionId,
[in] NLM_CONNECTIVITY newConnectivity);
HRESULT NetworkConnectionPropertyChanged(
[in] GUID connectionId,
[in] NLM_CONNECTION_PROPERTY_CHANGE flags);
}
[
object,
oleautomation,
pointer_default(unique),
dual,
uuid(dcb00005-570f-4a9b-8d69-199fdba5723b)
]
interface INetworkConnection : IDispatch
{
[id(1)]
HRESULT GetNetwork(
[out, retval] INetwork **ppNetwork);
[propget, id(2)]
HRESULT IsConnectedToInternet(
[out, retval] VARIANT_BOOL *pbIsConnected);
[propget, id(3)]
HRESULT IsConnected(
[out, retval] VARIANT_BOOL *pbIsConnected);
[id(4)]
HRESULT GetConnectivity(
[out, retval] NLM_CONNECTIVITY *pConnectivity);
[id(5)]
HRESULT GetConnectionId(
[out, retval] GUID *pgdConnectionId);
[id(6)]
HRESULT GetAdapterId(
[out, retval] GUID *pgdAdapterId);
[id(7)]
HRESULT GetDomainType(
[out, retval] NLM_DOMAIN_TYPE *pDomainType);
}
[
object,
oleautomation,
pointer_default(unique),
dual,
uuid(dcb00002-570f-4a9b-8d69-199fdba5723b)
]
interface INetwork : IDispatch
{
typedef enum NLM_NETWORK_CATEGORY
{
NLM_NETWORK_CATEGORY_PUBLIC = 0x00,
NLM_NETWORK_CATEGORY_PRIVATE = 0x01,
NLM_NETWORK_CATEGORY_DOMAIN_AUTHENTICATED = 0x02
} NLM_NETWORK_CATEGORY;
[id(1)]
HRESULT GetName(
[out, string, retval] BSTR *pszNetworkName);
[id(2)]
HRESULT SetName(
[in, string] BSTR szNetworkNewName);
[id(3)]
HRESULT GetDescription(
[out, string, retval] BSTR *pszDescription);
[id(4)]
HRESULT SetDescription(
[in, string] BSTR szDescription);
[id(5)]
HRESULT GetNetworkId(
[out, retval] GUID *pgdGuidNetworkId);
[id(6)]
HRESULT GetDomainType(
[out, retval] NLM_DOMAIN_TYPE *pNetworkType);
[id(7)]
HRESULT GetNetworkConnections(
[out, retval] IEnumNetworkConnections **ppEnumNetworkConnection);
[id(8)]
HRESULT GetTimeCreatedAndConnected(
[out] DWORD *pdwLowDateTimeCreated,
[out] DWORD *pdwHighDateTimeCreated,
[out] DWORD *pdwLowDateTimeConnected,
[out] DWORD *pdwHighDateTimeConnected);
[propget, id(9)]
HRESULT IsConnectedToInternet(
[out, retval] VARIANT_BOOL *pbIsConnected);
[propget, id(10)]
HRESULT IsConnected(
[out, retval] VARIANT_BOOL *pbIsConnected);
[id(11)]
HRESULT GetConnectivity(
[out, retval] NLM_CONNECTIVITY *pConnectivity);
[id(12)]
HRESULT GetCategory(
[out, retval] NLM_NETWORK_CATEGORY *pCategory);
[id(13)]
HRESULT SetCategory(
[in] NLM_NETWORK_CATEGORY NewCategory);
}