1 /* 2 * Copyright (c) 1983 Regents of the University of California. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms are permitted 6 * provided that the above copyright notice and this paragraph are 7 * duplicated in all such forms and that any documentation, 8 * advertising materials, and other materials related to such 9 * distribution and use acknowledge that the software was developed 10 * by the University of California, Berkeley. The name of the 11 * University may not be used to endorse or promote products derived 12 * from this software without specific prior written permission. 13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 15 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 16 * 17 * @(#)interface.h 5.5 (Berkeley) 06/18/88 18 */ 19 20 /* 21 * Routing table management daemon. 22 */ 23 24 /* 25 * An ``interface'' is similar to an ifnet structure, 26 * except it doesn't contain q'ing info, and it also 27 * handles ``logical'' interfaces (remote gateways 28 * that we want to keep polling even if they go down). 29 * The list of interfaces which we maintain is used 30 * in supplying the gratuitous routing table updates. 31 */ 32 struct interface { 33 struct interface *int_next; 34 struct sockaddr int_addr; /* address on this host */ 35 union { 36 struct sockaddr intu_broadaddr; 37 struct sockaddr intu_dstaddr; 38 } int_intu; 39 #define int_broadaddr int_intu.intu_broadaddr /* broadcast address */ 40 #define int_dstaddr int_intu.intu_dstaddr /* other end of p-to-p link */ 41 int int_metric; /* init's routing entry */ 42 int int_flags; /* see below */ 43 /* START INTERNET SPECIFIC */ 44 u_long int_net; /* network # */ 45 u_long int_netmask; /* net mask for addr */ 46 u_long int_subnet; /* subnet # */ 47 u_long int_subnetmask; /* subnet mask for addr */ 48 /* END INTERNET SPECIFIC */ 49 struct ifdebug int_input, int_output; /* packet tracing stuff */ 50 int int_ipackets; /* input packets received */ 51 int int_opackets; /* output packets sent */ 52 char *int_name; /* from kernel if structure */ 53 u_short int_transitions; /* times gone up-down */ 54 }; 55 56 /* 57 * 0x1 to 0x10 are reused from the kernel's ifnet definitions, 58 * the others agree with the RTS_ flags defined elsewhere. 59 */ 60 #define IFF_UP 0x1 /* interface is up */ 61 #define IFF_BROADCAST 0x2 /* broadcast address valid */ 62 #define IFF_DEBUG 0x4 /* turn on debugging */ 63 #define IFF_LOOPBACK 0x8 /* software loopback net */ 64 #define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */ 65 66 #define IFF_SUBNET 0x1000 /* interface on subnetted network */ 67 #define IFF_PASSIVE 0x2000 /* can't tell if up/down */ 68 #define IFF_INTERFACE 0x4000 /* hardware interface */ 69 #define IFF_REMOTE 0x8000 /* interface isn't on this machine */ 70 71 struct interface *if_ifwithaddr(); 72 struct interface *if_ifwithdstaddr(); 73 struct interface *if_ifwithnet(); 74 struct interface *if_iflookup(); 75