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 
152  struct sockaddr const *laddr,
153  struct sockaddr const *raddr,
154  bool server_side,
155  struct mptcpd_pm *pm);
156 
170  struct sockaddr const *laddr,
171  struct sockaddr const *raddr,
172  bool server_side,
173  struct mptcpd_pm *pm);
174 
183  struct mptcpd_pm *pm);
184 
199  struct sockaddr const *addr,
200  struct mptcpd_pm *pm);
201 
215  struct mptcpd_pm *pm);
216 
230  struct sockaddr const *laddr,
231  struct sockaddr const *raddr,
232  bool backup,
233  struct mptcpd_pm *pm);
234 
246  struct sockaddr const *laddr,
247  struct sockaddr const *raddr,
248  bool backup,
249  struct mptcpd_pm *pm);
250 
262  struct sockaddr const *laddr,
263  struct sockaddr const *raddr,
264  bool backup,
265  struct mptcpd_pm *pm);
267 
268  // --------------------------------------------------------
269 
279 
292  void (*new_interface)(struct mptcpd_interface const *i,
293  struct mptcpd_pm *pm);
294 
300  void (*update_interface)(struct mptcpd_interface const *i,
301  struct mptcpd_pm *pm);
302 
308  void (*delete_interface)(struct mptcpd_interface const *i,
309  struct mptcpd_pm *pm);
310 
317  void (*new_local_address)(struct mptcpd_interface const *i,
318  struct sockaddr const *sa,
319  struct mptcpd_pm *pm);
320 
327  void (*delete_local_address)(struct mptcpd_interface const *i,
328  struct sockaddr const *sa,
329  struct mptcpd_pm *pm);
331 };
332 
352 MPTCPD_API bool mptcpd_plugin_register_ops(
353  char const *name,
354  struct mptcpd_plugin_ops const *ops);
355 
356 #ifdef __cplusplus
357 }
358 #endif
359 
360 #endif // MPTCPD_PLUGIN_H
361 
362 
363 /*
364  Local Variables:
365  c-file-style: "linux"
366  End:
367 */
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:31
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:317
void(* connection_established)(mptcpd_token_t token, struct sockaddr const *laddr, struct sockaddr const *raddr, bool server_side, struct mptcpd_pm *pm)
New MPTCP-capable connection has been established.
Definition: plugin.h:169
void(* update_interface)(struct mptcpd_interface const *i, struct mptcpd_pm *pm)
Network interface flags were updated.
Definition: plugin.h:300
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:261
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:245
void(* connection_closed)(mptcpd_token_t token, struct mptcpd_pm *pm)
MPTCP connection as a whole was closed.
Definition: plugin.h:182
void(* delete_interface)(struct mptcpd_interface const *i, struct mptcpd_pm *pm)
A network interface was removed.
Definition: plugin.h:308
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:229
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:327
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:213
void(* new_connection)(mptcpd_token_t token, struct sockaddr const *laddr, struct sockaddr const *raddr, bool server_side, struct mptcpd_pm *pm)
New MPTCP-capable connection has been created.
Definition: plugin.h:151
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:197
void(* new_interface)(struct mptcpd_interface const *i, struct mptcpd_pm *pm)
A new network interface is available.
Definition: plugin.h:292
Data needed to run the path manager.
Definition: path_manager.h:44
unsigned int id
MPTCP generic netlink multicast notification ID.
Definition: path_manager.h:58
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