BSD 4_3_Net_2 release
[unix-history] / usr / src / sys / netiso / clnp.h
index 2a326b5..2b4bc63 100644 (file)
@@ -1,3 +1,37 @@
+/*-
+ * 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.
+ *
+ *     @(#)clnp.h      7.8 (Berkeley) 5/6/91
+ */
 
 /***********************************************************
                Copyright IBM Corporation 1987
 
 /***********************************************************
                Copyright IBM Corporation 1987
@@ -27,7 +61,6 @@ SOFTWARE.
  */
 /* $Header: /var/src/sys/netiso/RCS/clnp.h,v 5.1 89/02/09 16:17:22 hagens Exp $ */
 /* $Source: /var/src/sys/netiso/RCS/clnp.h,v $ */
  */
 /* $Header: /var/src/sys/netiso/RCS/clnp.h,v 5.1 89/02/09 16:17:22 hagens Exp $ */
 /* $Source: /var/src/sys/netiso/RCS/clnp.h,v $ */
-/*     @(#)clnp.h      7.6 (Berkeley) 4/5/90 */
 
 #ifndef BYTE_ORDER
 /*
 
 #ifndef BYTE_ORDER
 /*
@@ -364,10 +397,11 @@ struct troll {
 };
 
 #define        SN_OUTPUT(clcp, m)\
 };
 
 #define        SN_OUTPUT(clcp, m)\
-       troll_output(clcp->clc_ifa->ia_ifp, m, clcp->clc_firsthop, clcp->clc_rt)
+       troll_output(clcp->clc_ifp, m, clcp->clc_firsthop, clcp->clc_rt)
 
 
-#define        SN_MTU(ifp)\
-       (ifp->if_mtu - trollctl.tr_mtu_adj)
+#define        SN_MTU(ifp, rt) (((rt && rt->rt_rmx.rmx_mtu) ?\
+       rt->rt_rmx.rmx_mtu : clnp_badmtu(ifp, rt, __LINE__, __FILE__))\
+               - trollctl.tr_mtu_adj)
 
 #ifdef KERNEL
 extern float troll_random;
 
 #ifdef KERNEL
 extern float troll_random;
@@ -376,10 +410,10 @@ extern float troll_random;
 #else  /* NO TROLL */
 
 #define        SN_OUTPUT(clcp, m)\
 #else  /* NO TROLL */
 
 #define        SN_OUTPUT(clcp, m)\
-       (*clcp->clc_ifa->ia_ifp->if_output)(clcp->clc_ifa->ia_ifp, m, clcp->clc_firsthop, clcp->clc_rt)
+       (*clcp->clc_ifp->if_output)(clcp->clc_ifp, m, clcp->clc_firsthop, clcp->clc_rt)
 
 
-#define        SN_MTU(ifp)\
-       (ifp->if_mtu)
+#define        SN_MTU(ifp, rt) (((rt && rt->rt_rmx.rmx_mtu) ?\
+       rt->rt_rmx.rmx_mtu : clnp_badmtu(ifp, rt, __LINE__, __FILE__)))
 
 #endif TROLL
 
 
 #endif TROLL
 
@@ -421,12 +455,11 @@ struct clnp_cache {
 
        /* these fields are state that clnp_output requires to finish the pkt */
        int                                     clc_segoff;             /* offset of seg part of header */
 
        /* these fields are state that clnp_output requires to finish the pkt */
        int                                     clc_segoff;             /* offset of seg part of header */
-       struct sockaddr         *clc_firsthop;  /* first hop of packet (points into
-                                                                                       the route structure) */
-       struct iso_ifaddr       *clc_ifa;               /* ptr to interface (points into
-                                                                                       the route structure) */
        struct rtentry          *clc_rt;                /* ptr to rtentry (points into
                                                                                        the route structure) */
        struct rtentry          *clc_rt;                /* ptr to rtentry (points into
                                                                                        the route structure) */
+       struct sockaddr         *clc_firsthop;  /* first hop of packet */
+       struct ifnet            *clc_ifp;               /* ptr to interface structure */
+       struct iso_ifaddr       *clc_ifa;               /* ptr to interface address */
        struct mbuf             *clc_hdr;               /* cached pkt hdr (finally)! */
 };
 
        struct mbuf             *clc_hdr;               /* cached pkt hdr (finally)! */
 };