OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / freeswan / lib / sameaddr.3
1 .TH IPSEC_ANYADDR 3 "28 Nov 2000"
2 .\" RCSID $Id: sameaddr.3,v 1.5 2000/11/29 06:36:39 henry Exp $
3 .SH NAME
4 ipsec sameaddr \- are two addresses the same?
5 .br
6 ipsec addrcmp \- ordered comparison of addresses
7 .br
8 ipsec samesubnet \- are two subnets the same?
9 .br
10 ipsec addrinsubnet \- is an address within a subnet?
11 .br
12 ipsec subnetinsubnet \- is a subnet within another subnet?
13 .br
14 ipsec subnetishost \- is a subnet a single host?
15 .br
16 ipsec samesaid \- are two SA IDs the same?
17 .br
18 ipsec sameaddrtype \- are two addresses of the same address family?
19 .br
20 ipsec samesubnettype \- are two subnets of the same address family?
21 .SH SYNOPSIS
22 .B "#include <freeswan.h>
23 .sp
24 .B "int sameaddr(const ip_address *a, const ip_address *b);"
25 .br
26 .B "int addrcmp(const ip_address *a, const ip_address *b);"
27 .br
28 .B "int samesubnet(const ip_subnet *a, const ip_subnet *b);"
29 .br
30 .B "int addrinsubnet(const ip_address *a, const ip_subnet *s);"
31 .br
32 .B "int subnetinsubnet(const ip_subnet *a, const ip_subnet *b);"
33 .br
34 .B "int subnetishost(const ip_subnet *s);"
35 .br
36 .B "int samesaid(const ip_said *a, const ip_said *b);"
37 .br
38 .B "int sameaddrtype(const ip_address *a, const ip_address *b);"
39 .br
40 .B "int samesubnettype(const ip_subnet *a, const ip_subnet *b);"
41 .SH DESCRIPTION
42 These functions do various comparisons and tests on the
43 .I ip_address
44 type and
45 .I ip_subnet
46 types.
47 .PP
48 .I Sameaddr
49 returns
50 non-zero
51 if addresses
52 .I a
53 and
54 .IR b
55 are identical,
56 and
57 .B 0
58 otherwise.
59 Addresses of different families are never identical.
60 .PP
61 .I Addrcmp
62 returns
63 .BR \-1 ,
64 .BR 0 ,
65 or
66 .BR 1
67 respectively
68 if address
69 .I a
70 is less than, equal to, or greater than
71 .IR b .
72 If they are not of the same address family,
73 they are never equal;
74 the ordering reported in this case is arbitrary
75 (and probably not useful) but consistent.
76 .PP
77 .I Samesubnet
78 returns
79 non-zero
80 if subnets
81 .I a
82 and
83 .IR b
84 are identical,
85 and
86 .B 0
87 otherwise.
88 Subnets of different address families are never identical.
89 .PP
90 .I Addrinsubnet
91 returns
92 non-zero
93 if address
94 .I a
95 is within subnet
96 .IR s
97 and
98 .B 0
99 otherwise.
100 An address is never within a
101 subnet of a different address family.
102 .PP
103 .I Subnetinsubnet
104 returns
105 non-zero
106 if subnet
107 .I a
108 is a subset of subnet
109 .IR b
110 and
111 .B 0
112 otherwise.
113 A subnet is deemed to be a subset of itself.
114 A subnet is never a subset of another
115 subnet if their address families differ.
116 .PP
117 .I Subnetishost
118 returns
119 non-zero
120 if subnet
121 .I s
122 is in fact only a single host,
123 and
124 .B 0
125 otherwise.
126 .PP
127 .I Samesaid
128 returns
129 non-zero
130 if SA IDs
131 .I a
132 and
133 .IR b
134 are identical,
135 and
136 .B 0
137 otherwise.
138 .PP
139 .I Sameaddrtype
140 returns
141 non-zero
142 if addresses
143 .I a
144 and
145 .IR b
146 are of the same address family,
147 and
148 .B 0
149 otherwise.
150 .PP
151 .I Samesubnettype
152 returns
153 non-zero
154 if subnets
155 .I a
156 and
157 .IR b
158 are of the same address family,
159 and
160 .B 0
161 otherwise.
162 .SH SEE ALSO
163 inet(3), ipsec_initaddr(3)
164 .SH HISTORY
165 Written for the FreeS/WAN project by Henry Spencer.