Changeset View
Changeset View
Standalone View
Standalone View
sys/net/if_clone.h
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | struct ifc_data { | ||||
struct vnet *vnet; | struct vnet *vnet; | ||||
}; | }; | ||||
typedef int ifc_match_f(struct if_clone *ifc, const char *name); | typedef int ifc_match_f(struct if_clone *ifc, const char *name); | ||||
typedef int ifc_create_f(struct if_clone *ifc, char *name, size_t maxlen, | typedef int ifc_create_f(struct if_clone *ifc, char *name, size_t maxlen, | ||||
struct ifc_data *ifd, struct ifnet **ifpp); | struct ifc_data *ifd, struct ifnet **ifpp); | ||||
typedef int ifc_destroy_f(struct if_clone *ifc, struct ifnet *ifp, uint32_t flags); | typedef int ifc_destroy_f(struct if_clone *ifc, struct ifnet *ifp, uint32_t flags); | ||||
struct nl_parsed_link; | |||||
struct nlattr_bmask; | |||||
struct nl_pstate; | |||||
struct nl_writer; | |||||
struct ifc_data_nl { | |||||
struct nl_parsed_link *lattrs;/* (in) Parsed link attributes */ | |||||
const struct nlattr_bmask *bm; /* (in) Bitmask of set link attributes */ | |||||
struct nl_pstate *npt; /* (in) Netlink context */ | |||||
void *params;/* (in) (Compat) data from ioctl */ | |||||
uint32_t flags; /* (in) IFC_F flags */ | |||||
uint32_t unit; /* (in/out) Selected unit when IFC_C_AUTOUNIT set */ | |||||
int error; /* (out) Return error code */ | |||||
struct ifnet *ifp; /* (out) Returned ifp */ | |||||
}; | |||||
typedef int ifc_create_nl_f(struct if_clone *ifc, char *name, size_t maxlen, | |||||
struct ifc_data_nl *ifd); | |||||
typedef int ifc_modify_nl_f(struct ifnet *ifp, struct ifc_data_nl *ifd); | |||||
typedef void ifc_dump_nl_f(struct ifnet *ifp, struct nl_writer *nw); | |||||
struct if_clone_addreq { | struct if_clone_addreq { | ||||
uint16_t version; /* Always 0 for now */ | uint16_t version; /* Always 0 for now */ | ||||
uint16_t spare; | uint16_t spare; | ||||
uint32_t flags; | uint32_t flags; | ||||
uint32_t maxunit; /* Maximum allowed unit number */ | uint32_t maxunit; /* Maximum allowed unit number */ | ||||
ifc_match_f *match_f; | ifc_match_f *match_f; | ||||
ifc_create_f *create_f; | ifc_create_f *create_f; | ||||
ifc_destroy_f *destroy_f; | ifc_destroy_f *destroy_f; | ||||
}; | }; | ||||
struct if_clone_addreq_v2 { | |||||
uint16_t version; /* 2 */ | |||||
uint16_t spare; | |||||
uint32_t flags; | |||||
uint32_t maxunit; /* Maximum allowed unit number */ | |||||
ifc_match_f *match_f; | |||||
ifc_create_f *create_f; | |||||
ifc_destroy_f *destroy_f; | |||||
ifc_create_nl_f *create_nl_f; | |||||
ifc_modify_nl_f *modify_nl_f; | |||||
ifc_dump_nl_f *dump_nl_f; | |||||
}; | |||||
#define IFC_F_NOGROUP 0x01 /* Creation flag: don't add unit group */ | #define IFC_F_NOGROUP 0x01 /* Creation flag: don't add unit group */ | ||||
#define IFC_F_AUTOUNIT 0x02 /* Creation flag: automatically select unit */ | #define IFC_F_AUTOUNIT 0x02 /* Creation flag: automatically select unit */ | ||||
#define IFC_F_SYSSPACE 0x04 /* Cloner callback: params pointer is in kernel memory */ | #define IFC_F_SYSSPACE 0x04 /* Cloner callback: params pointer is in kernel memory */ | ||||
#define IFC_F_FORCE 0x08 /* Deletion flag: force interface deletion */ | #define IFC_F_FORCE 0x08 /* Deletion flag: force interface deletion */ | ||||
#define IFC_F_CREATE 0x10 /* Creation flag: indicate creation request */ | |||||
#define IFC_NOGROUP IFC_F_NOGROUP | #define IFC_NOGROUP IFC_F_NOGROUP | ||||
struct if_clone *ifc_attach_cloner(const char *name, struct if_clone_addreq *req); | struct if_clone *ifc_attach_cloner(const char *name, struct if_clone_addreq *req); | ||||
void ifc_detach_cloner(struct if_clone *ifc); | void ifc_detach_cloner(struct if_clone *ifc); | ||||
int ifc_create_ifp(const char *name, struct ifc_data *ifd, | int ifc_create_ifp(const char *name, struct ifc_data *ifd, struct ifnet **ifpp); | ||||
struct ifnet **ifpp); | |||||
bool ifc_create_ifp_nl(const char *name, struct ifc_data_nl *ifd); | |||||
bool ifc_modify_ifp_nl(struct ifnet *ifp, struct ifc_data_nl *ifd); | |||||
bool ifc_dump_ifp_nl(struct ifnet *ifp, struct nl_writer *nw); | |||||
void ifc_link_ifp(struct if_clone *ifc, struct ifnet *ifp); | void ifc_link_ifp(struct if_clone *ifc, struct ifnet *ifp); | ||||
bool ifc_unlink_ifp(struct if_clone *ifc, struct ifnet *ifp); | bool ifc_unlink_ifp(struct if_clone *ifc, struct ifnet *ifp); | ||||
int ifc_copyin(const struct ifc_data *ifd, void *target, size_t len); | int ifc_copyin(const struct ifc_data *ifd, void *target, size_t len); | ||||
#ifdef CLONE_COMPAT_13 | #ifdef CLONE_COMPAT_13 | ||||
/* Methods. */ | /* Methods. */ | ||||
▲ Show 20 Lines • Show All 41 Lines • Show Last 20 Lines |