add Berkeley specific headers
[unix-history] / usr / src / sbin / routed / defs.h
index 1c4dc0a..a737fed 100644 (file)
@@ -1,4 +1,16 @@
-/*     defs.h  4.10    82/06/10        */
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that this notice is preserved and that due credit is given
+ * to the University of California at Berkeley. The name of the University
+ * may not be used to endorse or promote products derived from this
+ * software without specific prior written permission. This software
+ * is provided ``as is'' without express or implied warranty.
+ *
+ *     @(#)defs.h      5.4 (Berkeley) %G%
+ */
 
 /*
  * Internal data structure definitions for
 
 /*
  * Internal data structure definitions for
  * protocol specs with mods relevant to more
  * general addressing scheme.
  */
  * protocol specs with mods relevant to more
  * general addressing scheme.
  */
+#include <sys/types.h>
+#include <sys/socket.h>
+
 #include <net/route.h>
 #include <net/route.h>
+#include <netinet/in.h>
+#include <protocols/routed.h>
 
 
-/*
- * An ``interface'' is similar to an ifnet structure,
- * except it doesn't contain q'ing info, and it also
- * handles ``logical'' interfaces (remote gateways
- * that we want to keep polling even if they go down).
- * The list of interfaces which we maintain is used
- * in supplying the gratuitous routing table updates.
- */
-struct interface {
-       struct  interface *int_next;
-       struct  sockaddr int_addr;              /* address on this host */
-       union {
-               struct  sockaddr intu_broadaddr;
-               struct  sockaddr intu_dstaddr;
-       } int_intu;
-#define        int_broadaddr   int_intu.intu_broadaddr /* broadcast address */
-#define        int_dstaddr     int_intu.intu_dstaddr   /* other end of p-to-p link */
-       int     int_metric;                     /* init's routing entry */
-       int     int_flags;                      /* see below */
-       int     int_net;                        /* network # */
-};
+#include <stdio.h>
+#include <netdb.h>
 
 
-/*
- * 0x1 to 0x10 are reused from the kernel's ifnet definitions,
- * the others agree with the RTS_ flags defined below
- */
-#define        IFF_UP          0x1             /* interface is up */
-#define        IFF_BROADCAST   0x2             /* broadcast address valid */
-#define        IFF_DEBUG       0x4             /* turn on debugging */
-#define        IFF_ROUTE       0x8             /* routing entry installed */
-#define        IFF_POINTOPOINT 0x10            /* interface is point-to-point link */
-#define        IFF_PASSIVE     0x20            /* can't tell if up/down */
-#define        IFF_INTERFACE   0x40            /* hardware interface */
-#define        IFF_REMOTE      0x80            /* interface isn't on this machine */
+#include "trace.h"
+#include "interface.h"
+#include "table.h"
+#include "af.h"
 
 /*
 
 /*
- * 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.
+ * When we find any interfaces marked down we rescan the
+ * kernel every CHECK_INTERVAL seconds to see if they've
+ * come up.
  */
  */
-struct rthash {
-       struct  rt_entry *rt_forw;
-       struct  rt_entry *rt_back;
-};
-
-struct rt_entry {
-       struct  rt_entry *rt_forw;
-       struct  rt_entry *rt_back;
-       union {
-               struct  rtentry rtu_rt;
-               struct {
-                       u_long  rtu_hash;
-                       struct  sockaddr rtu_dst;
-                       struct  sockaddr rtu_router;
-                       short   rtu_flags;
-                       short   rtu_state;
-                       int     rtu_timer;
-                       int     rtu_metric;
-                       struct  interface *rtu_ifp;
-               } rtu_entry;
-       } rt_rtu;
-};
+#define        CHECK_INTERVAL  (1*60)
 
 
-#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_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_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 equal(a1, a2) \
+       (bcmp((caddr_t)(a1), (caddr_t)(a2), sizeof (struct sockaddr)) == 0)
+#define        min(a,b)        ((a)>(b)?(b):(a))
 
 
-#define        ROUTEHASHSIZ    19
+struct sockaddr_in addr;       /* address of daemon's socket */
 
 
-/*
- * "State" of routing table entry.
- */
-#define        RTS_CHANGED     0x1             /* route has been altered recently */
-#define        RTS_PASSIVE     0x20            /* don't time out route */
-#define        RTS_INTERFACE   0x40            /* route is for network interface */
-#define        RTS_REMOTE      0x80            /* route is for ``remote'' entity */
+int    s;                      /* source and sink of all data */
+int    kmem;
+int    supplier;               /* process should supply updates */
+int    install;                /* if 1 call kernel */
+int    lookforinterfaces;      /* if 1 probe kernel for new up interfaces */
+int    performnlist;           /* if 1 check if /vmunix has changed */
+int    externalinterfaces;     /* # of remote and local interfaces */
+int    timeval;                /* local idea of time */
 
 
-struct rthash nethash[ROUTEHASHSIZ], hosthash[ROUTEHASHSIZ];
-struct rt_entry *rtlookup(), *rtfind();
+char   packet[MAXPACKETSIZE+1];
+struct rip *msg;
 
 
-/*
- * Per address family routines.
- */
-struct afswitch {
-       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 {
-       u_int   afh_hosthash;           /* host based hash */
-       u_int   afh_nethash;            /* network based hash */
-};
+char   **argv0;
+struct servent *sp;
 
 
-struct afswitch afswitch[AF_MAX];      /* table proper */
+extern char *sys_errlist[];
+extern int errno;
 
 
-/*
- * When we find any interfaces marked down we rescan the
- * kernel every CHECK_INTERVAL seconds to see if they've
- * come up.
- */
-#define        CHECK_INTERVAL  (1*60)
+struct in_addr inet_makeaddr();
+int    inet_addr();
+char   *malloc();
+int    exit();
+int    sendmsg();
+int    supply();
+int    timer();
+int    cleanup();