defs.h revision 11820
1100206Sdd/* 2100206Sdd * Copyright (c) 1983, 1993 3100206Sdd * The Regents of the University of California. All rights reserved. 4100206Sdd * 5100206Sdd * Copyright (c) 1995 John Hay. All rights reserved. 6100206Sdd * 7100206Sdd * Redistribution and use in source and binary forms, with or without 8100206Sdd * modification, are permitted provided that the following conditions 9100206Sdd * are met: 10100206Sdd * 1. Redistributions of source code must retain the above copyright 11100206Sdd * notice, this list of conditions and the following disclaimer. 12100206Sdd * 2. Redistributions in binary form must reproduce the above copyright 13100206Sdd * notice, this list of conditions and the following disclaimer in the 14100206Sdd * documentation and/or other materials provided with the distribution. 15100206Sdd * 3. All advertising materials mentioning features or use of this software 16100206Sdd * must display the following acknowledgement: 17100206Sdd * This product includes software developed by the University of 18100206Sdd * California, Berkeley and its contributors. 19100206Sdd * 4. Neither the name of the University nor the names of its contributors 20100206Sdd * may be used to endorse or promote products derived from this software 21100206Sdd * without specific prior written permission. 22100206Sdd * 23100206Sdd * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 24100206Sdd * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25100206Sdd * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26100206Sdd * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27100206Sdd * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28253252Sjh * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29100206Sdd * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30100206Sdd * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31100206Sdd * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32100206Sdd * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33100206Sdd * SUCH DAMAGE. 34100206Sdd * 35100206Sdd * @(#)defs.h 8.1 (Berkeley) 6/5/93 36100206Sdd * 37107703Sru * $Id: defs.h,v 1.5 1995/10/11 18:57:12 jhay Exp $ 38100206Sdd */ 39100206Sdd 40100206Sdd#include <sys/types.h> 41100206Sdd#include <sys/socket.h> 42100206Sdd 43100206Sdd#include <net/route.h> 44100206Sdd#include <netipx/ipx.h> 45100206Sdd#include <netipx/ipxdp.h> 46118056Ssimon#if defined(vax) || defined(pdp11) 47118056Ssimon#define xnnet(x) ((u_long) (x)->rip_dst[1] << 16 | (u_long) (x)->rip_dst[0] ) 48118056Ssimon#else 49100206Sdd#define xnnet(x) ((u_long) (x)->rip_dst[0] << 16 | (u_long) (x)->rip_dst[1] ) 50100206Sdd#endif 51100206Sdd 52100206Sdd#include <stdio.h> 53100206Sdd#include <string.h> 54100206Sdd#include <syslog.h> 55236780Sjoel 56100206Sdd#include "protocol.h" 57100206Sdd#include "sap.h" 58100206Sdd#include "table.h" 59100206Sdd#include "trace.h" 60100206Sdd#include "interface.h" 61100206Sdd#include "af.h" 62100206Sdd 63100206Sdd 64100206Sdd/* 65100206Sdd * When we find any interfaces marked down we rescan the 66100206Sdd * kernel every CHECK_INTERVAL seconds to see if they've 67100795Sdd * come up. 68100206Sdd */ 69100206Sdd#define CHECK_INTERVAL (5*60) 70100206Sdd 71100206Sdd#define equal(a1, a2) \ 72100206Sdd (bcmp((caddr_t)(a1), (caddr_t)(a2), sizeof (struct sockaddr)) == 0) 73100206Sdd#define min(a,b) ((a)>(b)?(b):(a)) 74100206Sdd#define max(a,b) ((a)<(b)?(b):(a)) 75100206Sdd 76100206Sddextern int ripsock; /* Socket to listen on */ 77100206Sddextern int sapsock; /* Socket to listen on */ 78100206Sddextern int kmem; 79100206Sddextern int supplier; /* process should supply updates */ 80100206Sddextern int dosap; /* SAP is enabled */ 81100206Sddextern int install; /* if 1 call kernel */ 82100206Sddextern int lookforinterfaces; /* if 1 probe kernel for new up ifs */ 83100206Sddextern int performnlist; /* if 1 check if /kernel has changed */ 84100206Sddextern int externalinterfaces; /* # of remote and local interfaces */ 85100206Sddextern int timeval; /* local idea of time */ 86100206Sddextern int noteremoterequests; /* squawk on requests from non-local nets */ 87100206Sddextern int r; /* Routing socket to install updates with */ 88100206Sddextern int gateway; 89100206Sddextern struct sockaddr_ipx ipx_netmask; /* Used in installing routes */ 90100206Sdd 91236780Sjoelextern char packet[MAXPACKETSIZE+sizeof(struct ipxdp)+1]; 92100206Sddextern struct rip *msg; 93100206Sdd 94100206Sddextern char **argv0; 95100206Sdd 96100206Sdd#define ADD 1 97100206Sdd#define DELETE 2 98100206Sdd#define CHANGE 3 99100206Sdd 100100206Sddvoid sndmsg(struct sockaddr *, int, struct interface *); 101236780Sjoelvoid supply(struct sockaddr *, int, struct interface *); 102100206Sddvoid addrouteforif(struct interface *); 103100206Sddvoid ifinit(void); 104100206Sddvoid toall(void (*f)(struct sockaddr *, int, struct interface *), 105100206Sdd struct rt_entry *); 106100206Sddvoid rip_input(struct sockaddr *, int); 107100206Sdd 108100206Sdd