etc/protocols - sync with NetBSD-8
[minix.git] / external / bsd / dhcp / dist / includes / inet.h
blob838ecfe02d1866565808dcb6c0b4f302dd6c074f
1 /* $NetBSD: inet.h,v 1.1.1.3 2014/07/12 11:57:56 spz Exp $ */
2 /* inet.h
4 Portable definitions for internet addresses */
6 /*
7 * Copyright (c) 2004,2007,2009,2014 by Internet Systems Consortium, Inc. ("ISC")
8 * Copyright (c) 1996-2003 by Internet Software Consortium
10 * Permission to use, copy, modify, and distribute this software for any
11 * purpose with or without fee is hereby granted, provided that the above
12 * copyright notice and this permission notice appear in all copies.
14 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
15 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
16 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
17 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
19 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
20 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 * Internet Systems Consortium, Inc.
23 * 950 Charter Street
24 * Redwood City, CA 94063
25 * <info@isc.org>
26 * https://www.isc.org/
30 /* An internet address of up to 128 bits. */
32 struct iaddr {
33 unsigned len;
34 unsigned char iabuf [16];
37 struct iaddrlist {
38 struct iaddrlist *next;
39 struct iaddr addr;
43 /* struct iaddrmatch - used to compare a host IP against a subnet spec
45 * There is a space/speed tradeoff here implied by the use of a second
46 * struct iaddr to hold the mask; while using an unsigned (byte!) to
47 * represent the subnet prefix length would be more memory efficient,
48 * it makes run-time mask comparisons more expensive. Since such
49 * entries are used currently only in restricted circumstances
50 * (wanting to reject a subnet), the decision is in favour of run-time
51 * efficiency.
54 struct iaddrmatch {
55 struct iaddr addr;
56 struct iaddr mask;
59 /* its list ... */
61 struct iaddrmatchlist {
62 struct iaddrmatchlist *next;
63 struct iaddrmatch match;
68 * Structure to store information about a CIDR network.
71 struct iaddrcidrnet {
72 struct iaddr lo_addr;
73 int bits;
76 struct iaddrcidrnetlist {
77 struct iaddrcidrnetlist *next;
78 struct iaddrcidrnet cidrnet;