mirror of
https://github.com/isc-projects/bind9.git
synced 2026-02-25 19:04:57 -05:00
First stab at NT networking interface via the ISC header files.
Though source modules things compile, no programs have yet been built and tested that actually use networking (as opposed to support functions, like inet_aton).
This commit is contained in:
parent
2af4e7e0e6
commit
b8255b5084
2 changed files with 268 additions and 0 deletions
91
lib/isc/win32/include/isc/ipv6.h
Normal file
91
lib/isc/win32/include/isc/ipv6.h
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* 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_IPV6_H
|
||||
#define ISC_IPV6_H 1
|
||||
|
||||
/*****
|
||||
***** Module Info
|
||||
*****/
|
||||
|
||||
/*
|
||||
* IPv6 definitions for systems which do not support IPv6.
|
||||
*
|
||||
* MP:
|
||||
* No impact.
|
||||
*
|
||||
* Reliability:
|
||||
* No anticipated impact.
|
||||
*
|
||||
* Resources:
|
||||
* N/A.
|
||||
*
|
||||
* Security:
|
||||
* No anticipated impact.
|
||||
*
|
||||
* Standards:
|
||||
* RFC 2553.
|
||||
*/
|
||||
|
||||
/***
|
||||
*** Imports.
|
||||
***/
|
||||
|
||||
#include <isc/lang.h>
|
||||
#include <isc/int.h>
|
||||
|
||||
ISC_LANG_BEGINDECLS
|
||||
|
||||
/***
|
||||
*** Types.
|
||||
***/
|
||||
|
||||
struct in6_addr {
|
||||
union {
|
||||
isc_uint8_t _S6_u8[16];
|
||||
isc_uint32_t _S6_u32[4];
|
||||
isc_uint64_t _S6_u64[2];
|
||||
} _S6_un;
|
||||
};
|
||||
#define s6_addr _S6_un._S6_u8
|
||||
|
||||
#define IN6ADDR_ANY_INIT {{{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }}}
|
||||
#define IN6ADDR_LOOPBACK_INIT {{{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 }}}
|
||||
|
||||
extern struct in6_addr in6addr_any;
|
||||
extern struct in6_addr in6addr_loopback;
|
||||
|
||||
struct sockaddr_in6 {
|
||||
#ifdef ISC_NET_HAVESALEN
|
||||
isc_uint8_t sin6_len;
|
||||
isc_uint8_t sin6_family;
|
||||
#else
|
||||
isc_uint16_t sin6_family;
|
||||
#endif
|
||||
isc_uint16_t sin6_port;
|
||||
isc_uint32_t sin6_flowinfo;
|
||||
struct in6_addr sin6_addr;
|
||||
isc_uint32_t sin6_scope_id;
|
||||
};
|
||||
|
||||
#ifdef ISC_NET_HAVESALEN
|
||||
#define SIN6_LEN 1
|
||||
#endif
|
||||
|
||||
ISC_LANG_ENDDECLS
|
||||
|
||||
#endif /* ISC_IPV6_H */
|
||||
177
lib/isc/win32/include/isc/net.h
Normal file
177
lib/isc/win32/include/isc/net.h
Normal file
|
|
@ -0,0 +1,177 @@
|
|||
/*
|
||||
* 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().
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
#undef ISC_NET_HAVESALEN
|
||||
|
||||
/*
|
||||
* If this system has the IPv6 structure definitions, ISC_NET_HAVEIPV6
|
||||
* will be defined.
|
||||
*/
|
||||
#undef ISC_NET_HAVEIPV6
|
||||
|
||||
/*
|
||||
* If this system needs inet_ntop(), ISC_NET_NEEDNTOP will be defined.
|
||||
*/
|
||||
#define ISC_NET_NEEDNTOP 1
|
||||
|
||||
/*
|
||||
* If this system needs inet_pton(), ISC_NET_NEEDPTON will be defined.
|
||||
*/
|
||||
#undef ISC_NET_NEEDPTON
|
||||
|
||||
/*
|
||||
* If this system needs inet_aton(), ISC_NET_NEEDATON will be defined.
|
||||
*/
|
||||
#define ISC_NET_NEEDATON
|
||||
|
||||
/***
|
||||
*** Imports.
|
||||
***/
|
||||
|
||||
#ifndef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0400 /* Ensures windows.h includes winsock2.h. */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Because of some sort of problem in the MS header files, this cannot
|
||||
* be simple "#include <winsock2.h>", because winsock2.h tries to include
|
||||
* windows.h, which then generates an error out of mswsock.h. _You_
|
||||
* figure it out.
|
||||
*/
|
||||
#include <windows.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <isc/result.h>
|
||||
|
||||
#ifndef AF_INET6
|
||||
#define AF_INET6 99
|
||||
#endif
|
||||
|
||||
#ifndef PF_INET6
|
||||
#define PF_INET6 AF_INET6
|
||||
#endif
|
||||
|
||||
#ifndef ISC_NET_HAVEIPV6
|
||||
#include <isc/ipv6.h>
|
||||
#endif
|
||||
|
||||
/***
|
||||
*** Functions.
|
||||
***/
|
||||
|
||||
isc_result_t
|
||||
isc_net_probeipv4(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_probeipv6(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
|
||||
*/
|
||||
|
||||
#ifdef ISC_NET_NEEDNTOP
|
||||
const char *isc_net_ntop(int af, const void *src, char *dst, size_t size);
|
||||
#define inet_ntop isc_net_ntop
|
||||
#endif
|
||||
|
||||
#ifdef ISC_NET_NEEDPTON
|
||||
int isc_net_pton(int af, const char *src, void *dst);
|
||||
#define inet_pton isc_net_pton
|
||||
#endif
|
||||
|
||||
#ifdef ISC_NET_NEEDATON
|
||||
int isc_net_aton(const char *cp, struct in_addr *addr);
|
||||
#define inet_aton isc_net_aton
|
||||
#endif
|
||||
|
||||
#endif /* ISC_NET_H */
|
||||
|
||||
/*
|
||||
* Tell emacs to use C mode for this file.
|
||||
*
|
||||
* Local Variables:
|
||||
* mode: c
|
||||
* End:
|
||||
*/
|
||||
Loading…
Reference in a new issue