Commit | Line | Data |
---|---|---|
15637ed4 RG |
1 | /* |
2 | * Copyright (c) 1985, 1986 Regents of the University of California. | |
3 | * All rights reserved. | |
4 | * | |
5 | * Redistribution and use in source and binary forms, with or without | |
6 | * modification, are permitted provided that the following conditions | |
7 | * are met: | |
8 | * 1. Redistributions of source code must retain the above copyright | |
9 | * notice, this list of conditions and the following disclaimer. | |
10 | * 2. Redistributions in binary form must reproduce the above copyright | |
11 | * notice, this list of conditions and the following disclaimer in the | |
12 | * documentation and/or other materials provided with the distribution. | |
13 | * 3. All advertising materials mentioning features or use of this software | |
14 | * must display the following acknowledgement: | |
15 | * This product includes software developed by the University of | |
16 | * California, Berkeley and its contributors. | |
17 | * 4. Neither the name of the University nor the names of its contributors | |
18 | * may be used to endorse or promote products derived from this software | |
19 | * without specific prior written permission. | |
20 | * | |
21 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
31 | * SUCH DAMAGE. | |
32 | * | |
38e82238 | 33 | * from: @(#)in_var.h 7.6 (Berkeley) 6/28/90 |
ebe802a5 | 34 | * $Id: in_var.h,v 1.5 1993/12/19 00:52:40 wollman Exp $ |
15637ed4 RG |
35 | */ |
36 | ||
8ace4366 GW |
37 | #ifndef _NETINET_IN_VAR_H_ |
38 | #define _NETINET_IN_VAR_H_ 1 | |
39 | ||
15637ed4 RG |
40 | /* |
41 | * Interface address, Internet version. One of these structures | |
42 | * is allocated for each interface with an Internet address. | |
43 | * The ifaddr structure contains the protocol-independent part | |
44 | * of the structure and is assumed to be first. | |
45 | */ | |
46 | struct in_ifaddr { | |
47 | struct ifaddr ia_ifa; /* protocol-independent info */ | |
48 | #define ia_ifp ia_ifa.ifa_ifp | |
49 | #define ia_flags ia_ifa.ifa_flags | |
50 | /* ia_{,sub}net{,mask} in host order */ | |
51 | u_long ia_net; /* network number of interface */ | |
52 | u_long ia_netmask; /* mask of net part */ | |
53 | u_long ia_subnet; /* subnet number, including net */ | |
54 | u_long ia_subnetmask; /* mask of subnet part */ | |
55 | struct in_addr ia_netbroadcast; /* to recognize net broadcasts */ | |
56 | struct in_ifaddr *ia_next; /* next in list of internet addresses */ | |
57 | struct sockaddr_in ia_addr; /* reserve space for interface name */ | |
58 | struct sockaddr_in ia_dstaddr; /* reserve space for broadcast addr */ | |
59 | #define ia_broadaddr ia_dstaddr | |
60 | struct sockaddr_in ia_sockmask; /* reserve space for general netmask */ | |
61 | }; | |
62 | ||
63 | struct in_aliasreq { | |
64 | char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */ | |
65 | struct sockaddr_in ifra_addr; | |
66 | struct sockaddr_in ifra_broadaddr; | |
67 | #define ifra_dstaddr ifra_broadaddr | |
68 | struct sockaddr_in ifra_mask; | |
69 | }; | |
70 | /* | |
71 | * Given a pointer to an in_ifaddr (ifaddr), | |
72 | * return a pointer to the addr as a sockaddr_in. | |
73 | */ | |
74 | #define IA_SIN(ia) (&(((struct in_ifaddr *)(ia))->ia_addr)) | |
75 | ||
fde1aeb2 GW |
76 | struct ip; /* forward declaration */ |
77 | typedef void in_input_t(struct mbuf *, int); | |
ebe802a5 GW |
78 | /* |
79 | * Grrr... `netstat' expects to be able to include this file | |
80 | * with KERNEL defined, to get all sorts of interesting structures, | |
81 | * but without having to get all these prototypes. (Well, it's not | |
82 | * really netstat's fault, but this should get fixed when KERNEL gets | |
83 | * changed to _KERNEL.) | |
84 | */ | |
85 | struct socket; | |
fde1aeb2 GW |
86 | typedef int in_output_t(struct mbuf *, struct socket *); |
87 | typedef void in_ctlinput_t(int, struct sockaddr *, struct ip *); | |
88 | typedef int in_ctloutput_t(int, struct socket *, int, int, struct mbuf **); | |
89 | ||
90 | /* | |
91 | * This structure is a pun for `struct protosw'. The difference is that it | |
92 | * has appropriate interprotocol hook prototypes for the Internet family. | |
93 | */ | |
94 | struct in_protosw { | |
95 | short pr_type; /* socket type used for */ | |
96 | struct domain *pr_domain; /* domain protocol a member of */ | |
97 | short pr_protocol; /* protocol number */ | |
98 | short pr_flags; /* see below */ | |
99 | /* protocol-protocol hooks */ | |
100 | in_input_t *pr_input; | |
101 | in_output_t *pr_output; | |
102 | in_ctlinput_t *pr_ctlinput; | |
103 | in_ctloutput_t *pr_ctloutput; | |
104 | /* user-protocol hook */ | |
105 | int (*pr_usrreq)(struct socket *, int, struct mbuf *, | |
106 | struct mbuf *, struct mbuf *, struct mbuf *); | |
107 | /* utility hooks */ | |
108 | void (*pr_init)(void); /* initialization hook */ | |
109 | void (*pr_fasttimo)(void); /* fast timeout (200ms) */ | |
110 | void (*pr_slowtimo)(void); /* slow timeout (500ms) */ | |
111 | void (*pr_drain)(void); /* flush any excess space possible */ | |
112 | }; | |
113 | ||
114 | ||
15637ed4 | 115 | #ifdef KERNEL |
fde1aeb2 GW |
116 | extern struct in_ifaddr *in_ifaddr; |
117 | extern struct in_ifaddr *in_iaonnetof(u_long); | |
2cb63509 | 118 | extern struct in_ifaddr *ifptoia(struct ifnet *); |
fde1aeb2 GW |
119 | extern int in_ifinit(struct ifnet *, struct in_ifaddr *, struct sockaddr_in *, int); |
120 | ||
121 | extern int in_cksum(struct mbuf *, int); | |
122 | ||
123 | extern struct ifqueue ipintrq; /* ip packet input queue */ | |
124 | extern struct in_protosw inetsw[]; | |
125 | extern struct domain inetdomain; | |
126 | extern u_char ip_protox[]; | |
2cb63509 GW |
127 | extern u_char inetctlerrmap[]; |
128 | extern struct in_addr zeroin_addr; | |
fde1aeb2 GW |
129 | |
130 | /* From in_var.c: */ | |
2cb63509 | 131 | struct route; |
fde1aeb2 GW |
132 | extern int subnetsarelocal; /* obsolescent */ |
133 | extern int ipqmaxlen; | |
134 | extern u_long *ip_ifmatrix; | |
135 | extern int ipforwarding; | |
136 | extern struct sockaddr_in ipaddr; | |
137 | extern struct route ipforward_rt; | |
138 | extern int ipsendredirects; | |
139 | ||
140 | ||
141 | #ifdef MTUDISC | |
2cb63509 GW |
142 | extern unsigned in_nextmtu(unsigned, int); |
143 | extern int in_routemtu(struct route *); | |
144 | extern void in_mtureduce(struct in_addr, unsigned); | |
145 | extern void in_mtutimer(caddr_t, int); | |
146 | #endif /* MTUDISC */ | |
147 | #endif /* KERNEL */ | |
8ace4366 | 148 | #endif /* _NETINET_IN_VAR_H_ */ |