defs.h revision 15248
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 * $Id: defs.h,v 1.2 1995/10/27 10:48:25 julian Exp $ 38 */ 39 40#include <sys/types.h> 41#include <sys/socket.h> 42 43#include <net/route.h> 44#include <netipx/ipx.h> 45#if defined(vax) || defined(pdp11) 46#define xnnet(x) ((u_long) (x)->rip_dst[1] << 16 | (u_long) (x)->rip_dst[0] ) 47#else 48#define xnnet(x) ((u_long) (x)->rip_dst[0] << 16 | (u_long) (x)->rip_dst[1] ) 49#endif 50 51#include <stdio.h> 52#include <string.h> 53#include <syslog.h> 54 55#include "protocol.h" 56#include "sap.h" 57#include "table.h" 58#include "trace.h" 59#include "interface.h" 60#include "af.h" 61 62 63/* 64 * When we find any interfaces marked down we rescan the 65 * kernel every CHECK_INTERVAL seconds to see if they've 66 * come up. 67 */ 68#define CHECK_INTERVAL (5*60) 69 70#define equal(a1, a2) \ 71 (bcmp((caddr_t)(a1), (caddr_t)(a2), sizeof (struct sockaddr)) == 0) 72#define min(a,b) ((a)>(b)?(b):(a)) 73#define max(a,b) ((a)<(b)?(b):(a)) 74 75extern int ripsock; /* Socket to listen on */ 76extern int sapsock; /* Socket to listen on */ 77extern int kmem; 78extern int supplier; /* process should supply updates */ 79extern int dosap; /* SAP is enabled */ 80extern int install; /* if 1 call kernel */ 81extern int lookforinterfaces; /* if 1 probe kernel for new up ifs */ 82extern int performnlist; /* if 1 check if /kernel has changed */ 83extern int externalinterfaces; /* # of remote and local interfaces */ 84extern int timeval; /* local idea of time */ 85extern int noteremoterequests; /* squawk on requests from non-local nets */ 86extern int r; /* Routing socket to install updates with */ 87extern int gateway; 88extern struct sockaddr_ipx ipx_netmask; /* Used in installing routes */ 89 90extern char packet[MAXRXPACKETSIZE+1]; 91extern struct rip *msg; 92 93extern char **argv0; 94 95#define ADD 1 96#define DELETE 2 97#define CHANGE 3 98 99void sndmsg(struct sockaddr *, int, struct interface *); 100void supply(struct sockaddr *, int, struct interface *); 101void addrouteforif(struct interface *); 102void ifinit(void); 103void toall(void (*f)(struct sockaddr *, int, struct interface *), 104 struct rt_entry *); 105void rip_input(struct sockaddr *, int); 106 107