diff options
author | brooks <brooks@FreeBSD.org> | 2001-07-02 20:49:25 +0000 |
---|---|---|
committer | brooks <brooks@FreeBSD.org> | 2001-07-02 20:49:25 +0000 |
commit | 5da97d80e2d7042b9d86959519aca3d58066ca21 (patch) | |
tree | 5b65dfbb642b566dad2288425cf42bcebf948b13 /sys/net/if.h | |
parent | 10671e2b791d0b1e548f15151858169fc47c05cd (diff) | |
download | FreeBSD-src-5da97d80e2d7042b9d86959519aca3d58066ca21.zip FreeBSD-src-5da97d80e2d7042b9d86959519aca3d58066ca21.tar.gz |
Add kernel infrastructure for network device cloning.
Reviewed by: ru, ume
Obtained from: NetBSD
MFC after: 1 week
Diffstat (limited to 'sys/net/if.h')
-rw-r--r-- | sys/net/if.h | 38 |
1 files changed, 36 insertions, 2 deletions
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 <sys/queue.h> + /* * <net/if.h> does not depend on <sys/time.h> on most other systems. This * helps userland compatibility. (struct timeval ifi_lastchange) @@ -45,6 +47,40 @@ #include <sys/time.h> #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; |