defs.h revision 11820
11590Srgrimes/* 21590Srgrimes * Copyright (c) 1983, 1993 31590Srgrimes * The Regents of the University of California. All rights reserved. 41590Srgrimes * 51590Srgrimes * Copyright (c) 1995 John Hay. All rights reserved. 61590Srgrimes * 71590Srgrimes * Redistribution and use in source and binary forms, with or without 81590Srgrimes * modification, are permitted provided that the following conditions 91590Srgrimes * are met: 101590Srgrimes * 1. Redistributions of source code must retain the above copyright 111590Srgrimes * notice, this list of conditions and the following disclaimer. 121590Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 131590Srgrimes * notice, this list of conditions and the following disclaimer in the 141590Srgrimes * documentation and/or other materials provided with the distribution. 151590Srgrimes * 3. All advertising materials mentioning features or use of this software 161590Srgrimes * must display the following acknowledgement: 171590Srgrimes * This product includes software developed by the University of 181590Srgrimes * California, Berkeley and its contributors. 191590Srgrimes * 4. Neither the name of the University nor the names of its contributors 201590Srgrimes * may be used to endorse or promote products derived from this software 211590Srgrimes * without specific prior written permission. 221590Srgrimes * 231590Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 241590Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 251590Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 261590Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 271590Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 281590Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2950477Speter * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 301590Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31362694S0mp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 321590Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3379535Sru * SUCH DAMAGE. 341590Srgrimes * 351590Srgrimes * @(#)defs.h 8.1 (Berkeley) 6/5/93 3693300Swollman * 371590Srgrimes * $Id: defs.h,v 1.5 1995/10/11 18:57:12 jhay Exp $ 3868963Sru */ 3959029Sgreen 401590Srgrimes#include <sys/types.h> 411590Srgrimes#include <sys/socket.h> 421590Srgrimes 431590Srgrimes#include <net/route.h> 4494559Scharnier#include <netipx/ipx.h> 451590Srgrimes#include <netipx/ipxdp.h> 4695124Scharnier#if defined(vax) || defined(pdp11) 4795124Scharnier#define xnnet(x) ((u_long) (x)->rip_dst[1] << 16 | (u_long) (x)->rip_dst[0] ) 4895124Scharnier#else 491590Srgrimes#define xnnet(x) ((u_long) (x)->rip_dst[0] << 16 | (u_long) (x)->rip_dst[1] ) 50141030Sphk#endif 51141030Sphk 521590Srgrimes#include <stdio.h> 5368963Sru#include <string.h> 541590Srgrimes#include <syslog.h> 551590Srgrimes 56132669Scharnier#include "protocol.h" 57362694S0mp#include "sap.h" 581590Srgrimes#include "table.h" 59107788Sru#include "trace.h" 60107788Sru#include "interface.h" 611590Srgrimes#include "af.h" 62107788Sru 631590Srgrimes 641590Srgrimes/* 651590Srgrimes * When we find any interfaces marked down we rescan the 66362694S0mp * kernel every CHECK_INTERVAL seconds to see if they've 67362694S0mp * come up. 681590Srgrimes */ 691590Srgrimes#define CHECK_INTERVAL (5*60) 701590Srgrimes 7159029Sgreen#define equal(a1, a2) \ 7259029Sgreen (bcmp((caddr_t)(a1), (caddr_t)(a2), sizeof (struct sockaddr)) == 0) 7359029Sgreen#define min(a,b) ((a)>(b)?(b):(a)) 74362694S0mp#define max(a,b) ((a)<(b)?(b):(a)) 75362694S0mp 76362694S0mpextern int ripsock; /* Socket to listen on */ 771590Srgrimesextern int sapsock; /* Socket to listen on */ 78131491Sruextern int kmem; 79131491Sruextern int supplier; /* process should supply updates */ 801590Srgrimesextern int dosap; /* SAP is enabled */ 811590Srgrimesextern int install; /* if 1 call kernel */ 821590Srgrimesextern int lookforinterfaces; /* if 1 probe kernel for new up ifs */ 831590Srgrimesextern int performnlist; /* if 1 check if /kernel has changed */ 841590Srgrimesextern int externalinterfaces; /* # of remote and local interfaces */ 851590Srgrimesextern int timeval; /* local idea of time */ 86362694S0mpextern int noteremoterequests; /* squawk on requests from non-local nets */ 871590Srgrimesextern int r; /* Routing socket to install updates with */ 88362694S0mpextern int gateway; 891590Srgrimesextern struct sockaddr_ipx ipx_netmask; /* Used in installing routes */ 901590Srgrimes 91131491Sruextern char packet[MAXPACKETSIZE+sizeof(struct ipxdp)+1]; 92131491Sruextern struct rip *msg; 93131491Sru 94131491Sruextern char **argv0; 951590Srgrimes 961590Srgrimes#define ADD 1 9768963Sru#define DELETE 2 98131491Sru#define CHANGE 3 99131491Sru 100131507Sruvoid sndmsg(struct sockaddr *, int, struct interface *); 10168963Sruvoid supply(struct sockaddr *, int, struct interface *); 1021590Srgrimesvoid addrouteforif(struct interface *); 10394559Scharniervoid ifinit(void); 1041590Srgrimesvoid toall(void (*f)(struct sockaddr *, int, struct interface *), 1051590Srgrimes struct rt_entry *); 1061590Srgrimesvoid rip_input(struct sockaddr *, int); 1071590Srgrimes 1081590Srgrimes