2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-05 00:55:24 +00:00
Files
bind/lib/isc/unix/include/isc/net.h.in

135 lines
2.7 KiB
C

/*
* Copyright (C) 1999 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software 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.
*/
#ifndef ISC_NET_H
#define ISC_NET_H 1
/*****
***** Module Info
*****/
/*
* Basic Networking Types
*
* This module is responsible for defining the following basic networking
* types:
*
* struct in_addr
* struct in6_addr
* struct sockaddr
* struct sockaddr_in
* struct sockaddr_in6
*
* It ensures that the AF_ and PF_ macros are defined.
*
* It declares ntoh[sl]() and hton[sl]().
*
* It declares inet_aton(), inet_ntop(), and inet_pton() if they are
* available on the system.
*
* It ensures that INADDR_ANY, IN6ADDR_ANY_INIT, in6addr_any, and
* in6addr_loopback are available.
*
* MP:
* No impact.
*
* Reliability:
* No anticipated impact.
*
* Resources:
* N/A.
*
* Security:
* No anticipated impact.
*
* Standards:
* BSD Socket API
* RFC 2553
*/
/***
*** Defines.
***/
/*
* If sockaddrs on this system have an sa_len field, ISC_NET_HAVESALEN will
* be defined.
*/
@ISC_NET_HAVESALEN@
/*
* If this system needs AF_INET6, ISC_NET_NEEDAFINET6 will be defined.
*/
@ISC_NET_NEEDAFINET6@
/*
* If this system needs the IPv6 structure definitions, ISC_NET_HAVEIPV6
* will not be defined, and the structure definintions will be included.
*/
@ISC_NET_HAVEIPV6@
/***
*** Imports.
***/
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <isc/result.h>
#ifdef ISC_NET_NEEDAFINET6
#define AF_INET6 99
#define PF_INET6 AF_INET6
#endif
#ifndef ISC_NET_HAVEIPV6
#include <isc/ipv6.h>
#endif
/***
*** Functions.
***/
isc_result_t
isc_net_haveipv4(void);
/*
* Check if the system's kernel supports IPv4.
*
* Returns:
*
* ISC_R_SUCCESS IPv4 is supported.
* ISC_R_NOTFOUND IPv4 is not supported.
* ISC_R_UNEXPECTED
*/
isc_result_t
isc_net_haveipv6(void);
/*
* Check if the system's kernel supports IPv6.
*
* Returns:
*
* ISC_R_SUCCESS IPv6 is supported.
* ISC_R_NOTFOUND IPv6 is not supported.
* ISC_R_UNEXPECTED
*/
#endif /* ISC_NET_H */