plugin.h
Go to the documentation of this file.
// SPDX-License-Identifier: BSD-3-Clause
#ifndef MPTCPD_PLUGIN_H
#define MPTCPD_PLUGIN_H
#include <stdbool.h>
#include <mptcpd/export.h>
#include <mptcpd/types.h>
#ifdef __cplusplus
extern "C" {
#endif
struct sockaddr;
struct mptcpd_pm;
struct mptcpd_interface;
#define MPTCPD_PLUGIN_SYM _mptcpd_plugin
#define MPTCPD_PLUGIN_DEFINE(name, description, priority, init, exit) \
extern struct mptcpd_plugin_desc const MPTCPD_PLUGIN_SYM \
__attribute__((visibility("default"))); \
struct mptcpd_plugin_desc const MPTCPD_PLUGIN_SYM = { \
#name, \
description, \
0, /* version */ \
priority, \
init, \
exit \
};
#define MPTCPD_PLUGIN_PRIORITY_LOW 19
#define MPTCPD_PLUGIN_PRIORITY_DEFAULT 0
#define MPTCPD_PLUGIN_PRIORITY_HIGH -20
struct mptcpd_plugin_desc
{
char const *const name;
char const *const description;
char const *const version;
int const priority;
int (*init)(struct mptcpd_pm *);
void (*exit)(struct mptcpd_pm *);
};
struct mptcpd_plugin_ops
{
void (*new_connection)(mptcpd_token_t token,
struct sockaddr const *laddr,
struct sockaddr const *raddr,
struct mptcpd_pm *pm);
void (*connection_established)(mptcpd_token_t token,
struct sockaddr const *laddr,
struct sockaddr const *raddr,
struct mptcpd_pm *pm);
void (*connection_closed)(mptcpd_token_t token,
struct mptcpd_pm *pm);
void (*new_address)(mptcpd_token_t token,
mptcpd_aid_t id,
struct sockaddr const *addr,
struct mptcpd_pm *pm);
void (*address_removed)(mptcpd_token_t token,
mptcpd_aid_t id,
struct mptcpd_pm *pm);
void (*new_subflow)(mptcpd_token_t token,
struct sockaddr const *laddr,
struct sockaddr const *raddr,
bool backup,
struct mptcpd_pm *pm);
void (*subflow_closed)(mptcpd_token_t token,
struct sockaddr const *laddr,
struct sockaddr const *raddr,
bool backup,
struct mptcpd_pm *pm);
void (*subflow_priority)(mptcpd_token_t token,
struct sockaddr const *laddr,
struct sockaddr const *raddr,
bool backup,
struct mptcpd_pm *pm);
// --------------------------------------------------------
void (*new_interface)(struct mptcpd_interface const *i,
struct mptcpd_pm *pm);
void (*update_interface)(struct mptcpd_interface const *i,
struct mptcpd_pm *pm);
void (*delete_interface)(struct mptcpd_interface const *i,
struct mptcpd_pm *pm);
void (*new_local_address)(struct mptcpd_interface const *i,
struct sockaddr const *sa,
struct mptcpd_pm *pm);
void (*delete_local_address)(struct mptcpd_interface const *i,
struct sockaddr const *sa,
struct mptcpd_pm *pm);
};
MPTCPD_API bool mptcpd_plugin_register_ops(
char const *name,
struct mptcpd_plugin_ops const *ops);
#ifdef __cplusplus
}
#endif
#endif // MPTCPD_PLUGIN_H
/*
Local Variables:
c-file-style: "linux"
End:
*/
export.h
mptcpd shared library symbol export/import macros.
mptcpd_plugin_register_ops
MPTCPD_API bool mptcpd_plugin_register_ops(char const *name, struct mptcpd_plugin_ops const *ops)
Register path manager operations.
Definition: plugin.c:521
mptcpd_interface
Network interface-specific information.
Definition: network_monitor.h:30
mptcpd_plugin_desc
Plugin-specific characteristics / descriptor.
Definition: plugin.h:82
mptcpd_plugin_desc::name
char const *const name
Plugin name.
Definition: plugin.h:87
mptcpd_plugin_desc::version
char const *const version
mptcpd version against which the plugin was compiled.
Definition: plugin.h:93
mptcpd_plugin_desc::init
int(* init)(struct mptcpd_pm *)
Plugin initialization function.
Definition: plugin.h:109
mptcpd_plugin_desc::priority
int const priority
Plugin priority.
Definition: plugin.h:106
mptcpd_plugin_desc::description
char const *const description
Plugin description.
Definition: plugin.h:90
mptcpd_plugin_desc::exit
void(* exit)(struct mptcpd_pm *)
Plugin finalization function.
Definition: plugin.h:112
mptcpd_plugin_ops
Mptcpd plugin interface.
Definition: plugin.h:125
mptcpd_plugin_ops::new_local_address
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
mptcpd_plugin_ops::update_interface
void(* update_interface)(struct mptcpd_interface const *i, struct mptcpd_pm *pm)
Network interface flags were updated.
Definition: plugin.h:292
mptcpd_plugin_ops::subflow_priority
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
mptcpd_plugin_ops::subflow_closed
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
mptcpd_plugin_ops::connection_established
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
mptcpd_plugin_ops::new_connection
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
mptcpd_plugin_ops::connection_closed
void(* connection_closed)(mptcpd_token_t token, struct mptcpd_pm *pm)
MPTCP connection as a whole was closed.
Definition: plugin.h:174
mptcpd_plugin_ops::delete_interface
void(* delete_interface)(struct mptcpd_interface const *i, struct mptcpd_pm *pm)
A network interface was removed.
Definition: plugin.h:300
mptcpd_plugin_ops::new_subflow
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
mptcpd_plugin_ops::delete_local_address
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
mptcpd_plugin_ops::address_removed
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
mptcpd_plugin_ops::new_address
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
mptcpd_plugin_ops::new_interface
void(* new_interface)(struct mptcpd_interface const *i, struct mptcpd_pm *pm)
A new network interface is available.
Definition: plugin.h:284
mptcpd_pm
Data needed to run the path manager.
Definition: path_manager.h:43
mptcpd_pm::id
unsigned int id
MPTCP generic netlink multicast notification ID.
Definition: path_manager.h:57
types.h
mptcpd user space path manager attribute types.
mptcpd_token_t
uint32_t mptcpd_token_t
MPTCP connection token type.
Definition: types.h:26
mptcpd_aid_t
uint8_t mptcpd_aid_t
MPTCP address ID type.
Definition: types.h:29