示例#1
0
static int stf_encapcheck(const struct mbuf *, int, int, void *);
static struct in6_ifaddr *stf_getsrcifa6(struct ifnet *);
static int stf_output(struct ifnet *, struct mbuf *, struct sockaddr *,
                      struct route *);
static int isrfc1918addr(struct in_addr *);
static int stf_checkaddr4(struct stf_softc *, struct in_addr *,
                          struct ifnet *);
static int stf_checkaddr6(struct stf_softc *, struct in6_addr *,
                          struct ifnet *);
static void stf_rtrequest(int, struct rtentry *, struct rt_addrinfo *);
static int stf_ioctl(struct ifnet *, u_long, caddr_t);

static int stf_clone_match(struct if_clone *, const char *);
static int stf_clone_create(struct if_clone *, char *, size_t, caddr_t);
static int stf_clone_destroy(struct if_clone *, struct ifnet *);
struct if_clone stf_cloner = IFC_CLONE_INITIALIZER(STFNAME, NULL, 0,
                             NULL, stf_clone_match, stf_clone_create, stf_clone_destroy);

static int
stf_clone_match(struct if_clone *ifc, const char *name)
{
    int i;

    for(i = 0; stfnames[i] != NULL; i++) {
        if (strcmp(stfnames[i], name) == 0)
            return (1);
    }

    return (0);
}

static int
示例#2
0
#define	USBUSNAME	"usbus"

static void usbpf_init(void);
static void usbpf_uninit(void);
static int usbpf_ioctl(struct ifnet *, u_long, caddr_t);
static int usbpf_clone_match(struct if_clone *, const char *);
static int usbpf_clone_create(struct if_clone *, char *, size_t, caddr_t);
static int usbpf_clone_destroy(struct if_clone *, struct ifnet *);
static struct usb_bus *usbpf_ifname2ubus(const char *);
static uint32_t usbpf_aggregate_xferflags(struct usb_xfer_flags *);
static uint32_t usbpf_aggregate_status(struct usb_xfer_flags_int *);
static int usbpf_xfer_frame_is_read(struct usb_xfer *, uint32_t);
static uint32_t usbpf_xfer_precompute_size(struct usb_xfer *, int);

static struct if_clone usbpf_cloner = IFC_CLONE_INITIALIZER(
    USBUSNAME, NULL, IF_MAXUNIT,
    NULL, usbpf_clone_match, usbpf_clone_create, usbpf_clone_destroy);

SYSINIT(usbpf_init, SI_SUB_PSEUDO, SI_ORDER_MIDDLE, usbpf_init, NULL);
SYSUNINIT(usbpf_uninit, SI_SUB_PSEUDO, SI_ORDER_MIDDLE, usbpf_uninit, NULL);

static void
usbpf_init(void)
{

	if_clone_attach(&usbpf_cloner);
}

static void
usbpf_uninit(void)
{