]>
Commit | Line | Data |
---|---|---|
bbeaeedc TL |
1 | /* inet.h |
2 | ||
3 | Portable definitions for internet addresses */ | |
4 | ||
5 | /* | |
49a7fb58 | 6 | * Copyright (C) 2004-2022 Internet Systems Consortium, Inc. ("ISC") |
98311e4b | 7 | * Copyright (c) 1996-2003 by Internet Software Consortium |
bbeaeedc | 8 | * |
7512d88b TM |
9 | * This Source Code Form is subject to the terms of the Mozilla Public |
10 | * License, v. 2.0. If a copy of the MPL was not distributed with this | |
11 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
bbeaeedc | 12 | * |
98311e4b DH |
13 | * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES |
14 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
15 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR | |
16 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
17 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
18 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT | |
19 | * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
bbeaeedc | 20 | * |
98311e4b | 21 | * Internet Systems Consortium, Inc. |
429a56d7 TM |
22 | * PO Box 360 |
23 | * Newmarket, NH 03857 USA | |
98311e4b | 24 | * <info@isc.org> |
2c85ac9b | 25 | * https://www.isc.org/ |
49733f31 | 26 | * |
bbeaeedc TL |
27 | */ |
28 | ||
18909bef TL |
29 | /* An internet address of up to 128 bits. */ |
30 | ||
bbeaeedc | 31 | struct iaddr { |
b1b7b521 | 32 | unsigned len; |
089fb364 | 33 | unsigned char iabuf [16]; |
bbeaeedc | 34 | }; |
6d497d24 TL |
35 | |
36 | struct iaddrlist { | |
37 | struct iaddrlist *next; | |
38 | struct iaddr addr; | |
39 | }; | |
febbd402 DH |
40 | |
41 | ||
42 | /* struct iaddrmatch - used to compare a host IP against a subnet spec | |
43 | * | |
44 | * There is a space/speed tradeoff here implied by the use of a second | |
45 | * struct iaddr to hold the mask; while using an unsigned (byte!) to | |
46 | * represent the subnet prefix length would be more memory efficient, | |
47 | * it makes run-time mask comparisons more expensive. Since such | |
48 | * entries are used currently only in restricted circumstances | |
49 | * (wanting to reject a subnet), the decision is in favour of run-time | |
50 | * efficiency. | |
51 | */ | |
52 | ||
53 | struct iaddrmatch { | |
54 | struct iaddr addr; | |
55 | struct iaddr mask; | |
56 | }; | |
57 | ||
58 | /* its list ... */ | |
f6b8f48d | 59 | |
febbd402 DH |
60 | struct iaddrmatchlist { |
61 | struct iaddrmatchlist *next; | |
62 | struct iaddrmatch match; | |
63 | }; | |
98bd7ca0 DH |
64 | |
65 | ||
66 | /* | |
67 | * Structure to store information about a CIDR network. | |
68 | */ | |
69 | ||
70 | struct iaddrcidrnet { | |
71 | struct iaddr lo_addr; | |
72 | int bits; | |
73 | }; | |
74 | ||
75 | struct iaddrcidrnetlist { | |
76 | struct iaddrcidrnetlist *next; | |
77 | struct iaddrcidrnet cidrnet; | |
78 | }; |