rendered paste body#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/socket.h>
#include <sys/domain.h>
#include <sys/protosw.h>
#include <sys/queue.h>
#include <sys/sysctl.h>
#include <netinet/in.h>
#include <netinet/ip_var.h>
#include <netnp/in.h>
#include <netnp/np_var.h>
#include <netnp/udp_np_var.h>
extern struct domain npdomain;
static struct pr_usrreqs nousrreqs;
struct protosw npsw[] = {
{
.pr_type = 0,
.pr_domain = &npdomain,
.pr_protocol = NPPROTO_NP,
.pr_init = np_init,
.pr_slowtimo = np_slowtimo,
.pr_drain = np_drain,
.pr_usrreqs = &nousrreqs
},
{
.pr_type = SOCK_DGRAM,
.pr_domain = &npdomain,
.pr_protocol = NPPROTO_UDP,
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_input = udp_np_input,
.pr_ctlinput = udp_np_ctlinput,
.pr_ctloutput = np_ctloutput,
.pr_usrreqs = &udp_np_usrreqs,
},
};
extern int in_inithead(void **, int);
/*XXX : Change in_inithead at some point, need to include appropriate files for now however to make it work*/
struct domain npdomain = {
.dom_family = AF_NP,
.dom_name = "np++",
.dom_protosw = npsw,
.dom_protoswNPROTOSW = &npsw[sizeof(npsw)/sizeof(npsw[0])],
.dom_rtattach = in_inithead,
.dom_rtoffset = 32,
.dom_maxrtkey = sizeof(struct sockaddr_in)
};
DOMAIN_SET(np);
SYSCTL_NODE(_net, PF_NP, np, CTLFLAG_RW, 0, "NP Family") ;