reorganization to move ufsmount ops to be vnode ops;
[unix-history] / usr / src / sys / netiso / tp_iso.c
index 4a5ea5d..8794954 100644 (file)
@@ -1,3 +1,12 @@
+/*-
+ * Copyright (c) 1991 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * %sccs.include.redist.c%
+ *
+ *     @(#)tp_iso.c    7.13 (Berkeley) %G%
+ */
+
 /***********************************************************
                Copyright IBM Corporation 1987
 
 /***********************************************************
                Copyright IBM Corporation 1987
 
@@ -28,7 +37,6 @@ SOFTWARE.
  * ARGO TP
  * $Header: /var/src/sys/netiso/RCS/tp_iso.c,v 5.1 89/02/09 16:20:51 hagens Exp $
  * $Source: /var/src/sys/netiso/RCS/tp_iso.c,v $
  * ARGO TP
  * $Header: /var/src/sys/netiso/RCS/tp_iso.c,v 5.1 89/02/09 16:20:51 hagens Exp $
  * $Source: /var/src/sys/netiso/RCS/tp_iso.c,v $
- *     @(#)tp_iso.c    7.8 (Berkeley) %G%
  *
  * Here is where you find the iso-dependent code.  We've tried
  * keep all net-level and (primarily) address-family-dependent stuff
  *
  * Here is where you find the iso-dependent code.  We've tried
  * keep all net-level and (primarily) address-family-dependent stuff
@@ -50,10 +58,6 @@ SOFTWARE.
  *             tpclnp_output: package a pkt for clnp given an isopcb & some data
  */
 
  *             tpclnp_output: package a pkt for clnp given an isopcb & some data
  */
 
-#ifndef lint
-static char *rcsid = "$Header: /var/src/sys/netiso/RCS/tp_iso.c,v 5.1 89/02/09 16:20:51 hagens Exp $";
-#endif lint
-
 #ifdef ISO
 
 #include "param.h"
 #ifdef ISO
 
 #include "param.h"
@@ -283,103 +287,41 @@ iso_getnetaddr( isop, name, which)
        else
                name->m_len = 0;
 }
        else
                name->m_len = 0;
 }
-
 /*
 /*
+ * NAME:       tpclnp_mtu()
+ *
  * CALLED FROM:
  * CALLED FROM:
- *  tp_input() on incoming CR, CC, and pr_usrreq() for PRU_CONNECT
- * FUNCTION, ARGUMENTS, SIDE EFFECTS and RETURN VALUE:
- * Determine the proper maximum transmission unit, i.e., MTU, to use, given
- * a) the header size for the network protocol and the max transmission
- *       unit on the subnet interface, determined from the information in (isop),
- * b) the max size negotiated so far (negot)
- * c) the window size used by the tp connection (found in so),
+ *  tp_route_to() on incoming CR, CC, and pr_usrreq() for PRU_CONNECT
  *
  *
- * The result is put in the integer *size in its integer form and in
- * *negot in its logarithmic form.  
+ * FUNCTION, ARGUMENTS, and RETURN VALUE:
+ *
+ * Perform subnetwork dependent part of determining MTU information.
+ * It appears that setting a double pointer to the rtentry associated with
+ * the destination, and returning the header size for the network protocol
+ * suffices.
  * 
  * 
- * The rules are:
- * a) can only negotiate down from the value found in *negot.
- * b) the MTU must be < the windowsize,
- * c) If src and dest are on the same net,
- *       we will negotiate the closest size larger than  MTU but really USE 
- *    the actual device mtu - ll hdr sizes.
- *   otherwise we negotiate the closest size smaller than MTU - ll hdr sizes.
+ * SIDE EFFECTS:
+ * Sets tp_routep pointer in pcb.
+ *
+ * NOTES:
  */
  */
-
-void
-tpclnp_mtu(so, isop, size, negot )
-       struct socket *so;
-       struct isopcb *isop;
-       int *size;
-       u_char *negot;
+tpclnp_mtu(tpcb)
+register struct tp_pcb *tpcb;
 {
 {
-       struct ifnet *ifp = 0;
-       struct iso_ifaddr *ia = 0;
-       register int i;
-       int windowsize = so->so_rcv.sb_hiwat;
-       int clnp_size;
-       int sizeismtu = 0;
-       register struct rtentry *rt = isop->isop_route.ro_rt;
+       struct isopcb                   *isop = (struct isopcb *)tpcb->tp_npcb;
 
        IFDEBUG(D_CONN)
 
        IFDEBUG(D_CONN)
-               printf("tpclnp_mtu(0x%x,0x%x,0x%x,0x%x)\n", so, isop, size, negot);
+               printf("tpclnp_mtu(tpcb)\n", tpcb);
        ENDDEBUG
        ENDDEBUG
-       IFTRACE(D_CONN)
-               tptrace(TPPTmisc, "ENTER GET MTU: size negot \n",*size, *negot, 0, 0);
-       ENDTRACE
-
-       *size = 1 << *negot;
-
-       if( *size > windowsize ) {
-               *size = windowsize;
-       }
-
-       if (rt == 0 || (rt->rt_flags & RTF_UP == 0) ||
-               (ia = (struct iso_ifaddr *)rt->rt_ifa) == 0 ||
-           (ifp = ia->ia_ifp) == 0) {
-               IFDEBUG(D_CONN)
-                       printf("tpclnp_mtu routing abort rt=0x%x ia=0x%x ifp=0x%x\n",
-                                       rt, ia, ifp)
-               ENDDEBUG
-               return;
-       }
-
-       /* TODO - make this indirect off the socket structure to the
-        * network layer to get headersize
-        */
-       if (isop->isop_laddr)
-               clnp_size = clnp_hdrsize(isop->isop_laddr->siso_addr.isoa_len);
+       tpcb->tp_routep = &(isop->isop_route.ro_rt);
+       if (tpcb->tp_netservice == ISO_CONS)
+               return 0;
        else
        else
-               clnp_size = 20;
+               return (sizeof(struct clnp_fixed) + sizeof(struct clnp_segment) +
+                       2 * sizeof(struct iso_addr));
 
 
-       if(*size > ifp->if_mtu - clnp_size) {
-               *size = ifp->if_mtu - clnp_size;
-               sizeismtu = 1;
-       }
-       /* have to transform size to the log2 of size */
-       for(i=TP_MIN_TPDUSIZE; (i<TP_MAX_TPDUSIZE && ((1<<i) <= *size)) ; i++)
-               ;
-       i--;
-
-       IFTRACE(D_CONN)
-               tptrace(TPPTmisc, "GET MTU MID: tpcb size negot i \n",
-               *size, *negot, i, 0);
-       ENDTRACE
-
-       *size = 1<<i;
-       *negot = i;
-
-       IFDEBUG(D_CONN)
-               printf("GET MTU RETURNS: ifp %s size 0x%x negot 0x%x\n",
-               ifp->if_name,   *size, *negot);
-       ENDDEBUG
-       IFTRACE(D_CONN)
-               tptrace(TPPTmisc, "EXIT GET MTU: tpcb size negot \n",
-               *size, *negot, 0, 0);
-       ENDTRACE
 }
 
 }
 
-
 /*
  * CALLED FROM:
  *  tp_emit()
 /*
  * CALLED FROM:
  *  tp_emit()
@@ -387,7 +329,7 @@ tpclnp_mtu(so, isop, size, negot )
  *  Take a packet(m0) from tp and package it so that clnp will accept it.
  *  This means prepending space for the clnp header and filling in a few
  *  of the fields.
  *  Take a packet(m0) from tp and package it so that clnp will accept it.
  *  This means prepending space for the clnp header and filling in a few
  *  of the fields.
- *  inp is the isopcb structure; datalen is the length of the data in the
+ *  isop is the isopcb structure; datalen is the length of the data in the
  *  mbuf string m0.
  * RETURN VALUE:
  *  whatever (E*) is returned form the net layer output routine.
  *  mbuf string m0.
  * RETURN VALUE:
  *  whatever (E*) is returned form the net layer output routine.
@@ -572,7 +514,7 @@ void
 tpiso_decbit(isop)
        struct isopcb *isop;
 {
 tpiso_decbit(isop)
        struct isopcb *isop;
 {
-       tp_quench((struct tp_pcb *)isop->isop_socket->so_tpcb, PRC_QUENCH2);
+       tp_quench((struct tp_pcb *)isop->isop_socket->so_pcb, PRC_QUENCH2);
 }
 /*
  * CALLED FROM:
 }
 /*
  * CALLED FROM:
@@ -584,7 +526,7 @@ void
 tpiso_quench(isop)
        struct isopcb *isop;
 {
 tpiso_quench(isop)
        struct isopcb *isop;
 {
-       tp_quench((struct tp_pcb *)isop->isop_socket->so_tpcb, PRC_QUENCH);
+       tp_quench((struct tp_pcb *)isop->isop_socket->so_pcb, PRC_QUENCH);
 }
 
 /*
 }
 
 /*
@@ -699,7 +641,7 @@ tpiso_abort(isop)
        ENDDEBUG
        e.ev_number = ER_TPDU;
        e.ATTR(ER_TPDU).e_reason = ECONNABORTED;
        ENDDEBUG
        e.ev_number = ER_TPDU;
        e.ATTR(ER_TPDU).e_reason = ECONNABORTED;
-       return  tp_driver((struct tp_pcb *)isop->isop_socket->so_tpcb, &e);
+       return  tp_driver((struct tp_pcb *)isop->isop_socket->so_pcb, &e);
 }
 
 ProtoHook
 }
 
 ProtoHook
@@ -709,7 +651,7 @@ tpiso_reset(isop)
        struct tp_event e;
 
        e.ev_number = T_NETRESET;
        struct tp_event e;
 
        e.ev_number = T_NETRESET;
-       return tp_driver((struct tp_pcb *)isop->isop_socket->so_tpcb, &e);
+       return tp_driver((struct tp_pcb *)isop->isop_socket->so_pcb, &e);
 
 }
 
 
 }