more lint
[unix-history] / usr / src / sys / kern / uipc_proto.c
index bde28c6..63b3b78 100644 (file)
@@ -1,11 +1,13 @@
-/*     uipc_proto.c    4.13    81/12/20        */
+/*     uipc_proto.c    4.26    82/10/17        */
 
 #include "../h/param.h"
 #include "../h/socket.h"
 #include "../h/protosw.h"
 #include "../h/mbuf.h"
 
 #include "../h/param.h"
 #include "../h/socket.h"
 #include "../h/protosw.h"
 #include "../h/mbuf.h"
-#include "../net/in.h"
-#include "../net/in_systm.h"
+#include <time.h>
+#include "../h/kernel.h"
+#include "../netinet/in.h"
+#include "../netinet/in_systm.h"
 
 /*
  * Protocol configuration table and routines to search it.
 
 /*
  * Protocol configuration table and routines to search it.
@@ -23,16 +25,37 @@ int piusrreq();
  */
 int    ip_output();
 int    ip_init(),ip_slowtimo(),ip_drain();
  */
 int    ip_output();
 int    ip_init(),ip_slowtimo(),ip_drain();
-int    icmp_input(),icmp_ctlinput();
-int    icmp_drain();
+int    icmp_input();
 int    udp_input(),udp_ctlinput();
 int    udp_usrreq();
 int    udp_init();
 int    tcp_input(),tcp_ctlinput();
 int    tcp_usrreq();
 int    tcp_init(),tcp_fasttimo(),tcp_slowtimo(),tcp_drain();
 int    udp_input(),udp_ctlinput();
 int    udp_usrreq();
 int    udp_init();
 int    tcp_input(),tcp_ctlinput();
 int    tcp_usrreq();
 int    tcp_init(),tcp_fasttimo(),tcp_slowtimo(),tcp_drain();
-int    rip_input(),rip_output(),rip_ctlinput();
-int    rip_usrreq(),rip_slowtimo();
+int    rip_input(),rip_output();
+
+/*
+ * IMP protocol family: raw interface.
+ * Using the raw interface entry to get the timer routine
+ * in is a kludge.
+ */
+#include "imp.h"
+#if NIMP > 0
+int    rimp_output(), hostslowtimo();
+#endif
+
+/*
+ * PUP-I protocol family: raw interface
+ */
+#include "pup.h"
+#if NPUP > 0
+int    rpup_output();
+#endif
+
+/*
+ * Sundries.
+*/
+int    raw_init(),raw_usrreq(),raw_input(),raw_ctlinput();
 
 struct protosw protosw[] = {
 { SOCK_STREAM, PF_UNIX,        0,              PR_CONNREQUIRED,
 
 struct protosw protosw[] = {
 { SOCK_STREAM, PF_UNIX,        0,              PR_CONNREQUIRED,
@@ -60,10 +83,10 @@ struct protosw protosw[] = {
   0,
   ip_init,     0,              ip_slowtimo,    ip_drain,
 },
   0,
   ip_init,     0,              ip_slowtimo,    ip_drain,
 },
-{ 0,           0,              IPPROTO_ICMP,   0,
-  icmp_input,  0,              icmp_ctlinput,  0,
+{ 0,           PF_INET,        IPPROTO_ICMP,   0,
+  icmp_input,  0,              0,              0,
   0,
   0,
-  0,           0,              0,              icmp_drain,
+  0,           0,              0,              0,
 },
 { SOCK_DGRAM,  PF_INET,        IPPROTO_UDP,    PR_ATOMIC|PR_ADDR,
   udp_input,   0,              udp_ctlinput,   0,
 },
 { SOCK_DGRAM,  PF_INET,        IPPROTO_UDP,    PR_ATOMIC|PR_ADDR,
   udp_input,   0,              udp_ctlinput,   0,
@@ -75,11 +98,32 @@ struct protosw protosw[] = {
   tcp_usrreq,
   tcp_init,    tcp_fasttimo,   tcp_slowtimo,   tcp_drain,
 },
   tcp_usrreq,
   tcp_init,    tcp_fasttimo,   tcp_slowtimo,   tcp_drain,
 },
+{ 0,           0,              0,              0,
+  raw_input,   0,              raw_ctlinput,   0,
+  raw_usrreq,
+  raw_init,    0,              0,              0,
+},
 { SOCK_RAW,    PF_INET,        IPPROTO_RAW,    PR_ATOMIC|PR_ADDR,
 { SOCK_RAW,    PF_INET,        IPPROTO_RAW,    PR_ATOMIC|PR_ADDR,
-  rip_input,   rip_output,     rip_ctlinput,   0,
-  rip_usrreq,
-  0,           0,              rip_slowtimo,   0,
+  rip_input,   rip_output,     0,      0,
+  raw_usrreq,
+  0,           0,              0,              0,
+}
+#if NIMP > 0
+,
+{ SOCK_RAW,    PF_IMPLINK,     0,              PR_ATOMIC|PR_ADDR,
+  0,           rimp_output,    0,              0,
+  raw_usrreq,
+  0,           0,              hostslowtimo,   0,
 }
 }
+#endif
+#if NPUP > 0
+,
+{ SOCK_RAW,    PF_PUP,         0,              PR_ATOMIC|PR_ADDR,
+  0,           rpup_output,    0,              0,
+  raw_usrreq,
+  0,           0,              0,              0,
+}
+#endif
 };
 
 #define        NPROTOSW        (sizeof(protosw) / sizeof(protosw[0]))
 };
 
 #define        NPROTOSW        (sizeof(protosw) / sizeof(protosw[0]))
@@ -97,10 +141,11 @@ pfinit()
 {
        register struct protosw *pr;
 
 {
        register struct protosw *pr;
 
-COUNT(PFINIT);
        for (pr = protoswLAST; pr >= protosw; pr--)
                if (pr->pr_init)
                        (*pr->pr_init)();
        for (pr = protoswLAST; pr >= protosw; pr--)
                if (pr->pr_init)
                        (*pr->pr_init)();
+       pffasttimo();
+       pfslowtimo();
 }
 
 /*
 }
 
 /*
@@ -113,7 +158,6 @@ pffindtype(family, type)
 {
        register struct protosw *pr;
 
 {
        register struct protosw *pr;
 
-COUNT(PFFINDTYPE);
        if (family == 0)
                return (0);
        for (pr = protosw; pr <= protoswLAST; pr++)
        if (family == 0)
                return (0);
        for (pr = protosw; pr <= protoswLAST; pr++)
@@ -131,7 +175,6 @@ pffindproto(family, protocol)
 {
        register struct protosw *pr;
 
 {
        register struct protosw *pr;
 
-COUNT(PFFINDPROTO);
        if (family == 0)
                return (0);
        for (pr = protosw; pr <= protoswLAST; pr++)
        if (family == 0)
                return (0);
        for (pr = protosw; pr <= protoswLAST; pr++)
@@ -140,6 +183,17 @@ COUNT(PFFINDPROTO);
        return (0);
 }
 
        return (0);
 }
 
+pfctlinput(cmd, arg)
+       int cmd;
+       caddr_t arg;
+{
+       register struct protosw *pr;
+
+       for (pr = protosw; pr <= protoswLAST; pr++)
+               if (pr->pr_ctlinput)
+                       (*pr->pr_ctlinput)(cmd, arg);
+}
+
 /*
  * Slow timeout on all protocols.
  */
 /*
  * Slow timeout on all protocols.
  */
@@ -147,18 +201,18 @@ pfslowtimo()
 {
        register struct protosw *pr;
 
 {
        register struct protosw *pr;
 
-COUNT(PFSLOWTIMO);
        for (pr = protoswLAST; pr >= protosw; pr--)
                if (pr->pr_slowtimo)
                        (*pr->pr_slowtimo)();
        for (pr = protoswLAST; pr >= protosw; pr--)
                if (pr->pr_slowtimo)
                        (*pr->pr_slowtimo)();
+       timeout(pfslowtimo, (caddr_t)0, hz / PR_SLOWHZ);
 }
 
 pffasttimo()
 {
        register struct protosw *pr;
 
 }
 
 pffasttimo()
 {
        register struct protosw *pr;
 
-COUNT(PFSLOWTIMO);
        for (pr = protoswLAST; pr >= protosw; pr--)
                if (pr->pr_fasttimo)
                        (*pr->pr_fasttimo)();
        for (pr = protoswLAST; pr >= protosw; pr--)
                if (pr->pr_fasttimo)
                        (*pr->pr_fasttimo)();
+       timeout(pffasttimo, (caddr_t)0, hz / PR_FASTHZ);
 }
 }