bind9/doc/man/ipproto.man
2000-06-01 03:19:06 +00:00

98 lines
2.5 KiB
Groff

.\"
.\" Copyright (C) 2000 Internet Software Consortium.
.\"
.\" Permission to use, copy, modify, and distribute this document for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
.\" DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
.\" INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
.\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
.\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
.\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
.\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\" $Id: ipproto.man,v 1.1 2000/06/01 03:19:06 jim Exp $
.\"
.Dd Jun 30, 2000
.Dt IPPROTO 3
.Os BIND9 9
.ds vT BIND9 Programmer's Manual
.Sh NAME
.Nm try_proto ,
.Nm initialize_action ,
.Nm isc_net_probeipv4 ,
.Nm isc_net_probeipv6
.Nd protocol probe functions
.Sh SYNOPSIS
.Fd #include <config.h>
.Fd #include <errno.h>
.Fd #include <unistd.h>
.Fd #include <isc/net.h>
.Fd #include <isc/once.h>
.Fd #include <isc/string.h>
.Fd #include <isc/util.h>
.Ft static isc_result_t
.Fn try_proto "int domain"
.Ft static void
.Fn initialize_action
.Ft isc_result_t
.Fn isc_net_probeipv4 void
.Ft isc_result_t
.Fn isc_net_probeipv4 void
.Sh DESCRIPTION
.Fn isc_net_probeipv4
and
.Fn isc_net_probeipv6
check that the operating system support the IPv4 and IPv6 protocols
respectively.
They call
.Fn try_proto
which tries to create a socket of type
.Dv SOCK_STREAM
for the appropriate protocol family,
.Fa domain .
.Pp
.Fn initialize_action
sets the external variables
.Dv ipv4_result
and
.Dv ipv6_result
to
.Er ISC_R_SUCCESS
if the IPv4 and IPv6 protocols respectively are supported by the
operating system.
These variables can be tested by applications which need to perform
protocol-specific tasks.
.Sh RETURN VALUES
.Fn isc_net_probeipv4
returns
.Er ISC_R_SUCCESS
if the IPv4 protocol is supported by the kernel and
.Fn isc_net_probeipv6
returns
.Er ISC_R_SUCCESS
if the operating system supports IPv6.
.Fn try_proto
returns
.Fn ISC_R_NOTFOUND
if the chosen protocol family
.Fa domain
is not supported by the kernel.
An error message is printed on
.Dv stderr
and
.Er ISC_R_UNEXPECTED
returned if another error occurred when the attempt was made to create
the
.Dv SOCK_STREAM
socket.
.Sh SEE ALSO
.Xr socket 2 ,
.Xr ip 4 ,
.Xr ipv6 4 .