Changeset View
Changeset View
Standalone View
Standalone View
sys/netlink/netlink_ctl.h
Show All 27 Lines | |||||
#ifndef _NETLINK_NETLINK_CTL_H_ | #ifndef _NETLINK_NETLINK_CTL_H_ | ||||
#define _NETLINK_NETLINK_CTL_H_ | #define _NETLINK_NETLINK_CTL_H_ | ||||
#ifdef _KERNEL | #ifdef _KERNEL | ||||
/* | /* | ||||
* This file provides headers for the public KPI of the netlink | * This file provides headers for the public KPI of the netlink | ||||
* subsystem | * subsystem | ||||
*/ | */ | ||||
#include <sys/_eventhandler.h> | |||||
MALLOC_DECLARE(M_NETLINK); | MALLOC_DECLARE(M_NETLINK); | ||||
/* | /* | ||||
* Macro for handling attribute TLVs | * Macro for handling attribute TLVs | ||||
*/ | */ | ||||
#define _roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) | #define _roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) | ||||
Show All 32 Lines | |||||
bool netlink_register_proto(int proto, const char *proto_name, nl_handler_f handler); | bool netlink_register_proto(int proto, const char *proto_name, nl_handler_f handler); | ||||
bool netlink_unregister_proto(int proto); | bool netlink_unregister_proto(int proto); | ||||
/* Common helpers */ | /* Common helpers */ | ||||
bool nl_has_listeners(int netlink_family, uint32_t groups_mask); | bool nl_has_listeners(int netlink_family, uint32_t groups_mask); | ||||
bool nlp_has_priv(struct nlpcb *nlp, int priv); | bool nlp_has_priv(struct nlpcb *nlp, int priv); | ||||
struct ucred *nlp_get_cred(struct nlpcb *nlp); | struct ucred *nlp_get_cred(struct nlpcb *nlp); | ||||
uint32_t nlp_get_pid(const struct nlpcb *nlp); | |||||
bool nlp_unconstrained_vnet(const struct nlpcb *nlp); | bool nlp_unconstrained_vnet(const struct nlpcb *nlp); | ||||
/* netlink_generic.c */ | /* netlink_generic.c */ | ||||
struct genl_cmd { | struct genl_cmd { | ||||
const char *cmd_name; | const char *cmd_name; | ||||
nl_handler_f cmd_cb; | nl_handler_f cmd_cb; | ||||
uint32_t cmd_flags; | uint32_t cmd_flags; | ||||
uint32_t cmd_priv; | uint32_t cmd_priv; | ||||
uint32_t cmd_num; | uint32_t cmd_num; | ||||
}; | }; | ||||
uint32_t genl_register_family(const char *family_name, size_t hdrsize, | uint32_t genl_register_family(const char *family_name, size_t hdrsize, | ||||
int family_version, int max_attr_idx); | int family_version, int max_attr_idx); | ||||
bool genl_unregister_family(const char *family_name); | bool genl_unregister_family(const char *family_name); | ||||
bool genl_register_cmds(const char *family_name, const struct genl_cmd *cmds, | bool genl_register_cmds(const char *family_name, const struct genl_cmd *cmds, | ||||
int count); | int count); | ||||
uint32_t genl_register_group(const char *family_name, const char *group_name); | uint32_t genl_register_group(const char *family_name, const char *group_name); | ||||
/* Debug */ | struct genl_family; | ||||
uint32_t nlp_get_pid(const struct nlpcb *nlp); | const char *genl_get_family_name(const struct genl_family *gf); | ||||
uint32_t genl_get_family_id(const struct genl_family *gf); | |||||
typedef void (*genl_family_event_handler_t)(void *arg, const struct genl_family *gf, int action); | |||||
EVENTHANDLER_DECLARE(genl_family_event, genl_family_event_handler_t); | |||||
#endif | #endif | ||||
#endif | #endif |