mptcpd
Multipath TCP Daemon
network_monitor.h
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-3-Clause
10#ifndef MPTCPD_NETWORK_MONITOR_H
11#define MPTCPD_NETWORK_MONITOR_H
12
13#include <mptcpd/export.h>
14
15#include <net/if.h> // For IF_NAMESIZE.
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21struct l_queue;
22struct mptcpd_nm;
23
30{
40
47 unsigned char family;
48
54 unsigned short type;
55
57 int index;
58
64 unsigned int flags;
65
67 char name[IF_NAMESIZE];
68
73 struct l_queue *addrs;
75};
76
86{
99 void (*new_interface)(struct mptcpd_interface const *i,
100 void *user_data);
101
108 void (*update_interface)(struct mptcpd_interface const *i,
109 void *user_data);
110
117 void (*delete_interface)(struct mptcpd_interface const *i,
118 void *user_data);
119
127 void (*new_address)(struct mptcpd_interface const *i,
128 struct sockaddr const *sa,
129 void *user_data);
130
138 void (*delete_address)(struct mptcpd_interface const *i,
139 struct sockaddr const *sa,
140 void *user_data);
141};
142
158MPTCPD_API struct mptcpd_nm *mptcpd_nm_create(uint32_t flags);
159
165MPTCPD_API void mptcpd_nm_destroy(struct mptcpd_nm *nm);
166
178typedef void (*mptcpd_nm_callback)(
179 struct mptcpd_interface const *interface,
180 void *callback_data);
181
191MPTCPD_API void mptcpd_nm_foreach_interface(struct mptcpd_nm const *nm,
192 mptcpd_nm_callback callback,
193 void *data);
194
212MPTCPD_API bool mptcpd_nm_register_ops(struct mptcpd_nm *nm,
213 struct mptcpd_nm_ops const *ops,
214 void *user_data);
215
234MPTCPD_API bool mptcpd_nm_monitor_loopback(struct mptcpd_nm *nm,
235 bool enable);
236
237#ifdef __cplusplus
238}
239#endif
240
241#endif // MPTCPD_NETWORK_MONITOR_H
242
243
244/*
245 Local Variables:
246 c-file-style: "linux"
247 End:
248*/
mptcpd shared library symbol export/import macros.
MPTCPD_API void mptcpd_nm_foreach_interface(struct mptcpd_nm const *nm, mptcpd_nm_callback callback, void *data)
Iterate over all monitored network interfaces.
Definition: network_monitor.c:1516
void(* mptcpd_nm_callback)(struct mptcpd_interface const *interface, void *callback_data)
Network monitor iteration function type.
Definition: network_monitor.h:178
MPTCPD_API void mptcpd_nm_destroy(struct mptcpd_nm *nm)
Destroy a network monitor.
Definition: network_monitor.c:1489
MPTCPD_API struct mptcpd_nm * mptcpd_nm_create(uint32_t flags)
Create a network monitor.
Definition: network_monitor.c:1400
MPTCPD_API bool mptcpd_nm_monitor_loopback(struct mptcpd_nm *nm, bool enable)
Enable monitoring of the loopback network interface.
Definition: network_monitor.c:1566
MPTCPD_API bool mptcpd_nm_register_ops(struct mptcpd_nm *nm, struct mptcpd_nm_ops const *ops, void *user_data)
Subscribe to mptcpd network monitor events.
Definition: network_monitor.c:1533
Network interface-specific information.
Definition: network_monitor.h:30
unsigned char family
Address family, e.g AF_UNSPEC.
Definition: network_monitor.h:47
int index
Network interface (link) index.
Definition: network_monitor.h:57
struct l_queue * addrs
Definition: network_monitor.h:73
unsigned short type
Network device type, e.g. ARPHRD_ETHER.
Definition: network_monitor.h:54
unsigned int flags
Network interface flags, e.g. IFF_UP.
Definition: network_monitor.h:64
char name[IF_NAMESIZE]
Network interface name.
Definition: network_monitor.h:67
Network monitor event tracking operations.
Definition: network_monitor.h:86
void(* update_interface)(struct mptcpd_interface const *i, void *user_data)
Network interface flags were updated.
Definition: network_monitor.h:108
void(* delete_interface)(struct mptcpd_interface const *i, void *user_data)
A network interface was removed.
Definition: network_monitor.h:117
void(* new_interface)(struct mptcpd_interface const *i, void *user_data)
A new network interface is available.
Definition: network_monitor.h:99
void(* new_address)(struct mptcpd_interface const *i, struct sockaddr const *sa, void *user_data)
A new network address is available.
Definition: network_monitor.h:127
void(* delete_address)(struct mptcpd_interface const *i, struct sockaddr const *sa, void *user_data)
A network address was removed.
Definition: network_monitor.h:138
Data needed to run the network monitor.
Definition: network_monitor.c:63