wnj changes
[unix-history] / usr / src / sbin / routed / defs.h
index ac888e4..220b57d 100644 (file)
@@ -1,4 +1,4 @@
-/*     defs.h  4.2     82/05/25        */
+/*     defs.h  4.8     82/06/09        */
 
 /*
  * Internal data structure definitions for
 
 /*
  * Internal data structure definitions for
@@ -9,8 +9,10 @@
 #include <net/route.h>
 
 /*
 #include <net/route.h>
 
 /*
- * Internal routing table structure.
- * Differs a bit from kernel tables.
+ * Routing table structure; differs a bit from kernel tables.
+ *
+ * Note: the union below must agree in the first 4 members
+ * so the ioctl's will work.
  */
 struct rthash {
        struct  rt_entry *rt_forw;
  */
 struct rthash {
        struct  rt_entry *rt_forw;
@@ -25,12 +27,13 @@ struct rt_entry {
                struct {
                        u_long  rtu_hash;
                        struct  sockaddr rtu_dst;
                struct {
                        u_long  rtu_hash;
                        struct  sockaddr rtu_dst;
-                       struct  sockaddr rtu_gateway;
+                       struct  sockaddr rtu_router;
                        short   rtu_flags;
                        short   rtu_flags;
-                       short   rtu_retry;
+                       short   rtu_state;
                        int     rtu_timer;
                        int     rtu_metric;
                        struct  ifnet *rtu_ifp;
                        int     rtu_timer;
                        int     rtu_metric;
                        struct  ifnet *rtu_ifp;
+                       struct  sockaddr rtu_newrouter;
                } rtu_entry;
        } rt_rtu;
 };
                } rtu_entry;
        } rt_rtu;
 };
@@ -38,49 +41,48 @@ struct rt_entry {
 #define        rt_rt           rt_rtu.rtu_rt                   /* pass to ioctl */
 #define        rt_hash         rt_rtu.rtu_entry.rtu_hash       /* for net or host */
 #define        rt_dst          rt_rtu.rtu_entry.rtu_dst        /* match value */
 #define        rt_rt           rt_rtu.rtu_rt                   /* pass to ioctl */
 #define        rt_hash         rt_rtu.rtu_entry.rtu_hash       /* for net or host */
 #define        rt_dst          rt_rtu.rtu_entry.rtu_dst        /* match value */
-#define        rt_gateway      rt_rtu.rtu_entry.rtu_gateway    /* who to forward to */
-#define        rt_flags        rt_rtu.rtu_entry.rtu_flags      /* see below */
-#define        rt_retry        rt_rtu.rtu_entry.rtu_retry      /* retries of ioctl */
+#define        rt_router       rt_rtu.rtu_entry.rtu_router     /* who to forward to */
+#define        rt_flags        rt_rtu.rtu_entry.rtu_flags      /* kernel flags */
 #define        rt_timer        rt_rtu.rtu_entry.rtu_timer      /* for invalidation */
 #define        rt_timer        rt_rtu.rtu_entry.rtu_timer      /* for invalidation */
+#define        rt_state        rt_rtu.rtu_entry.rtu_state      /* see below */
 #define        rt_metric       rt_rtu.rtu_entry.rtu_metric     /* cost of route */
 #define        rt_ifp          rt_rtu.rtu_entry.rtu_ifp        /* interface to take */
 #define        rt_metric       rt_rtu.rtu_entry.rtu_metric     /* cost of route */
 #define        rt_ifp          rt_rtu.rtu_entry.rtu_ifp        /* interface to take */
+#define        rt_newrouter    rt_rtu.rtu_entry.rtu_newrouter  /* for change's */
 
 #define        ROUTEHASHSIZ    19
 
 /*
 
 #define        ROUTEHASHSIZ    19
 
 /*
- * Flags used by routing process are not
- * interpreted by kernel.
+ * "State" of routing table entry.
  */
  */
-#define        RTF_DELRT       0x8             /* delete pending */
-#define        RTF_CHGRT       0x10            /* change command pending */
-#define        RTF_ADDRT       0x20            /* add command pending */
-#define        RTF_SILENT      0x40            /* don't send to router */
+#define        RTS_DELRT       0x1             /* delete pending */
+#define        RTS_CHGRT       0x2             /* change command pending */
+#define        RTS_ADDRT       0x4             /* add command pending */
+#define        RTS_PASSIVE     0x8             /* don't send to router */
+#define        RTS_INTERFACE   0x10            /* route is for an interface */
+#define        RTS_GLOBAL      0x20            /* entry is non-local, don't lose it */
 
 struct rthash nethash[ROUTEHASHSIZ], hosthash[ROUTEHASHSIZ];
 
 struct rthash nethash[ROUTEHASHSIZ], hosthash[ROUTEHASHSIZ];
-struct rt_entry *rtlookup();
+struct rt_entry *rtlookup(), *rtfind();
 
 /*
 
 /*
- * Per address family routines.  Hash returns hash key based
- * on address; netmatch verifies net # matching, output interprets
- * an address in preparation for sending; portmatch interprets
- * an address in verifying incoming packets were sent from the
- * appropriate port; checkhost is used to decide whether an
- * address is for a host, or for a network (e.g. broadcast);
- * canon purges any extraneous stuff from a sender's address
- * before pattern matching is performed (e.g. Internet ports).
+ * Per address family routines.
  */
 struct afswitch {
  */
 struct afswitch {
-       int     (*af_hash)();
-       int     (*af_netmatch)();
-       int     (*af_output)();
-       int     (*af_portmatch)();
-       int     (*af_checkhost)();
-       int     (*af_canon)();
+       int     (*af_hash)();           /* returns keys based on address */
+       int     (*af_netmatch)();       /* verifies net # matching */
+       int     (*af_output)();         /* interprets address for sending */
+       int     (*af_portmatch)();      /* packet from some other router? */
+       int     (*af_portcheck)();      /* packet from priviledged peer? */
+       int     (*af_checkhost)();      /* tells if address for host or net */
+       int     (*af_canon)();          /* canonicalize address for compares */
 };
 
 };
 
+/*
+ * Structure returned by af_hash routines.
+ */
 struct afhash {
 struct afhash {
-       u_int   afh_hosthash;
-       u_int   afh_nethash;
+       u_int   afh_hosthash;           /* host based hash */
+       u_int   afh_nethash;            /* network based hash */
 };
 
 };
 
-struct afswitch afswitch[AF_MAX];
+struct afswitch afswitch[AF_MAX];      /* table proper */