From 5da97d80e2d7042b9d86959519aca3d58066ca21 Mon Sep 17 00:00:00 2001 From: brooks Date: Mon, 2 Jul 2001 20:49:25 +0000 Subject: Add kernel infrastructure for network device cloning. Reviewed by: ru, ume Obtained from: NetBSD MFC after: 1 week --- sys/net/if.h | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) (limited to 'sys/net/if.h') diff --git a/sys/net/if.h b/sys/net/if.h index 6cdaa53..088c7ef 100644 --- a/sys/net/if.h +++ b/sys/net/if.h @@ -37,6 +37,8 @@ #ifndef _NET_IF_H_ #define _NET_IF_H_ +#include + /* * does not depend on on most other systems. This * helps userland compatibility. (struct timeval ifi_lastchange) @@ -45,6 +47,40 @@ #include #endif +struct ifnet; + +/* + * Length of interface external name, including terminating '\0'. + * Note: this is the same size as a generic device's external name. + */ +#define IFNAMSIZ 16 +#define IF_NAMESIZE IFNAMSIZ + +/* + * Structure describing a `cloning' interface. + */ +struct if_clone { + LIST_ENTRY(if_clone) ifc_list; /* on list of cloners */ + const char *ifc_name; /* name of device, e.g. `gif' */ + size_t ifc_namelen; /* length of name */ + + int (*ifc_create)(struct if_clone *, int *); + void (*ifc_destroy)(struct ifnet *); +}; + +#define IF_CLONE_INITIALIZER(name, create, destroy) \ + { { 0 }, name, sizeof(name) - 1, create, destroy } + +/* + * Structure used to query names of interface cloners. + */ + +struct if_clonereq { + int ifcr_total; /* total cloners (out) */ + int ifcr_count; /* room for this many in user buffer */ + char *ifcr_buffer; /* buffer for cloner names */ +}; + /* * Structure describing information about an interface * which may be of interest to management entities. @@ -151,8 +187,6 @@ struct ifma_msghdr { * remainder may be interface specific. */ struct ifreq { -#define IFNAMSIZ 16 -#define IF_NAMESIZE IFNAMSIZ char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ union { struct sockaddr ifru_addr; -- cgit v1.1