BSD 4_3_Net_2 release
[unix-history] / usr / src / sys / netiso / tp_pcb.c
index 7c1ec9d..6c9d309 100644 (file)
@@ -1,3 +1,38 @@
+/*-
+ * Copyright (c) 1991 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)tp_pcb.c    7.11 (Berkeley) 5/6/91
+ */
+
 /***********************************************************
                                Copyright IBM Corporation 1987
 
 /***********************************************************
                                Copyright IBM Corporation 1987
 
@@ -29,7 +64,6 @@ SOFTWARE.
  *
  * $Header: tp_pcb.c,v 5.4 88/11/18 17:28:24 nhall Exp $
  * $Source: /usr/argo/sys/netiso/RCS/tp_pcb.c,v $
  *
  * $Header: tp_pcb.c,v 5.4 88/11/18 17:28:24 nhall Exp $
  * $Source: /usr/argo/sys/netiso/RCS/tp_pcb.c,v $
- *     @(#)tp_pcb.c    7.8 (Berkeley) %G% *
  *
  *
  * This is the initialization and cleanup stuff - 
  *
  *
  * This is the initialization and cleanup stuff - 
@@ -44,10 +78,6 @@ SOFTWARE.
  *
  */
 
  *
  */
 
-#ifndef lint
-static char *rcsid = "$Header: tp_pcb.c,v 5.4 88/11/18 17:28:24 nhall Exp $";
-#endif lint
-
 #include "types.h"
 #include "param.h"
 #include "mbuf.h"
 #include "types.h"
 #include "param.h"
 #include "mbuf.h"
@@ -68,9 +98,6 @@ static char *rcsid = "$Header: tp_pcb.c,v 5.4 88/11/18 17:28:24 nhall Exp $";
 #include "tp_seq.h"
 #include "tp_clnp.h"
 
 #include "tp_seq.h"
 #include "tp_clnp.h"
 
-/* list of reference structures */
-struct tp_ref tp_ref[N_TPREF];
-
 struct tp_param tp_param = {
        1,                              /*  configured          */
 };
 struct tp_param tp_param = {
        1,                              /*  configured          */
 };
@@ -268,9 +295,9 @@ int         iso_cmpnetaddr();
 int    iso_putsufx(); 
 int    iso_getsufx(); 
 int    iso_recycle_tsuffix(); 
 int    iso_putsufx(); 
 int    iso_getsufx(); 
 int    iso_recycle_tsuffix(); 
-int            tpcons_mtu(); 
 int            iso_pcbbind(); 
 int            tpcons_pcbconnect(); 
 int            iso_pcbbind(); 
 int            tpcons_pcbconnect(); 
+int            tpclnp_mtu();
 int            iso_pcbdisconnect(); 
 int    iso_pcbdetach(); 
 int    iso_pcballoc(); 
 int            iso_pcbdisconnect(); 
 int    iso_pcbdetach(); 
 int    iso_pcballoc(); 
@@ -313,7 +340,7 @@ struct nl_protosw nl_protosw[] = {
        { AF_ISO, iso_putnetaddr, iso_getnetaddr, iso_cmpnetaddr,
                iso_putsufx, iso_getsufx,
                iso_recycle_tsuffix,
        { AF_ISO, iso_putnetaddr, iso_getnetaddr, iso_cmpnetaddr,
                iso_putsufx, iso_getsufx,
                iso_recycle_tsuffix,
-               tpcons_mtu, iso_pcbbind, tpcons_pcbconnect,
+               tpclnp_mtu, iso_pcbbind, tpcons_pcbconnect,
                iso_pcbdisconnect,      iso_pcbdetach,
                iso_pcballoc,
                tpcons_output, tpcons_output, iso_nlctloutput,
                iso_pcbdisconnect,      iso_pcbdetach,
                iso_pcballoc,
                tpcons_output, tpcons_output, iso_nlctloutput,
@@ -524,18 +551,13 @@ static RefNum
 tp_getref(tpcb) 
        register struct tp_pcb *tpcb;
 {
 tp_getref(tpcb) 
        register struct tp_pcb *tpcb;
 {
-       register struct tp_ref  *r = tp_ref; 
+       register struct tp_ref  *r = tp_ref; /* tp_ref[0] is never used */
        register int                    i=1;
 
        register int                    i=1;
 
-       r++; /* tp_ref[0] is never used */
 
 
-       /* REF_FREE is zero */
-       while( r->tpr_state ) {
-               r++; 
-               if ( i == N_TPREF ) {
+       while ((++r)->tpr_state != REF_FREE) {
+               if (++i == N_TPREF)
                        return TP_ENOREF;
                        return TP_ENOREF;
-               }
-               i++;
        }
        r->tpr_state = REF_OPENING;
        if (tp_maxrefopen < i) 
        }
        r->tpr_state = REF_OPENING;
        if (tp_maxrefopen < i)