Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/sctp_module.c
Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | |||||
#ifdef INET | #ifdef INET | ||||
extern struct domain inetdomain; | extern struct domain inetdomain; | ||||
struct protosw sctp_stream_protosw = { | struct protosw sctp_stream_protosw = { | ||||
.pr_type = SOCK_STREAM, | .pr_type = SOCK_STREAM, | ||||
.pr_domain = &inetdomain, | .pr_domain = &inetdomain, | ||||
.pr_protocol = IPPROTO_SCTP, | .pr_protocol = IPPROTO_SCTP, | ||||
.pr_flags = PR_CONNREQUIRED|PR_WANTRCVD, | .pr_flags = PR_CONNREQUIRED|PR_WANTRCVD, | ||||
.pr_input = sctp_input, | |||||
.pr_ctlinput = sctp_ctlinput, | |||||
.pr_ctloutput = sctp_ctloutput, | .pr_ctloutput = sctp_ctloutput, | ||||
.pr_drain = sctp_drain, | .pr_drain = sctp_drain, | ||||
.pr_usrreqs = &sctp_usrreqs, | .pr_usrreqs = &sctp_usrreqs, | ||||
}; | }; | ||||
struct protosw sctp_seqpacket_protosw = { | struct protosw sctp_seqpacket_protosw = { | ||||
.pr_type = SOCK_SEQPACKET, | .pr_type = SOCK_SEQPACKET, | ||||
.pr_domain = &inetdomain, | .pr_domain = &inetdomain, | ||||
.pr_protocol = IPPROTO_SCTP, | .pr_protocol = IPPROTO_SCTP, | ||||
.pr_flags = PR_WANTRCVD, | .pr_flags = PR_WANTRCVD, | ||||
.pr_input = sctp_input, | |||||
.pr_ctlinput = sctp_ctlinput, | |||||
.pr_ctloutput = sctp_ctloutput, | .pr_ctloutput = sctp_ctloutput, | ||||
.pr_drain = sctp_drain, | .pr_drain = sctp_drain, | ||||
.pr_usrreqs = &sctp_usrreqs, | .pr_usrreqs = &sctp_usrreqs, | ||||
}; | }; | ||||
#endif | #endif | ||||
#ifdef INET6 | #ifdef INET6 | ||||
extern struct domain inet6domain; | extern struct domain inet6domain; | ||||
struct protosw sctp6_stream_protosw = { | struct protosw sctp6_stream_protosw = { | ||||
.pr_type = SOCK_STREAM, | .pr_type = SOCK_STREAM, | ||||
.pr_domain = &inet6domain, | .pr_domain = &inet6domain, | ||||
.pr_protocol = IPPROTO_SCTP, | .pr_protocol = IPPROTO_SCTP, | ||||
.pr_flags = PR_CONNREQUIRED|PR_WANTRCVD, | .pr_flags = PR_CONNREQUIRED|PR_WANTRCVD, | ||||
.pr_input = sctp6_input, | |||||
.pr_ctlinput = sctp6_ctlinput, | |||||
.pr_ctloutput = sctp_ctloutput, | .pr_ctloutput = sctp_ctloutput, | ||||
.pr_drain = sctp_drain, | .pr_drain = sctp_drain, | ||||
.pr_usrreqs = &sctp6_usrreqs, | .pr_usrreqs = &sctp6_usrreqs, | ||||
}; | }; | ||||
struct protosw sctp6_seqpacket_protosw = { | struct protosw sctp6_seqpacket_protosw = { | ||||
.pr_type = SOCK_SEQPACKET, | .pr_type = SOCK_SEQPACKET, | ||||
.pr_domain = &inet6domain, | .pr_domain = &inet6domain, | ||||
.pr_protocol = IPPROTO_SCTP, | .pr_protocol = IPPROTO_SCTP, | ||||
.pr_flags = PR_WANTRCVD, | .pr_flags = PR_WANTRCVD, | ||||
.pr_input = sctp6_input, | |||||
.pr_ctlinput = sctp6_ctlinput, | |||||
.pr_ctloutput = sctp_ctloutput, | .pr_ctloutput = sctp_ctloutput, | ||||
#ifndef INET /* Do not call initialization and drain routines twice. */ | #ifndef INET /* Do not call initialization and drain routines twice. */ | ||||
.pr_drain = sctp_drain, | .pr_drain = sctp_drain, | ||||
#endif | #endif | ||||
.pr_usrreqs = &sctp6_usrreqs, | .pr_usrreqs = &sctp6_usrreqs, | ||||
}; | }; | ||||
#endif | #endif | ||||
static int | static int | ||||
sctp_module_load(void) | sctp_module_load(void) | ||||
{ | { | ||||
int error; | int error; | ||||
#ifdef INET | #ifdef INET | ||||
error = pf_proto_register(PF_INET, &sctp_stream_protosw); | error = pf_proto_register(PF_INET, &sctp_stream_protosw); | ||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
error = pf_proto_register(PF_INET, &sctp_seqpacket_protosw); | error = pf_proto_register(PF_INET, &sctp_seqpacket_protosw); | ||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
error = ipproto_register(IPPROTO_SCTP); | error = ipproto_register(IPPROTO_SCTP, sctp_input, sctp_ctlinput); | ||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
#endif | #endif | ||||
#ifdef INET6 | #ifdef INET6 | ||||
error = pf_proto_register(PF_INET6, &sctp6_stream_protosw); | error = pf_proto_register(PF_INET6, &sctp6_stream_protosw); | ||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
error = pf_proto_register(PF_INET6, &sctp6_seqpacket_protosw); | error = pf_proto_register(PF_INET6, &sctp6_seqpacket_protosw); | ||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
error = ip6proto_register(IPPROTO_SCTP); | error = ip6proto_register(IPPROTO_SCTP, sctp6_input, sctp6_ctlinput); | ||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
#endif | #endif | ||||
error = sctp_syscalls_init(); | error = sctp_syscalls_init(); | ||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
return (0); | return (0); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 51 Lines • Show Last 20 Lines |