| 1 | /* |
| 2 | * Copyright (c) 1983 Regents of the University of California. |
| 3 | * All rights reserved. The Berkeley software License Agreement |
| 4 | * specifies the terms and conditions for redistribution. |
| 5 | * |
| 6 | * @(#)interface.h 5.2 (Berkeley) %G% |
| 7 | */ |
| 8 | |
| 9 | /* |
| 10 | * Routing table management daemon. |
| 11 | */ |
| 12 | |
| 13 | /* |
| 14 | * An ``interface'' is similar to an ifnet structure, |
| 15 | * except it doesn't contain q'ing info, and it also |
| 16 | * handles ``logical'' interfaces (remote gateways |
| 17 | * that we want to keep polling even if they go down). |
| 18 | * The list of interfaces which we maintain is used |
| 19 | * in supplying the gratuitous routing table updates. |
| 20 | */ |
| 21 | struct interface { |
| 22 | struct interface *int_next; |
| 23 | struct sockaddr int_addr; /* address on this host */ |
| 24 | union { |
| 25 | struct sockaddr intu_broadaddr; |
| 26 | struct sockaddr intu_dstaddr; |
| 27 | } int_intu; |
| 28 | #define int_broadaddr int_intu.intu_broadaddr /* broadcast address */ |
| 29 | #define int_dstaddr int_intu.intu_dstaddr /* other end of p-to-p link */ |
| 30 | int int_metric; /* init's routing entry */ |
| 31 | int int_flags; /* see below */ |
| 32 | /* START INTERNET SPECIFIC */ |
| 33 | u_long int_net; /* network # */ |
| 34 | u_long int_netmask; /* net mask for addr */ |
| 35 | u_long int_subnet; /* subnet # */ |
| 36 | u_long int_subnetmask; /* subnet mask for addr */ |
| 37 | /* END INTERNET SPECIFIC */ |
| 38 | struct ifdebug int_input, int_output; /* packet tracing stuff */ |
| 39 | int int_ipackets; /* input packets received */ |
| 40 | int int_opackets; /* output packets sent */ |
| 41 | char *int_name; /* from kernel if structure */ |
| 42 | u_short int_transitions; /* times gone up-down */ |
| 43 | }; |
| 44 | |
| 45 | /* |
| 46 | * 0x1 to 0x10 are reused from the kernel's ifnet definitions, |
| 47 | * the others agree with the RTS_ flags defined elsewhere. |
| 48 | */ |
| 49 | #define IFF_UP 0x1 /* interface is up */ |
| 50 | #define IFF_BROADCAST 0x2 /* broadcast address valid */ |
| 51 | #define IFF_DEBUG 0x4 /* turn on debugging */ |
| 52 | #define IFF_LOOPBACK 0x8 /* software loopback net */ |
| 53 | #define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */ |
| 54 | |
| 55 | #define IFF_PASSIVE 0x2000 /* can't tell if up/down */ |
| 56 | #define IFF_INTERFACE 0x4000 /* hardware interface */ |
| 57 | #define IFF_REMOTE 0x8000 /* interface isn't on this machine */ |
| 58 | |
| 59 | struct interface *if_ifwithaddr(); |
| 60 | struct interface *if_ifwithnet(); |
| 61 | struct interface *if_iflookup(); |