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