From b0d8ed94fe9e74afb49fdf5f11e4add29879c65c Mon Sep 17 00:00:00 2001 From: Rene Mayrhofer Date: Thu, 12 Apr 2007 20:30:08 +0000 Subject: [svn-upgrade] Integrating new upstream version, strongswan (4.1.1) --- src/libfreeswan/initsubnet.3 | 137 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 src/libfreeswan/initsubnet.3 (limited to 'src/libfreeswan/initsubnet.3') diff --git a/src/libfreeswan/initsubnet.3 b/src/libfreeswan/initsubnet.3 new file mode 100644 index 000000000..670f71778 --- /dev/null +++ b/src/libfreeswan/initsubnet.3 @@ -0,0 +1,137 @@ +.TH IPSEC_INITSUBNET 3 "12 March 2002" +.\" RCSID $Id: initsubnet.3,v 1.1 2004/03/15 20:35:26 as Exp $ +.SH NAME +ipsec initsubnet \- initialize an ip_subnet +.br +ipsec addrtosubnet \- initialize a singleton ip_subnet +.br +ipsec subnettypeof \- get address type of an ip_subnet +.br +ipsec masktocount \- convert subnet mask to bit count +.br +ipsec networkof \- get base address of an ip_subnet +.br +ipsec maskof \- get subnet mask of an ip_subnet +.SH SYNOPSIS +.B "#include " +.sp +.B "const char *initsubnet(const ip_address *addr," +.ti +1c +.B "int maskbits, int clash, ip_subnet *dst);" +.br +.B "const char *addrtosubnet(const ip_address *addr," +.ti +1c +.B "ip_subnet *dst);" +.sp +.B "int subnettypeof(const ip_subnet *src);" +.br +.B "int masktocount(const ip_address *src);" +.br +.B "void networkof(const ip_subnet *src, ip_address *dst);" +.br +.B "void maskof(const ip_subnet *src, ip_address *dst);" +.SH DESCRIPTION +The +.B +library uses an internal type +.I ip_subnet +to contain a description of an IP subnet +(base address plus mask). +These functions provide basic tools for creating and examining this type. +.PP +.I Initsubnet +initializes a variable +.I *dst +of type +.I ip_subnet +from a base address and +a count of mask bits. +The +.I clash +parameter specifies what to do if the base address includes +.B 1 +bits outside the prefix specified by the mask +(that is, in the ``host number'' part of the address): +.RS +.IP '0' 5 +zero out host-number bits +.IP 'x' +non-zero host-number bits are an error +.RE +.PP +.I Initsubnet +returns +.B NULL +for success and +a pointer to a string-literal error message for failure; +see DIAGNOSTICS. +.PP +.I Addrtosubnet +initializes an +.I ip_subnet +variable +.I *dst +to a ``singleton subnet'' containing the single address +.IR *addr . +It returns +.B NULL +for success and +a pointer to a string-literal error message for failure. +.PP +.I Subnettypeof +returns the address type of a subnet, +normally +.B AF_INET +or +.BR AF_INET6 . +(The +.B +header file arranges to include the necessary headers for these +names to be known.) +.PP +.I Masktocount +converts a subnet mask, expressed as an address, to a bit count +suitable for use with +.IR initsubnet . +It returns +.B \-1 +for error; see DIAGNOSTICS. +.PP +.I Networkof +fills in +.I *dst +with the base address of subnet +.IR src . +.PP +.I Maskof +fills in +.I *dst +with the subnet mask of subnet +.IR src , +expressed as an address. +.SH SEE ALSO +inet(3), ipsec_ttosubnet(3), ipsec_rangetosubnet(3) +.SH DIAGNOSTICS +Fatal errors in +.I initsubnet +are: +unknown address family; +unknown +.I clash +value; +impossible mask bit count; +non-zero host-number bits and +.I clash +is +.BR 'x' . +Fatal errors in +.I addrtosubnet +are: +unknown address family. +Fatal errors in +.I masktocount +are: +unknown address family; +mask bits not contiguous. +.SH HISTORY +Written for the FreeS/WAN project by Henry Spencer. -- cgit v1.2.3