Network Interface Enumeration
◆ M_io_net_iface_ips_t
◆ M_io_net_iface_ips_flags_t
Enumerator |
---|
M_NET_IFACE_IPS_FLAG_OFFLINE | Interface is currently offline. For enumeration, by default does not return offline interfaces without this flag.
|
M_NET_IFACE_IPS_FLAG_LOOPBACK | Interface is loopback. For enumeration, by default, does not return addresses for loopback interfaces.
|
M_NET_IFACE_IPS_FLAG_IPV4 | Address is ipv4. For enumeration, only list interfaces and addresses containing ipv4 addresses.
|
M_NET_IFACE_IPS_FLAG_IPV6 | Address is ipv6. For enumeration, only list interfaces and addresses containing ipv6 addresses.
|
◆ M_io_net_iface_ips()
Query OS for network interfaces and ip addresses assigned to interfaces.
- Parameters
-
[in] | flags | M_io_net_iface_ips_flags_t flags or 0 for none |
- Returns
- M_io_net_iface_ips_t * on success or NULL on failure. Must be free'd with M_io_net_iface_ips_free()
◆ M_io_net_iface_ips_count()
Return count of all interfaces and ip addresses. Note that not all interfaces may contain ip addreses.
- Parameters
-
- Returns
- count
◆ M_io_net_iface_ips_get_name()
Return name of interface associated with specified index.
- Parameters
-
- Returns
- NULL on failure otherwise a pointer to the name of the interface
◆ M_io_net_iface_ips_get_addr()
Return ip address of interface associated with specified index.
- Parameters
-
- Returns
- NULL on failure (or even possibly if no ip address available for interface), otherwise a pointer to the name of the interface
◆ M_io_net_iface_ips_get_netmask()
Return the netmask for the ip address of interface associated with specified index.
- Parameters
-
- Returns
- netmask, only relevant if there is an ip address
◆ M_io_net_iface_ips_get_flags()
Return flags on interface associated with specified index.
- Parameters
-
- Returns
- flags associated with the interface
◆ M_io_net_iface_ips_get_ips()
Retrieve a list of ip addresses from the result set matching the query. Will only return ip addresses and not any flags or interface names.
- Parameters
-
[in] | ips | Value returned from M_io_net_iface_ips() |
[in] | flags | Must specify at least M_NET_IFACE_IPS_FLAG_IPV4 or M_NET_IFACE_IPS_FLAG_IPV6. |
[in] | name | Only enumerate for a specific interface name. |
- Returns
- list of ip addresses matching query, NULL on no matches. Must be free'd with M_list_str_destroy().
◆ M_io_net_iface_ips_get_names()
Retrieve a list of interfaces from the result set matching the query. Will only return interface names and not any flags or ip addresses.
- Parameters
-
[in] | ips | Value returned from M_io_net_iface_ips() |
[in] | flags | If either M_NET_IFACE_IPS_FLAG_IPV4 or M_NET_IFACE_IPS_FLAG_IPV6 is specified, will exclude interfaces that don't have the specified address class. |
[in] | ipaddr | Optional. Use NULL if not wanted. Search for interface containing specified IP address. |
- Returns
- list of interface names matching query, NULL on no matches. Must be free'd with M_list_str_destroy().
◆ M_io_net_iface_ips_free()
◆ M_io_net_iface_ips_flags_to_str()
char * M_io_net_iface_ips_flags_to_str |
( |
int |
flags | ) |
|
Given a set of flags, convert into human-readable form
- Parameters
-
- Returns
- human readable string, must be M_free()'d.