defs.h revision 27244
111820Sjulian/* 211820Sjulian * Copyright (c) 1983, 1993 311820Sjulian * The Regents of the University of California. All rights reserved. 411820Sjulian * 511820Sjulian * Copyright (c) 1995 John Hay. All rights reserved. 611820Sjulian * 711820Sjulian * Redistribution and use in source and binary forms, with or without 811820Sjulian * modification, are permitted provided that the following conditions 911820Sjulian * are met: 1011820Sjulian * 1. Redistributions of source code must retain the above copyright 1111820Sjulian * notice, this list of conditions and the following disclaimer. 1211820Sjulian * 2. Redistributions in binary form must reproduce the above copyright 1311820Sjulian * notice, this list of conditions and the following disclaimer in the 1411820Sjulian * documentation and/or other materials provided with the distribution. 1511820Sjulian * 3. All advertising materials mentioning features or use of this software 1611820Sjulian * must display the following acknowledgement: 1711820Sjulian * This product includes software developed by the University of 1811820Sjulian * California, Berkeley and its contributors. 1911820Sjulian * 4. Neither the name of the University nor the names of its contributors 2011820Sjulian * may be used to endorse or promote products derived from this software 2111820Sjulian * without specific prior written permission. 2211820Sjulian * 2311820Sjulian * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2411820Sjulian * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2511820Sjulian * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2611820Sjulian * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2711820Sjulian * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2811820Sjulian * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2911820Sjulian * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3011820Sjulian * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3111820Sjulian * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3211820Sjulian * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3311820Sjulian * SUCH DAMAGE. 3411820Sjulian * 3511820Sjulian * @(#)defs.h 8.1 (Berkeley) 6/5/93 3611820Sjulian * 3727244Sjhay * $Id: defs.h,v 1.5 1997/02/22 16:00:55 peter Exp $ 3811820Sjulian */ 3911820Sjulian 4011820Sjulian#include <sys/types.h> 4111820Sjulian#include <sys/socket.h> 4211820Sjulian 4311820Sjulian#include <net/route.h> 4411820Sjulian#include <netipx/ipx.h> 4511820Sjulian#if defined(vax) || defined(pdp11) 4611820Sjulian#define xnnet(x) ((u_long) (x)->rip_dst[1] << 16 | (u_long) (x)->rip_dst[0] ) 4711820Sjulian#else 4811820Sjulian#define xnnet(x) ((u_long) (x)->rip_dst[0] << 16 | (u_long) (x)->rip_dst[1] ) 4911820Sjulian#endif 5011820Sjulian 5111820Sjulian#include <stdio.h> 5211820Sjulian#include <string.h> 5311820Sjulian#include <syslog.h> 5411820Sjulian 5511820Sjulian#include "protocol.h" 5611820Sjulian#include "sap.h" 5711820Sjulian#include "table.h" 5811820Sjulian#include "trace.h" 5911820Sjulian#include "interface.h" 6011820Sjulian#include "af.h" 6111820Sjulian 6211820Sjulian 6311820Sjulian/* 6411820Sjulian * When we find any interfaces marked down we rescan the 6511820Sjulian * kernel every CHECK_INTERVAL seconds to see if they've 6611820Sjulian * come up. 6711820Sjulian */ 6811820Sjulian#define CHECK_INTERVAL (5*60) 6911820Sjulian 7011820Sjulian#define equal(a1, a2) \ 7111820Sjulian (bcmp((caddr_t)(a1), (caddr_t)(a2), sizeof (struct sockaddr)) == 0) 7211820Sjulian#define min(a,b) ((a)>(b)?(b):(a)) 7311820Sjulian#define max(a,b) ((a)<(b)?(b):(a)) 7411820Sjulian 7511820Sjulianextern int ripsock; /* Socket to listen on */ 7611820Sjulianextern int sapsock; /* Socket to listen on */ 7711820Sjulianextern int kmem; 7811820Sjulianextern int supplier; /* process should supply updates */ 7911820Sjulianextern int dosap; /* SAP is enabled */ 8011820Sjulianextern int install; /* if 1 call kernel */ 8111820Sjulianextern int lookforinterfaces; /* if 1 probe kernel for new up ifs */ 8211820Sjulianextern int performnlist; /* if 1 check if /kernel has changed */ 8311820Sjulianextern int externalinterfaces; /* # of remote and local interfaces */ 8411820Sjulianextern int timeval; /* local idea of time */ 8511820Sjulianextern int noteremoterequests; /* squawk on requests from non-local nets */ 8611820Sjulianextern int r; /* Routing socket to install updates with */ 8711820Sjulianextern int gateway; 8811820Sjulianextern struct sockaddr_ipx ipx_netmask; /* Used in installing routes */ 8911820Sjulian 9015248Sjhayextern char packet[MAXRXPACKETSIZE+1]; 9111820Sjulianextern struct rip *msg; 9211820Sjulian 9311820Sjulianextern char **argv0; 9411820Sjulian 9511820Sjulian#define ADD 1 9611820Sjulian#define DELETE 2 9711820Sjulian#define CHANGE 3 9811820Sjulian 9927244Sjhayvoid sndmsg(struct sockaddr *, int, struct interface *, int); 10027244Sjhayvoid supply(struct sockaddr *, int, struct interface *, int); 10111820Sjulianvoid addrouteforif(struct interface *); 10211820Sjulianvoid ifinit(void); 10327244Sjhayvoid toall(void (*f)(struct sockaddr *, int, struct interface *, int), 10427244Sjhay struct rt_entry *, int); 10511820Sjulianvoid rip_input(struct sockaddr *, int); 10611820Sjulian 107