mptcpd
Multipath TCP Daemon
plugin.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: BSD-3-Clause
10 #ifndef MPTCPD_PLUGIN_H
11 #define MPTCPD_PLUGIN_H
12 
13 #include <stdbool.h>
14 
15 #include <mptcpd/export.h>
16 #include <mptcpd/types.h>
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 struct sockaddr;
23 struct mptcpd_pm;
24 struct mptcpd_interface;
25 
32 #define MPTCPD_PLUGIN_SYM _mptcpd_plugin
33 
55 #define MPTCPD_PLUGIN_DEFINE(name, description, priority, init, exit) \
56  extern struct mptcpd_plugin_desc const MPTCPD_PLUGIN_SYM \
57  __attribute__((visibility("default"))); \
58  struct mptcpd_plugin_desc const MPTCPD_PLUGIN_SYM = { \
59  #name, \
60  description, \
61  0, /* version */ \
62  priority, \
63  init, \
64  exit \
65  };
66 
68 #define MPTCPD_PLUGIN_PRIORITY_LOW 19
69 
71 #define MPTCPD_PLUGIN_PRIORITY_DEFAULT 0
72 
74 #define MPTCPD_PLUGIN_PRIORITY_HIGH -20
75 
82 {
87  char const *const name;
88 
90  char const *const description;
91 
93  char const *const version;
94 
106  int const priority;
107 
109  int (*init)(struct mptcpd_pm *);
110 
112  void (*exit)(struct mptcpd_pm *);
113 };
114 
125 {
136 
149  struct sockaddr const *laddr,
150  struct sockaddr const *raddr,
151  struct mptcpd_pm *pm);
152 
163  struct sockaddr const *laddr,
164  struct sockaddr const *raddr,
165  struct mptcpd_pm *pm);
166 
175  struct mptcpd_pm *pm);
176 
191  struct sockaddr const *addr,
192  struct mptcpd_pm *pm);
193 
207  struct mptcpd_pm *pm);
208 
222  struct sockaddr const *laddr,
223  struct sockaddr const *raddr,
224  bool backup,
225  struct mptcpd_pm *pm);
226 
238  struct sockaddr const *laddr,
239  struct sockaddr const *raddr,
240  bool backup,
241  struct mptcpd_pm *pm);
242 
254  struct sockaddr const *laddr,
255  struct sockaddr const *raddr,
256  bool backup,
257  struct mptcpd_pm *pm);
259 
260  // --------------------------------------------------------
261 
271 
284  void (*new_interface)(struct mptcpd_interface const *i,
285  struct mptcpd_pm *pm);
286 
292  void (*update_interface)(struct mptcpd_interface const *i,
293  struct mptcpd_pm *pm);
294 
300  void (*delete_interface)(struct mptcpd_interface const *i,
301  struct mptcpd_pm *pm);
302 
309  void (*new_local_address)(struct mptcpd_interface const *i,
310  struct sockaddr const *sa,
311  struct mptcpd_pm *pm);
312 
319  void (*delete_local_address)(struct mptcpd_interface const *i,
320  struct sockaddr const *sa,
321  struct mptcpd_pm *pm);
323 };
324 
344 MPTCPD_API bool mptcpd_plugin_register_ops(
345  char const *name,
346  struct mptcpd_plugin_ops const *ops);
347 
348 #ifdef __cplusplus
349 }
350 #endif
351 
352 #endif // MPTCPD_PLUGIN_H
353 
354 
355 /*
356  Local Variables:
357  c-file-style: "linux"
358  End:
359 */
mptcpd shared library symbol export/import macros.
MPTCPD_API bool mptcpd_plugin_register_ops(char const *name, struct mptcpd_plugin_ops const *ops)
Register path manager operations.
Definition: plugin.c:524
Network interface-specific information.
Definition: network_monitor.h:30
Plugin-specific characteristics / descriptor.
Definition: plugin.h:82
char const *const name
Plugin name.
Definition: plugin.h:87
char const *const version
mptcpd version against which the plugin was compiled.
Definition: plugin.h:93
int(* init)(struct mptcpd_pm *)
Plugin initialization function.
Definition: plugin.h:109
int const priority
Plugin priority.
Definition: plugin.h:106
char const *const description
Plugin description.
Definition: plugin.h:90
void(* exit)(struct mptcpd_pm *)
Plugin finalization function.
Definition: plugin.h:112
Mptcpd plugin interface.
Definition: plugin.h:125
void(* new_local_address)(struct mptcpd_interface const *i, struct sockaddr const *sa, struct mptcpd_pm *pm)
A new local network address is available.
Definition: plugin.h:309
void(* update_interface)(struct mptcpd_interface const *i, struct mptcpd_pm *pm)
Network interface flags were updated.
Definition: plugin.h:292
void(* subflow_priority)(mptcpd_token_t token, struct sockaddr const *laddr, struct sockaddr const *raddr, bool backup, struct mptcpd_pm *pm)
MPTCP subflow priority changed.
Definition: plugin.h:253
void(* subflow_closed)(mptcpd_token_t token, struct sockaddr const *laddr, struct sockaddr const *raddr, bool backup, struct mptcpd_pm *pm)
A single MPTCP subflow was closed.
Definition: plugin.h:237
void(* connection_established)(mptcpd_token_t token, struct sockaddr const *laddr, struct sockaddr const *raddr, struct mptcpd_pm *pm)
New MPTCP-capable connection has been established.
Definition: plugin.h:162
void(* new_connection)(mptcpd_token_t token, struct sockaddr const *laddr, struct sockaddr const *raddr, struct mptcpd_pm *pm)
New MPTCP-capable connection has been created.
Definition: plugin.h:148
void(* connection_closed)(mptcpd_token_t token, struct mptcpd_pm *pm)
MPTCP connection as a whole was closed.
Definition: plugin.h:174
void(* delete_interface)(struct mptcpd_interface const *i, struct mptcpd_pm *pm)
A network interface was removed.
Definition: plugin.h:300
void(* new_subflow)(mptcpd_token_t token, struct sockaddr const *laddr, struct sockaddr const *raddr, bool backup, struct mptcpd_pm *pm)
A peer has joined the MPTCP connection.
Definition: plugin.h:221
void(* delete_local_address)(struct mptcpd_interface const *i, struct sockaddr const *sa, struct mptcpd_pm *pm)
A local network address was removed.
Definition: plugin.h:319
void(* address_removed)(mptcpd_token_t token, mptcpd_aid_t id, struct mptcpd_pm *pm)
Address is no longer advertised by a peer.
Definition: plugin.h:205
void(* new_address)(mptcpd_token_t token, mptcpd_aid_t id, struct sockaddr const *addr, struct mptcpd_pm *pm)
New address has been advertised by a peer.
Definition: plugin.h:189
void(* new_interface)(struct mptcpd_interface const *i, struct mptcpd_pm *pm)
A new network interface is available.
Definition: plugin.h:284
Data needed to run the path manager.
Definition: path_manager.h:43
unsigned int id
MPTCP generic netlink multicast notification ID.
Definition: path_manager.h:57
mptcpd user space path manager attribute types.
uint32_t mptcpd_token_t
MPTCP connection token type.
Definition: types.h:26
uint8_t mptcpd_aid_t
MPTCP address ID type.
Definition: types.h:29