![]() |
![]()
| ![]() |
![]()
NAMEdomain_add , pfctlinput ,
pffinddomain , pffindproto ,
pffindtype , DOMAIN_SET
—
network domain management
SYNOPSIS#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/protosw.h>
#include <sys/domain.h>
void
void
struct domain *
struct protosw *
struct protosw *
void
DESCRIPTIONNetwork protocols installed in the system are maintained within what are called domains (for example the inetdomain and localdomain).struct domain { int dom_family; /* AF_xxx */ char *dom_name; void (*dom_init) /* initialize domain data structures */ (void); void (*dom_destroy) /* cleanup structures / state */ (void); int (*dom_externalize) /* externalize access rights */ (struct mbuf *, struct mbuf **); void (*dom_dispose) /* dispose of internalized rights */ (struct mbuf *); struct protosw *dom_protosw, *dom_protoswNPROTOSW; struct domain *dom_next; int (*dom_rtattach) /* initialize routing table */ (void **, int); int (*dom_rtdetach) /* clean up routing table */ (void **, int); void *(*dom_ifattach)(struct ifnet *); void (*dom_ifdetach)(struct ifnet *, void *); int (*dom_ifmtu)(struct ifnet *); /* af-dependent data on ifnet */ }; Each domain contains an array of protocol switch structures (struct protosw *), one for each socket type supported. struct protosw { short pr_type; /* socket type used for */ struct domain *pr_domain; /* domain protocol a member of */ short pr_protocol; /* protocol number */ short pr_flags; /* see below */ /* protocol-protocol hooks */ pr_input_t *pr_input; /* input to protocol (from below) */ pr_output_t *pr_output; /* output to protocol (from above) */ pr_ctlinput_t *pr_ctlinput; /* control input (from below) */ pr_ctloutput_t *pr_ctloutput; /* control output (from above) */ /* utility hooks */ pr_init_t *pr_init; pr_fasttimo_t *pr_fasttimo; /* fast timeout (200ms) */ pr_slowtimo_t *pr_slowtimo; /* slow timeout (500ms) */ pr_drain_t *pr_drain; /* flush any excess space possible */ struct pr_usrreqs *pr_usrreqs; /* user-protocol hook */ }; The following functions handle the registration of a new domain, lookups of specific protocols and protocol types within those domains, and handle control messages from the system.
If the new domain has defined an initialization routine, it is
called by Once a domain is added it cannot be unloaded. This is because there is no reference counting system in place to determine if there are any active references from sockets within that domain.
Both functions are called by
struct domain localdomain = { AF_LOCAL, "local", unp_init, unp_externalize, unp_dispose, localsw, &localsw[sizeof(localsw)/sizeof(localsw[0])] }; DOMAIN_SET(local); RETURN VALUESBothpffindtype () and
pffindproto () return a struct protosw
* for the protocol requested. If the protocol or socket type is not
found, NULL is returned. In the case of
pffindproto (), the default protocol may be returned
for SOCK_RAW types if the domain has a default raw
protocol.
SEE ALSOsocket(2)HISTORYThe functionsdomain_add (),
pfctlinput (), pffinddomain (),
pffindproto (), pffindtype ()
and DOMAIN_SET () first appeared in
FreeBSD 4.4.
AUTHORSThis manual page was written by Chad David <davidc@acns.ab.ca>.
|