include: Correctly spell STATUS_SMI_PRIMITIVE_INSTALLER_FAILED.
[wine/multimedia.git] / dlls / iphlpapi / ifenum.h
blobc6bf9575759463649b31788c3a89fd6c07369843
1 /* ifenum.h
2 * Copyright (C) 2003,2006 Juan Lang
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.
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.
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
18 * This module implements network interface and address enumeration. It's
19 * meant to hide some problematic defines like socket(), and make iphlpapi
20 * more portable.
22 * Like Windows, it uses a numeric index to identify an interface uniquely.
23 * As implemented, an interface represents a UNIX network interface, virtual
24 * or real, and thus can have 0 or 1 IP addresses associated with it. (This
25 * only supports IPv4.)
26 * The indexes returned are not guaranteed to be contiguous, so don't call
27 * getNumInterfaces() and assume the values [0,getNumInterfaces() - 1] will be
28 * valid indexes; use getInterfaceIndexTable() instead.
30 * See also the companion file, ipstats.h, for functions related to getting
31 * statistics.
33 #ifndef WINE_IFENUM_H_
34 #define WINE_IFENUM_H_
36 #include <stdarg.h>
38 #include "windef.h"
39 #include "winbase.h"
40 #define USE_WS_PREFIX
41 #include "iprtrmib.h"
42 #include "winsock2.h"
44 #define MAX_INTERFACE_PHYSADDR 8
45 #define MAX_INTERFACE_DESCRIPTION 256
47 BOOL isIfIndexLoopback(ULONG idx) DECLSPEC_HIDDEN;
49 /* A table of interface indexes, see get_interface_indices(). */
50 typedef struct _InterfaceIndexTable {
51 DWORD numIndexes;
52 IF_INDEX indexes[1];
53 } InterfaceIndexTable;
55 /* Returns the count of all interface indexes and optionally a ptr to an interface table.
56 * HeapFree() the returned table. Will optionally ignore loopback devices.
58 DWORD get_interface_indices( BOOL skip_loopback, InterfaceIndexTable **table ) DECLSPEC_HIDDEN;
60 /* ByName/ByIndex versions of various getter functions. */
62 /* can be used as quick check to see if you've got a valid index, returns NULL
63 * if not. Overwrites your buffer, which should be at least of size
64 * MAX_ADAPTER_NAME.
66 char *getInterfaceNameByIndex(IF_INDEX index, char *name) DECLSPEC_HIDDEN;
68 /* Fills index with the index of name, if found. Returns
69 * ERROR_INVALID_PARAMETER if name or index is NULL, ERROR_INVALID_DATA if name
70 * is not found, and NO_ERROR on success.
72 DWORD getInterfaceIndexByName(const char *name, IF_INDEX *index) DECLSPEC_HIDDEN;
74 /* Gets a few physical characteristics of a device: MAC addr len, MAC addr,
75 * and type as one of the MIB_IF_TYPEs.
76 * len's in-out: on in, needs to say how many bytes are available in addr,
77 * which to be safe should be MAX_INTERFACE_PHYSADDR. On out, it's how many
78 * bytes were set, or how many were required if addr isn't big enough.
79 * Returns ERROR_INVALID_PARAMETER if name, len, addr, or type is NULL.
80 * Returns ERROR_INVALID_DATA if name/index isn't valid.
81 * Returns ERROR_INSUFFICIENT_BUFFER if addr isn't large enough for the
82 * physical address; *len will contain the required size.
83 * May return other errors, e.g. ERROR_OUTOFMEMORY or ERROR_NO_MORE_FILES,
84 * if internal errors occur.
85 * Returns NO_ERROR on success.
87 DWORD getInterfacePhysicalByIndex(IF_INDEX index, PDWORD len, PBYTE addr,
88 PDWORD type) DECLSPEC_HIDDEN;
90 /* Fills in the MIB_IFROW by name. Doesn't fill in interface statistics,
91 * see ipstats.h for that.
92 * Returns ERROR_INVALID_PARAMETER if name is NULL, ERROR_INVALID_DATA
93 * if name isn't valid, and NO_ERROR otherwise.
95 DWORD getInterfaceEntryByName(const char *name, PMIB_IFROW entry) DECLSPEC_HIDDEN;
97 DWORD getNumIPAddresses(void) DECLSPEC_HIDDEN;
99 /* Gets the configured IP addresses for the system, and sets *ppIpAddrTable to
100 * a table of them allocated from heap, or NULL if out of memory. Returns
101 * NO_ERROR on success, something else on failure. Note there may be more than
102 * one IP address may exist per interface.
104 DWORD getIPAddrTable(PMIB_IPADDRTABLE *ppIpAddrTable, HANDLE heap, DWORD flags) DECLSPEC_HIDDEN;
106 /* Returns the IPv6 addresses for a particular interface index.
107 * Returns NO_ERROR on success, something else on failure.
109 ULONG v6addressesFromIndex(IF_INDEX index, SOCKET_ADDRESS **addrs, ULONG *num_addrs,
110 SOCKET_ADDRESS **masks) DECLSPEC_HIDDEN;
112 /* Converts the network-order bytes in addr to a printable string. Returns
113 * string.
115 char *toIPAddressString(unsigned int addr, char string[16]) DECLSPEC_HIDDEN;
117 DWORD getInterfaceMtuByName(const char *name, PDWORD mtu) DECLSPEC_HIDDEN;
118 DWORD getInterfaceStatusByName(const char *name, INTERNAL_IF_OPER_STATUS *status) DECLSPEC_HIDDEN;
120 #endif /* ndef WINE_IFENUM_H_ */