Lely core libraries  2.2.5
if.h
Go to the documentation of this file.
1 
22 #ifndef LELY_IO_IF_H_
23 #define LELY_IO_IF_H_
24 
25 #include <lely/io/addr.h>
26 
31 #ifdef _WIN32
32 #define IO_IF_NAME_STRLEN 256
33 #else
34 #define IO_IF_NAME_STRLEN 16
35 #endif
36 
37 enum {
39  IO_IF_UP = 1 << 0,
41  IO_IF_BROADCAST = 1 << 1,
43  IO_IF_LOOPBACK = 1 << 2,
47  IO_IF_MULTICAST = 1 << 4
48 };
49 
51 struct io_ifinfo {
53  unsigned int index;
60  int domain;
66  int flags;
73 };
74 
76 #define IO_IFINFO_INIT \
77  { \
78  0, { '\0' }, 0, 0, IO_ADDR_INIT, IO_ADDR_INIT, IO_ADDR_INIT \
79  }
80 
81 #ifdef __cplusplus
82 extern "C" {
83 #endif
84 
97 int io_get_ifinfo(int maxinfo, struct io_ifinfo *info);
98 
99 #ifdef __cplusplus
100 }
101 #endif
102 
103 #endif // !LELY_IO_IF_H_
io_get_ifinfo
int io_get_ifinfo(int maxinfo, struct io_ifinfo *info)
Obtains a list of network interfaces.
Definition: if.c:57
io_ifinfo
A structure describing a network interface.
Definition: if.h:51
IO_IF_BROADCAST
@ IO_IF_BROADCAST
A valid broadcast address is set.
Definition: if.h:41
__io_addr
An opaque network address type.
Definition: addr.h:30
io_ifinfo::netmask
io_addr_t netmask
The netmask used by the interface.
Definition: if.h:70
IO_IF_MULTICAST
@ IO_IF_MULTICAST
The interface supports multicast.
Definition: if.h:47
addr.h
IO_IF_LOOPBACK
@ IO_IF_LOOPBACK
The interface is a loopback interface.
Definition: if.h:43
IO_IF_UP
@ IO_IF_UP
The interface is running.
Definition: if.h:39
io_ifinfo::flags
int flags
The status of the interface (any combination of IO_IF_UP, IO_IF_BROADCAST, IO_IF_LOOPBACK,...
Definition: if.h:66
io_ifinfo::domain
int domain
The domain of the interface (one of IO_SOCK_BTH, IO_SOCK_IPV4, IO_SOCK_IPV6 or IO_SOCK_UNIX).
Definition: if.h:60
IO_IF_POINTTOPOINT
@ IO_IF_POINTTOPOINT
The interface is a point-to-point link.
Definition: if.h:45
io_ifinfo::index
unsigned int index
The interface index.
Definition: if.h:53
IO_IF_NAME_STRLEN
#define IO_IF_NAME_STRLEN
The maximum number of bytes required to hold the name of a network interface, including the terminati...
Definition: if.h:34
io_ifinfo::broadaddr
io_addr_t broadaddr
The broadcast address of the interface.
Definition: if.h:72
io_ifinfo::addr
io_addr_t addr
The address of the interface.
Definition: if.h:68
io_ifinfo::name
char name[IO_IF_NAME_STRLEN]
The interface name.
Definition: if.h:55