defs.h revision 1.9 1 1.9 cgd /* $NetBSD: defs.h,v 1.9 1995/03/18 15:00:26 cgd Exp $ */
2 1.9 cgd
3 1.1 cgd /*
4 1.6 mycroft * Copyright (c) 1983, 1988, 1993
5 1.6 mycroft * The Regents of the University of California. All rights reserved.
6 1.1 cgd *
7 1.1 cgd * Redistribution and use in source and binary forms, with or without
8 1.1 cgd * modification, are permitted provided that the following conditions
9 1.1 cgd * are met:
10 1.1 cgd * 1. Redistributions of source code must retain the above copyright
11 1.1 cgd * notice, this list of conditions and the following disclaimer.
12 1.1 cgd * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 cgd * notice, this list of conditions and the following disclaimer in the
14 1.1 cgd * documentation and/or other materials provided with the distribution.
15 1.1 cgd * 3. All advertising materials mentioning features or use of this software
16 1.1 cgd * must display the following acknowledgement:
17 1.1 cgd * This product includes software developed by the University of
18 1.1 cgd * California, Berkeley and its contributors.
19 1.1 cgd * 4. Neither the name of the University nor the names of its contributors
20 1.1 cgd * may be used to endorse or promote products derived from this software
21 1.1 cgd * without specific prior written permission.
22 1.1 cgd *
23 1.1 cgd * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 1.1 cgd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 1.1 cgd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 1.1 cgd * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 1.1 cgd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 1.1 cgd * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 1.1 cgd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 1.1 cgd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 1.1 cgd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 1.1 cgd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 1.1 cgd * SUCH DAMAGE.
34 1.1 cgd *
35 1.9 cgd * @(#)defs.h 8.1 (Berkeley) 6/5/93
36 1.1 cgd */
37 1.1 cgd
38 1.1 cgd /*
39 1.1 cgd * Internal data structure definitions for
40 1.1 cgd * user routing process. Based on Xerox NS
41 1.1 cgd * protocol specs with mods relevant to more
42 1.1 cgd * general addressing scheme.
43 1.1 cgd */
44 1.1 cgd #include <sys/param.h>
45 1.1 cgd #include <sys/socket.h>
46 1.1 cgd #include <sys/time.h>
47 1.1 cgd
48 1.1 cgd #include <net/route.h>
49 1.1 cgd #include <netinet/in.h>
50 1.1 cgd #include <protocols/routed.h>
51 1.8 cgd #include <arpa/inet.h>
52 1.1 cgd
53 1.8 cgd #include <netdb.h>
54 1.8 cgd #include <signal.h>
55 1.1 cgd #include <stdio.h>
56 1.8 cgd #include <stdlib.h>
57 1.8 cgd #include <string.h>
58 1.8 cgd #include <unistd.h>
59 1.1 cgd
60 1.1 cgd #include "trace.h"
61 1.1 cgd #include "interface.h"
62 1.1 cgd #include "table.h"
63 1.1 cgd #include "af.h"
64 1.1 cgd
65 1.1 cgd /*
66 1.1 cgd * When we find any interfaces marked down we rescan the
67 1.1 cgd * kernel every CHECK_INTERVAL seconds to see if they've
68 1.1 cgd * come up.
69 1.1 cgd */
70 1.1 cgd #define CHECK_INTERVAL (1*60)
71 1.1 cgd
72 1.1 cgd #define equal(a1, a2) \
73 1.7 mycroft (memcmp((a1), (a2), sizeof (struct sockaddr)) == 0)
74 1.1 cgd
75 1.1 cgd struct sockaddr_in addr; /* address of daemon's socket */
76 1.1 cgd
77 1.1 cgd int s; /* source and sink of all data */
78 1.6 mycroft int r; /* routing socket */
79 1.6 mycroft pid_t pid; /* process id for identifying messages */
80 1.6 mycroft uid_t uid; /* user id for identifying messages */
81 1.6 mycroft int seqno; /* sequence number for identifying messages */
82 1.1 cgd int kmem;
83 1.1 cgd int supplier; /* process should supply updates */
84 1.1 cgd int install; /* if 1 call kernel */
85 1.1 cgd int lookforinterfaces; /* if 1 probe kernel for new up interfaces */
86 1.6 mycroft int performnlist; /* if 1 check if /vmunix has changed */
87 1.1 cgd int externalinterfaces; /* # of remote and local interfaces */
88 1.1 cgd struct timeval now; /* current idea of time */
89 1.1 cgd struct timeval lastbcast; /* last time all/changes broadcast */
90 1.1 cgd struct timeval lastfullupdate; /* last time full table broadcast */
91 1.1 cgd struct timeval nextbcast; /* time to wait before changes broadcast */
92 1.1 cgd int needupdate; /* true if we need update at nextbcast */
93 1.1 cgd
94 1.1 cgd char packet[MAXPACKETSIZE+1];
95 1.1 cgd struct rip *msg;
96 1.1 cgd
97 1.1 cgd char **argv0;
98 1.1 cgd struct servent *sp;
99 1.1 cgd
100 1.1 cgd struct in_addr inet_makeaddr();
101 1.1 cgd int sndmsg();
102 1.1 cgd int supply();
103 1.6 mycroft
104 1.8 cgd void addrouteforif __P((struct interface *));
105 1.8 cgd void bumploglevel();
106 1.8 cgd void dumppacket __P((FILE *, char *, struct sockaddr_in *, char *,
107 1.8 cgd int, struct timeval *));
108 1.8 cgd void gwkludge();
109 1.8 cgd void hup();
110 1.8 cgd void ifinit();
111 1.8 cgd #ifdef notdef /* XXX FUNCTION UNUSED */
112 1.8 cgd u_long inet_lnaof_subnet __P((struct in_addr));
113 1.8 cgd #endif
114 1.8 cgd int inet_maskof __P((u_long));
115 1.8 cgd u_long inet_netof_subnet __P((struct in_addr));
116 1.8 cgd int inet_rtflags __P((struct sockaddr_in *));
117 1.8 cgd int inet_sendroute __P((struct rt_entry *, struct sockaddr_in *));
118 1.8 cgd void rip_input __P((struct sockaddr *, struct rip *, int));
119 1.8 cgd void rtadd __P((struct sockaddr *, struct sockaddr *, int, int));
120 1.8 cgd void rtchange __P((struct rt_entry *, struct sockaddr *, short));
121 1.8 cgd void rtdefault();
122 1.8 cgd void rtdelete __P((struct rt_entry *));
123 1.8 cgd void rtdeleteall __P((int));
124 1.8 cgd void rtinit();
125 1.8 cgd int rtioctl __P((int, struct rtuentry *));
126 1.8 cgd void sigtrace __P((int));
127 1.8 cgd int sndmsg __P((struct sockaddr *, int, struct interface *, int));
128 1.8 cgd void timer();
129 1.8 cgd void timevaladd __P((struct timeval *, struct timeval *));
130 1.8 cgd void toall __P((int (*)(), int, struct interface *));
131 1.8 cgd void traceoff();
132 1.8 cgd void traceon __P((char *));
133 1.8 cgd void trace __P((struct ifdebug *, struct sockaddr *, char *, int, int));
134 1.8 cgd void traceaction __P((FILE *, char *, struct rt_entry *));
135 1.8 cgd void traceinit __P((struct interface *));
136 1.8 cgd void tracenewmetric __P((FILE *, struct rt_entry *, int));
137 1.8 cgd
138 1.6 mycroft #define ADD 1
139 1.6 mycroft #define DELETE 2
140 1.6 mycroft #define CHANGE 3
141