Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / usr.sbin / IPXrouted / defs.h
1 /*
2  * Copyright (c) 1983, 1993
3  *      The Regents of the University of California.  All rights reserved.
4  *
5  * Copyright (c) 1995 John Hay.  All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. All advertising materials mentioning features or use of this software
16  *    must display the following acknowledgement:
17  *      This product includes software developed by the University of
18  *      California, Berkeley and its contributors.
19  * 4. Neither the name of the University nor the names of its contributors
20  *    may be used to endorse or promote products derived from this software
21  *    without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33  * SUCH DAMAGE.
34  *
35  *      @(#)defs.h      8.1 (Berkeley) 6/5/93
36  *
37  * $FreeBSD: src/usr.sbin/IPXrouted/defs.h,v 1.8 1999/08/28 01:15:01 peter Exp $
38  * $DragonFly: src/usr.sbin/IPXrouted/defs.h,v 1.2 2003/06/17 04:29:52 dillon Exp $
39  */
40
41 #include <sys/types.h>
42 #include <sys/socket.h>
43
44 #include <net/route.h>
45 #include <netipx/ipx.h>
46 #if defined(vax) || defined(pdp11)
47 #define xnnet(x) ((u_long) (x)->rip_dst[1] << 16 | (u_long) (x)->rip_dst[0] )
48 #else
49 #define xnnet(x) ((u_long) (x)->rip_dst[0] << 16 | (u_long) (x)->rip_dst[1] )
50 #endif
51
52 #include <stdio.h>
53 #include <string.h>
54 #include <syslog.h>
55
56 #include "protocol.h"
57 #include "sap.h"
58 #include "table.h"
59 #include "trace.h"
60 #include "interface.h"
61 #include "af.h"
62
63
64 /*
65  * When we find any interfaces marked down we rescan the
66  * kernel every CHECK_INTERVAL seconds to see if they've
67  * come up.
68  */
69 #define CHECK_INTERVAL  (5*60)
70
71 #define equal(a1, a2) \
72         (bcmp((caddr_t)(a1), (caddr_t)(a2), sizeof (struct sockaddr)) == 0)
73 #define min(a,b)        ((a)>(b)?(b):(a))
74 #define max(a,b)        ((a)<(b)?(b):(a))
75
76 extern int      ripsock;                /* Socket to listen on */
77 extern int      sapsock;                /* Socket to listen on */
78 extern int      kmem;
79 extern int      supplier;               /* process should supply updates */
80 extern int      dosap;                  /* SAP is enabled */
81 extern int      dognreply;              /* enable GET_NEAREST response */
82 extern int      install;                /* if 1 call kernel */
83 extern int      lookforinterfaces;      /* if 1 probe kernel for new up ifs */
84 extern int      performnlist;           /* if 1 check if /kernel has changed */
85 extern int      externalinterfaces;     /* # of remote and local interfaces */
86 extern int      timeval;                /* local idea of time */
87 extern int      noteremoterequests;     /* squawk on requests from non-local nets */
88 extern int      r;                      /* Routing socket to install updates with */
89 extern int gateway;
90 extern struct   sockaddr_ipx ipx_netmask;       /* Used in installing routes */
91
92 extern char     packet[MAXRXPACKETSIZE+1];
93 extern struct   rip *msg;
94
95 extern char     **argv0;
96
97 #define ADD     1
98 #define DELETE  2
99 #define CHANGE  3
100
101 void    sndmsg(struct sockaddr *, int, struct interface *, int);
102 void    supply(struct sockaddr *, int, struct interface *, int);
103 void    addrouteforif(struct interface *);
104 void    ifinit(void);
105 void    toall(void (*f)(struct sockaddr *, int, struct interface *, int),
106               struct rt_entry *, int);
107 void    rip_input(struct sockaddr *, int);
108