added my responsibility for the `cpm' port
[unix-history] / sys / netiso / esis.c
index f80de34..c15a65d 100644 (file)
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  *     from: @(#)esis.c        7.19 (Berkeley) 6/27/91
  * SUCH DAMAGE.
  *
  *     from: @(#)esis.c        7.19 (Berkeley) 6/27/91
- *     $Id$
+ *     $Id: esis.c,v 1.5 1993/11/25 01:35:52 wollman Exp $
  */
 
 /***********************************************************
  */
 
 /***********************************************************
@@ -99,12 +99,17 @@ SOFTWARE.
  *
  */
 struct rawcb   esis_pcb;
  *
  */
 struct rawcb   esis_pcb;
-int                            esis_config(), snpac_age();
-int                            esis_sendspace = 2048;
-int                            esis_recvspace = 2048;
-short                  esis_holding_time = ESIS_HT;
-short                  esis_config_time = ESIS_CONFIG;
-short                  esis_esconfig_time = ESIS_CONFIG;
+struct esis_stat esis_stat;
+
+static void esis_eshinput(struct mbuf *, struct snpa_hdr *);
+static void esis_ishinput(struct mbuf *, struct snpa_hdr *);
+static void esis_rdinput(struct mbuf *, struct snpa_hdr *);
+
+int esis_sendspace = 2048;
+int esis_recvspace = 2048;
+short esis_holding_time = ESIS_HT;
+short esis_config_time = ESIS_CONFIG;
+short esis_esconfig_time = ESIS_CONFIG;
 extern int             iso_systype;
 struct sockaddr_dl     esis_dl = { sizeof(esis_dl), AF_LINK };
 extern char            all_es_snpa[], all_is_snpa[];
 extern int             iso_systype;
 struct sockaddr_dl     esis_dl = { sizeof(esis_dl), AF_LINK };
 extern char            all_es_snpa[], all_is_snpa[];
@@ -118,6 +123,11 @@ extern char                all_es_snpa[], all_is_snpa[];
                (m) = (m)->m_next;\
                (cp) = mtod((m), caddr_t);\
        }
                (m) = (m)->m_next;\
                (cp) = mtod((m), caddr_t);\
        }
+
+#ifdef ISO_X25ESIS
+void   x25esis_input();
+#endif ISO_X25ESIS
+
 /*
  * FUNCTION:           esis_init
  *
 /*
  * FUNCTION:           esis_init
  *
@@ -129,13 +139,10 @@ extern char               all_es_snpa[], all_is_snpa[];
  *
  * NOTES:                      
  */
  *
  * NOTES:                      
  */
+void
 esis_init()
 {
        extern struct clnl_protosw clnl_protox[256];
 esis_init()
 {
        extern struct clnl_protosw clnl_protox[256];
-       int     esis_input(), isis_input();
-#ifdef ISO_X25ESIS
-       int     x25esis_input();
-#endif ISO_X25ESIS
 
        esis_pcb.rcb_next = esis_pcb.rcb_prev = &esis_pcb;
        llinfo_llc.lc_next = llinfo_llc.lc_prev = &llinfo_llc;
 
        esis_pcb.rcb_next = esis_pcb.rcb_prev = &esis_pcb;
        llinfo_llc.lc_next = llinfo_llc.lc_prev = &llinfo_llc;
@@ -161,6 +168,7 @@ esis_init()
  *
  */
 /*ARGSUSED*/
  *
  */
 /*ARGSUSED*/
+int
 esis_usrreq(so, req, m, nam, control)
 struct socket  *so;            /* socket: used only to get to this code */
 int                            req;            /* request */
 esis_usrreq(so, req, m, nam, control)
 struct socket  *so;            /* socket: used only to get to this code */
 int                            req;            /* request */
@@ -243,6 +251,7 @@ release:
  *
  * NOTES:                      
  */
  *
  * NOTES:                      
  */
+void
 esis_input(m0, shp)
 struct mbuf            *m0;            /* ptr to first mbuf of pkt */
 struct snpa_hdr        *shp;   /* subnetwork header */
 esis_input(m0, shp)
 struct mbuf            *m0;            /* ptr to first mbuf of pkt */
 struct snpa_hdr        *shp;   /* subnetwork header */
@@ -300,6 +309,7 @@ bad:
  * NOTES:                      Assumes there is enough space for fixed part of header,
  *                                     DA, BSNPA and NET in first mbuf.
  */
  * NOTES:                      Assumes there is enough space for fixed part of header,
  *                                     DA, BSNPA and NET in first mbuf.
  */
+void
 esis_rdoutput(inbound_shp, inbound_m, inbound_oidx, rd_dstnsap, rt)
 struct snpa_hdr                *inbound_shp;   /* snpa hdr from incoming packet */
 struct mbuf                    *inbound_m;             /* incoming pkt itself */
 esis_rdoutput(inbound_shp, inbound_m, inbound_oidx, rd_dstnsap, rt)
 struct snpa_hdr                *inbound_shp;   /* snpa hdr from incoming packet */
 struct mbuf                    *inbound_m;             /* incoming pkt itself */
@@ -444,7 +454,7 @@ struct rtentry              *rt;                    /* snpa cache info regarding next hop of
        siso.siso_nlen = 6 + 1; /* should be taken from snpa_hdr */
                                                                                /* +1 is for AFI */
        bcopy(inbound_shp->snh_shost, siso.siso_data + 1, 6);
        siso.siso_nlen = 6 + 1; /* should be taken from snpa_hdr */
                                                                                /* +1 is for AFI */
        bcopy(inbound_shp->snh_shost, siso.siso_data + 1, 6);
-       (ifp->if_output)(ifp, m0, &siso, 0);
+       (ifp->if_output)(ifp, m0, (struct sockaddr *)&siso, 0);
 }
 
 /*
 }
 
 /*
@@ -458,6 +468,7 @@ struct rtentry              *rt;                    /* snpa cache info regarding next hop of
  *
  * NOTES:                      Plus 1 here is for length byte
  */
  *
  * NOTES:                      Plus 1 here is for length byte
  */
+int
 esis_insert_addr(buf, len, isoa, m, nsellen)
 register caddr_t                       *buf;           /* ptr to buffer to put address into */
 int                                                    *len;           /* ptr to length of buffer so far */
 esis_insert_addr(buf, len, isoa, m, nsellen)
 register caddr_t                       *buf;           /* ptr to buffer to put address into */
 int                                                    *len;           /* ptr to length of buffer so far */
@@ -485,7 +496,6 @@ int                                                 nsellen;
 #define ESIS_NEXT_OPTION(b)    { b += (2 + b[1]); \
            if (b > buflim) {esis_stat.es_toosmall++; goto bad;}}
 int ESHonly = 0;
 #define ESIS_NEXT_OPTION(b)    { b += (2 + b[1]); \
            if (b > buflim) {esis_stat.es_toosmall++; goto bad;}}
 int ESHonly = 0;
-/*
  
 /*
  * FUNCTION:           esis_eshinput
  
 /*
  * FUNCTION:           esis_eshinput
@@ -498,13 +508,14 @@ int ESHonly = 0;
  *
  * NOTES:                      
  */
  *
  * NOTES:                      
  */
+void
 esis_eshinput(m, shp)
 struct mbuf            *m;     /* esh pdu */
 struct snpa_hdr        *shp;   /* subnetwork header */
 {
        struct  esis_fixed      *pdu = mtod(m, struct esis_fixed *);
        u_short                         ht;             /* holding time */
 esis_eshinput(m, shp)
 struct mbuf            *m;     /* esh pdu */
 struct snpa_hdr        *shp;   /* subnetwork header */
 {
        struct  esis_fixed      *pdu = mtod(m, struct esis_fixed *);
        u_short                         ht;             /* holding time */
-       struct  iso_addr        *nsap;
+       struct iso_addr *nsap = 0;
        int                                     naddr;
        u_char                          *buf = (u_char *)(pdu + 1);
        u_char                          *buflim = pdu->esis_hdr_len + (u_char *)pdu;
        int                                     naddr;
        u_char                          *buf = (u_char *)(pdu + 1);
        u_char                          *buflim = pdu->esis_hdr_len + (u_char *)pdu;
@@ -582,6 +593,7 @@ bad:
  *
  * NOTES:                      
  */
  *
  * NOTES:                      
  */
+void
 esis_ishinput(m, shp)
 struct mbuf            *m;     /* esh pdu */
 struct snpa_hdr        *shp;   /* subnetwork header */
 esis_ishinput(m, shp)
 struct mbuf            *m;     /* esh pdu */
 struct snpa_hdr        *shp;   /* subnetwork header */
@@ -612,10 +624,10 @@ struct snpa_hdr   *shp;   /* subnetwork header */
                        if (buf[1] != 2)
                                goto bad;
                        CTOH(buf[2], buf[3], newct);
                        if (buf[1] != 2)
                                goto bad;
                        CTOH(buf[2], buf[3], newct);
-                       if (esis_config_time != newct) {
+                       if ((u_long)esis_config_time != (u_long)newct) {
                                untimeout(esis_config,0);
                                esis_config_time = newct;
                                untimeout(esis_config,0);
                                esis_config_time = newct;
-                               esis_config();
+                               esis_config(0, 0);
                        }
                        break;
                
                        }
                        break;
                
@@ -649,6 +661,7 @@ bad:
  *
  * NOTES:                      
  */
  *
  * NOTES:                      
  */
+void
 esis_rdinput(m0, shp)
 struct mbuf            *m0;    /* esh pdu */
 struct snpa_hdr        *shp;   /* subnetwork header */
 esis_rdinput(m0, shp)
 struct mbuf            *m0;    /* esh pdu */
 struct snpa_hdr        *shp;   /* subnetwork header */
@@ -744,7 +757,8 @@ bad: ;    /* Needed by ESIS_NEXT_OPTION */
  *
  * NOTES:                      Called every esis_config_time seconds
  */
  *
  * NOTES:                      Called every esis_config_time seconds
  */
-esis_config()
+void
+esis_config(caddr_t dummy1, int dummy2)
 {
        register struct ifnet   *ifp;
 
 {
        register struct ifnet   *ifp;
 
@@ -793,13 +807,14 @@ esis_config()
  *
  * NOTES:                      
  */
  *
  * NOTES:                      
  */
+void
 esis_shoutput(ifp, type, ht, sn_addr, sn_len, isoa)
 esis_shoutput(ifp, type, ht, sn_addr, sn_len, isoa)
-struct ifnet   *ifp;
-int                            type;
-short                  ht;
-caddr_t                sn_addr;
-int                            sn_len;
-struct iso_addr *isoa;
+       struct ifnet *ifp;
+       int type;
+       short ht;
+       caddr_t sn_addr;
+       int sn_len;
+       struct iso_addr *isoa;
 {
        struct mbuf                     *m, *m0;
        caddr_t                         cp, naddrp;
 {
        struct mbuf                     *m, *m0;
        caddr_t                         cp, naddrp;
@@ -921,7 +936,7 @@ struct      iso_addr *isoa;
        siso.siso_data[0] = AFI_SNA;
        siso.siso_nlen = sn_len + 1;
        bcopy(sn_addr, siso.siso_data + 1, (unsigned)sn_len);
        siso.siso_data[0] = AFI_SNA;
        siso.siso_nlen = sn_len + 1;
        bcopy(sn_addr, siso.siso_data + 1, (unsigned)sn_len);
-       (ifp->if_output)(ifp, m0, &siso, 0);
+       (ifp->if_output)(ifp, m0, (struct sockaddr *)&siso, 0);
 }
 
 /*
 }
 
 /*
@@ -935,6 +950,7 @@ struct      iso_addr *isoa;
  *
  * NOTES:                      
  */
  *
  * NOTES:                      
  */
+void
 isis_input(m0, shp)
 struct mbuf            *m0;            /* ptr to first mbuf of pkt */
 struct snpa_hdr        *shp;   /* subnetwork header */
 isis_input(m0, shp)
 struct mbuf            *m0;            /* ptr to first mbuf of pkt */
 struct snpa_hdr        *shp;   /* subnetwork header */
@@ -967,24 +983,27 @@ struct snpa_hdr   *shp;   /* subnetwork header */
                }
                if (mm = m_copy(m0, 0, M_COPYALL)) { /*can't block at interrupt level */
                        if (sbappendaddr(&rp->rcb_socket->so_rcv,
                }
                if (mm = m_copy(m0, 0, M_COPYALL)) { /*can't block at interrupt level */
                        if (sbappendaddr(&rp->rcb_socket->so_rcv,
-                                                         &esis_dl, mm, (struct mbuf *)0) != 0)
+                                        (struct sockaddr *)&esis_dl,
+                                        mm, (struct mbuf *)0) != 0)
                                sorwakeup(rp->rcb_socket);
                        else {
                                IFDEBUG(D_ISISINPUT)
                                sorwakeup(rp->rcb_socket);
                        else {
                                IFDEBUG(D_ISISINPUT)
-                                       printf("Error in sbappenaddr, mm = 0x%x\n", mm);
+                                 printf("Error in sbappenaddr, mm = 0x%x\n", mm);
                                ENDDEBUG
                                m_freem(mm);
                        }
                }
        }
        if (first_rp && sbappendaddr(&first_rp->rcb_socket->so_rcv,
                                ENDDEBUG
                                m_freem(mm);
                        }
                }
        }
        if (first_rp && sbappendaddr(&first_rp->rcb_socket->so_rcv,
-                                                         &esis_dl, m0, (struct mbuf *)0) != 0) {
+                                    (struct sockaddr *)&esis_dl,
+                                    m0, (struct mbuf *)0) != 0) {
                sorwakeup(first_rp->rcb_socket);
                return;
        }
        m_freem(m0);
 }
 
                sorwakeup(first_rp->rcb_socket);
                return;
        }
        m_freem(m0);
 }
 
+int
 isis_output(sdl, m)
 register struct sockaddr_dl    *sdl;
 struct mbuf *m;
 isis_output(sdl, m)
 register struct sockaddr_dl    *sdl;
 struct mbuf *m;
@@ -1048,6 +1067,7 @@ release:
  *                                     The loop through iso_ifaddr is stupid because
  *                                     back in if_down, we knew the ifp...
  */
  *                                     The loop through iso_ifaddr is stupid because
  *                                     back in if_down, we knew the ifp...
  */
+void
 esis_ctlinput(req, siso)
 int                                            req;            /* request: we handle only PRC_IFDOWN */
 struct sockaddr_iso            *siso;          /* address of ifp */
 esis_ctlinput(req, siso)
 int                                            req;            /* request: we handle only PRC_IFDOWN */
 struct sockaddr_iso            *siso;          /* address of ifp */
@@ -1061,4 +1081,4 @@ struct sockaddr_iso               *siso;          /* address of ifp */
                }
 }
 
                }
 }
 
-#endif ISO
+#endif /* ISO */