]> git.saurik.com Git - apple/network_cmds.git/blob - routed.tproj/interface.h
0f9baa16f99679e67188eef280fe5d494b3e7bc2
[apple/network_cmds.git] / routed.tproj / interface.h
1 /*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25 /*
26 * Copyright (c) 1983, 1993
27 * The Regents of the University of California. All rights reserved.
28 *
29 * Redistribution and use in source and binary forms, with or without
30 * modification, are permitted provided that the following conditions
31 * are met:
32 * 1. Redistributions of source code must retain the above copyright
33 * notice, this list of conditions and the following disclaimer.
34 * 2. Redistributions in binary form must reproduce the above copyright
35 * notice, this list of conditions and the following disclaimer in the
36 * documentation and/or other materials provided with the distribution.
37 * 3. All advertising materials mentioning features or use of this software
38 * must display the following acknowledgment:
39 * This product includes software developed by the University of
40 * California, Berkeley and its contributors.
41 * 4. Neither the name of the University nor the names of its contributors
42 * may be used to endorse or promote products derived from this software
43 * without specific prior written permission.
44 *
45 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
46 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
47 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
48 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
49 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
50 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
51 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
52 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
53 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
54 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
55 * SUCH DAMAGE.
56 *
57 * @(#)defs.h 8.1 (Berkeley) 6/5/93
58 */
59
60 /*
61 * Routing table management daemon.
62 */
63
64 /*
65 * An ``interface'' is similar to an ifnet structure,
66 * except it doesn't contain q'ing info, and it also
67 * handles ``logical'' interfaces (remote gateways
68 * that we want to keep polling even if they go down).
69 * The list of interfaces which we maintain is used
70 * in supplying the gratuitous routing table updates.
71 */
72 struct interface {
73 struct interface *int_next;
74 struct sockaddr int_addr; /* address on this host */
75 union {
76 struct sockaddr intu_broadaddr;
77 struct sockaddr intu_dstaddr;
78 } int_intu;
79 #define int_broadaddr int_intu.intu_broadaddr /* broadcast address */
80 #define int_dstaddr int_intu.intu_dstaddr /* other end of p-to-p link */
81 int int_metric; /* init's routing entry */
82 int int_flags; /* see below */
83 /* START INTERNET SPECIFIC */
84 u_long int_net; /* network # */
85 u_long int_netmask; /* net mask for addr */
86 u_long int_subnet; /* subnet # */
87 u_long int_subnetmask; /* subnet mask for addr */
88 /* END INTERNET SPECIFIC */
89 struct ifdebug int_input, int_output; /* packet tracing stuff */
90 int int_ipackets; /* input packets received */
91 int int_opackets; /* output packets sent */
92 char *int_name; /* from kernel if structure */
93 u_short int_transitions; /* times gone up-down */
94 };
95
96 /*
97 * 0x1 to 0x10 are reused from the kernel's ifnet definitions,
98 * the others agree with the RTS_ flags defined elsewhere.
99 */
100 #define IFF_UP 0x1 /* interface is up */
101 #define IFF_BROADCAST 0x2 /* broadcast address valid */
102 #define IFF_DEBUG 0x4 /* turn on debugging */
103 #define IFF_LOOPBACK 0x8 /* software loopback net */
104 #define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */
105
106 #define IFF_SUBNET 0x100000 /* interface on subnetted network */
107 #define IFF_PASSIVE 0x200000 /* can't tell if up/down */
108 #define IFF_INTERFACE 0x400000 /* hardware interface */
109 #define IFF_REMOTE 0x800000 /* interface isn't on this machine */
110
111 struct interface *if_ifwithaddr();
112 struct interface *if_ifwithdstaddr();
113 struct interface *if_ifwithnet();
114 struct interface *if_iflookup();