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