Changeset View
Changeset View
Standalone View
Standalone View
sys/netgraph/ng_socket.c
Show First 20 Lines • Show All 1,122 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
static int | static int | ||||
dummy_disconnect(struct socket *so) | dummy_disconnect(struct socket *so) | ||||
{ | { | ||||
return (0); | return (0); | ||||
} | } | ||||
/* | /* | ||||
* Definitions of protocols supported in the NETGRAPH domain. | |||||
* Control and data socket type descriptors | * Control and data socket type descriptors | ||||
* | * | ||||
* XXXRW: Perhaps _close should do something? | * XXXRW: Perhaps _close should do something? | ||||
*/ | */ | ||||
static struct protosw ngcontrol_protosw = { | |||||
static struct pr_usrreqs ngc_usrreqs = { | |||||
.pru_attach = ngc_attach, | |||||
.pru_bind = ngc_bind, | |||||
.pru_connect = ngc_connect, | |||||
.pru_detach = ngc_detach, | |||||
.pru_disconnect = dummy_disconnect, | |||||
.pru_send = ngc_send, | |||||
.pru_sockaddr = ng_getsockaddr, | |||||
}; | |||||
static struct pr_usrreqs ngd_usrreqs = { | |||||
.pru_attach = ngd_attach, | |||||
.pru_connect = ngd_connect, | |||||
.pru_detach = ngd_detach, | |||||
.pru_disconnect = dummy_disconnect, | |||||
.pru_send = ngd_send, | |||||
.pru_sockaddr = ng_getsockaddr, | |||||
}; | |||||
/* | |||||
* Definitions of protocols supported in the NETGRAPH domain. | |||||
*/ | |||||
extern struct domain ngdomain; /* stop compiler warnings */ | |||||
static struct protosw ngsw[] = { | |||||
{ | |||||
.pr_type = SOCK_DGRAM, | .pr_type = SOCK_DGRAM, | ||||
.pr_domain = &ngdomain, | |||||
.pr_protocol = NG_CONTROL, | .pr_protocol = NG_CONTROL, | ||||
.pr_flags = PR_ATOMIC | PR_ADDR /* | PR_RIGHTS */, | .pr_flags = PR_ATOMIC | PR_ADDR /* | PR_RIGHTS */, | ||||
.pr_usrreqs = &ngc_usrreqs | .pr_attach = ngc_attach, | ||||
}, | .pr_bind = ngc_bind, | ||||
{ | .pr_connect = ngc_connect, | ||||
.pr_detach = ngc_detach, | |||||
.pr_disconnect = dummy_disconnect, | |||||
.pr_send = ngc_send, | |||||
.pr_sockaddr = ng_getsockaddr, | |||||
}; | |||||
static struct protosw ngdata_protosw = { | |||||
.pr_type = SOCK_DGRAM, | .pr_type = SOCK_DGRAM, | ||||
.pr_domain = &ngdomain, | |||||
.pr_protocol = NG_DATA, | .pr_protocol = NG_DATA, | ||||
.pr_flags = PR_ATOMIC | PR_ADDR, | .pr_flags = PR_ATOMIC | PR_ADDR, | ||||
.pr_usrreqs = &ngd_usrreqs | .pr_attach = ngd_attach, | ||||
} | .pr_connect = ngd_connect, | ||||
.pr_detach = ngd_detach, | |||||
.pr_disconnect = dummy_disconnect, | |||||
.pr_send = ngd_send, | |||||
.pr_sockaddr = ng_getsockaddr, | |||||
}; | }; | ||||
struct domain ngdomain = { | static struct domain ngdomain = { | ||||
.dom_family = AF_NETGRAPH, | .dom_family = AF_NETGRAPH, | ||||
.dom_name = "netgraph", | .dom_name = "netgraph", | ||||
.dom_protosw = ngsw, | .dom_nprotosw = 2, | ||||
.dom_protoswNPROTOSW = &ngsw[nitems(ngsw)] | .dom_protosw = { &ngcontrol_protosw, &ngdata_protosw }, | ||||
}; | }; | ||||
/* | /* | ||||
* Handle loading and unloading for this node type. | * Handle loading and unloading for this node type. | ||||
* This is to handle auxiliary linkages (e.g protocol domain addition). | * This is to handle auxiliary linkages (e.g protocol domain addition). | ||||
*/ | */ | ||||
static int | static int | ||||
ngs_mod_event(module_t mod, int event, void *data) | ngs_mod_event(module_t mod, int event, void *data) | ||||
Show All 34 Lines |