Psyduck - 可達鴨 之 鴨力山大2


Server : LiteSpeed
System : Linux premium217.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User : alloknri ( 880)
PHP Version : 8.1.34
Disable Function : NONE
Directory :  /usr/include/bind9/isc/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/include/bind9/isc/netaddr.h
/*
 * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, you can obtain one at https://mozilla.org/MPL/2.0/.
 *
 * See the COPYRIGHT file distributed with this work for additional
 * information regarding copyright ownership.
 */


#ifndef ISC_NETADDR_H
#define ISC_NETADDR_H 1

/*! \file isc/netaddr.h */

#include <inttypes.h>
#include <stdbool.h>

#include <isc/lang.h>
#include <isc/net.h>
#include <isc/types.h>

#ifdef ISC_PLATFORM_HAVESYSUNH
#include <sys/types.h>
#include <sys/un.h>
#endif

ISC_LANG_BEGINDECLS

struct isc_netaddr {
	unsigned int family;
	union {
		struct in_addr in;
		struct in6_addr in6;
#ifdef ISC_PLATFORM_HAVESYSUNH
		char un[sizeof(((struct sockaddr_un *)0)->sun_path)];
#endif
	} type;
	uint32_t zone;
};

bool
isc_netaddr_equal(const isc_netaddr_t *a, const isc_netaddr_t *b);

/*%<
 * Compare network addresses 'a' and 'b'.  Return #true if
 * they are equal, #false if not.
 */

bool
isc_netaddr_eqprefix(const isc_netaddr_t *a, const isc_netaddr_t *b,
		     unsigned int prefixlen);
/*%<
 * Compare the 'prefixlen' most significant bits of the network
 * addresses 'a' and 'b'.  If 'b''s scope is zero then 'a''s scope is
 * ignored.  Return #true if they are equal, #false if not.
 */

isc_result_t
isc_netaddr_masktoprefixlen(const isc_netaddr_t *s, unsigned int *lenp);
/*%<
 * Convert a netmask in 's' into a prefix length in '*lenp'.
 * The mask should consist of zero or more '1' bits in the
 * most significant part of the address, followed by '0' bits.
 * If this is not the case, #ISC_R_MASKNONCONTIG is returned.
 *
 * Returns:
 *\li	#ISC_R_SUCCESS
 *\li	#ISC_R_MASKNONCONTIG
 */

isc_result_t
isc_netaddr_totext(const isc_netaddr_t *netaddr, isc_buffer_t *target);
/*%<
 * Append a text representation of 'sockaddr' to the buffer 'target'.
 * The text is NOT null terminated.  Handles IPv4 and IPv6 addresses.
 *
 * Returns:
 *\li	#ISC_R_SUCCESS
 *\li	#ISC_R_NOSPACE	The text or the null termination did not fit.
 *\li	#ISC_R_FAILURE	Unspecified failure
 */

void
isc_netaddr_format(const isc_netaddr_t *na, char *array, unsigned int size);
/*%<
 * Format a human-readable representation of the network address '*na'
 * into the character array 'array', which is of size 'size'.
 * The resulting string is guaranteed to be null-terminated.
 */

#define ISC_NETADDR_FORMATSIZE \
	sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:XXX.XXX.XXX.XXX%SSSSSSSSSS")
/*%<
 * Minimum size of array to pass to isc_netaddr_format().
 */

void
isc_netaddr_fromsockaddr(isc_netaddr_t *netaddr, const isc_sockaddr_t *source);

void
isc_netaddr_fromin(isc_netaddr_t *netaddr, const struct in_addr *ina);

void
isc_netaddr_fromin6(isc_netaddr_t *netaddr, const struct in6_addr *ina6);

isc_result_t
isc_netaddr_frompath(isc_netaddr_t *netaddr, const char *path);

void
isc_netaddr_setzone(isc_netaddr_t *netaddr, uint32_t zone);

uint32_t
isc_netaddr_getzone(const isc_netaddr_t *netaddr);

void
isc_netaddr_any(isc_netaddr_t *netaddr);
/*%<
 * Return the IPv4 wildcard address.
 */

void
isc_netaddr_any6(isc_netaddr_t *netaddr);
/*%<
 * Return the IPv6 wildcard address.
 */

bool
isc_netaddr_ismulticast(isc_netaddr_t *na);
/*%<
 * Returns true if the address is a multicast address.
 */

bool
isc_netaddr_isexperimental(isc_netaddr_t *na);
/*%<
 * Returns true if the address is a experimental (CLASS E) address.
 */

bool
isc_netaddr_islinklocal(isc_netaddr_t *na);
/*%<
 * Returns #true if the address is a link local address.
 */

bool
isc_netaddr_issitelocal(isc_netaddr_t *na);
/*%<
 * Returns #true if the address is a site local address.
 */

bool
isc_netaddr_isnetzero(isc_netaddr_t *na);
/*%<
 * Returns #true if the address is in net zero.
 */

void
isc_netaddr_fromv4mapped(isc_netaddr_t *t, const isc_netaddr_t *s);
/*%<
 * Convert an IPv6 v4mapped address into an IPv4 address.
 */

isc_result_t
isc_netaddr_prefixok(const isc_netaddr_t *na, unsigned int prefixlen);
/*
 * Test whether the netaddr 'na' and 'prefixlen' are consistent.
 * e.g. prefixlen within range.
 *      na does not have bits set which are not covered by the prefixlen.
 *
 * Returns:
 *	ISC_R_SUCCESS
 *	ISC_R_RANGE		prefixlen out of range
 *	ISC_R_NOTIMPLEMENTED	unsupported family
 *	ISC_R_FAILURE		extra bits.
 */

bool
isc_netaddr_isloopback(const isc_netaddr_t *na);
/*
 * Test whether the netaddr 'na' is a loopback IPv4 or IPv6 address (in
 * 127.0.0.0/8 or ::1).
 */
ISC_LANG_ENDDECLS

#endif /* ISC_NETADDR_H */
Name
Size
Permissions
Options
aes.h
1.055 KB
-rw-r--r--
app.h
10.232 KB
-rw-r--r--
assertions.h
2.839 KB
-rw-r--r--
atomic.h
4.07 KB
-rw-r--r--
backtrace.h
3.8 KB
-rw-r--r--
base32.h
4.349 KB
-rw-r--r--
base64.h
2.799 KB
-rw-r--r--
bind9.h
0.811 KB
-rw-r--r--
boolean.h
0.58 KB
-rw-r--r--
buffer.h
25.652 KB
-rw-r--r--
bufferlist.h
1.418 KB
-rw-r--r--
cmocka.h
1.351 KB
-rw-r--r--
commandline.h
1.673 KB
-rw-r--r--
condition.h
1.443 KB
-rw-r--r--
counter.h
1.881 KB
-rw-r--r--
crc64.h
0.975 KB
-rw-r--r--
deprecated.h
0.608 KB
-rw-r--r--
dir.h
1.561 KB
-rw-r--r--
endian.h
4.666 KB
-rw-r--r--
entropy.h
10.13 KB
-rw-r--r--
errno.h
0.644 KB
-rw-r--r--
errno2result.h
0.881 KB
-rw-r--r--
error.h
1.396 KB
-rw-r--r--
event.h
2.981 KB
-rw-r--r--
eventclass.h
1.349 KB
-rw-r--r--
file.h
11.394 KB
-rw-r--r--
formatcheck.h
0.872 KB
-rw-r--r--
fsaccess.h
7.268 KB
-rw-r--r--
hash.h
7.482 KB
-rw-r--r--
heap.h
5.141 KB
-rw-r--r--
hex.h
2.74 KB
-rw-r--r--
hmacmd5.h
1.745 KB
-rw-r--r--
hmacsha.h
4.405 KB
-rw-r--r--
ht.h
4.293 KB
-rw-r--r--
httpd.h
2.264 KB
-rw-r--r--
int.h
1.063 KB
-rw-r--r--
interfaceiter.h
3.047 KB
-rw-r--r--
iterated_hash.h
1.021 KB
-rw-r--r--
json.h
1.425 KB
-rw-r--r--
keyboard.h
0.966 KB
-rw-r--r--
lang.h
0.622 KB
-rw-r--r--
lex.h
9.542 KB
-rw-r--r--
lfsr.h
2.889 KB
-rw-r--r--
lib.h
1.043 KB
-rw-r--r--
likely.h
0.799 KB
-rw-r--r--
list.h
5.616 KB
-rw-r--r--
log.h
28.061 KB
-rw-r--r--
magic.h
0.971 KB
-rw-r--r--
md5.h
2.324 KB
-rw-r--r--
mem.h
20.615 KB
-rw-r--r--
meminfo.h
0.693 KB
-rw-r--r--
msgcat.h
2.662 KB
-rw-r--r--
msgs.h
8.225 KB
-rw-r--r--
mutex.h
3.441 KB
-rw-r--r--
mutexblock.h
1.343 KB
-rw-r--r--
net.h
10.287 KB
-rw-r--r--
netaddr.h
4.482 KB
-rw-r--r--
netdb.h
0.843 KB
-rw-r--r--
netscope.h
0.944 KB
-rw-r--r--
offset.h
0.684 KB
-rw-r--r--
once.h
0.96 KB
-rw-r--r--
ondestroy.h
2.733 KB
-rw-r--r--
os.h
0.655 KB
-rw-r--r--
parseint.h
1.506 KB
-rw-r--r--
platform.h
9.489 KB
-rw-r--r--
pool.h
3.42 KB
-rw-r--r--
portset.h
3.218 KB
-rw-r--r--
print.h
2.417 KB
-rw-r--r--
queue.h
5.082 KB
-rw-r--r--
quota.h
2.383 KB
-rw-r--r--
radix.h
6.339 KB
-rw-r--r--
random.h
3.498 KB
-rw-r--r--
ratelimiter.h
3.415 KB
-rw-r--r--
refcount.h
8.001 KB
-rw-r--r--
regex.h
0.749 KB
-rw-r--r--
region.h
1.986 KB
-rw-r--r--
resource.h
2.795 KB
-rw-r--r--
result.h
4.865 KB
-rw-r--r--
resultclass.h
1.562 KB
-rw-r--r--
rwlock.h
3.718 KB
-rw-r--r--
safe.h
1.32 KB
-rw-r--r--
serial.h
1.336 KB
-rw-r--r--
sha1.h
1.52 KB
-rw-r--r--
sha2.h
5.599 KB
-rw-r--r--
siphash.h
0.717 KB
-rw-r--r--
sockaddr.h
5.897 KB
-rw-r--r--
socket.h
35.796 KB
-rw-r--r--
stat.h
0.787 KB
-rw-r--r--
stats.h
3.622 KB
-rw-r--r--
stdatomic.h
5.127 KB
-rw-r--r--
stdio.h
1.745 KB
-rw-r--r--
stdlib.h
0.688 KB
-rw-r--r--
stdtime.h
1.04 KB
-rw-r--r--
strerror.h
0.759 KB
-rw-r--r--
string.h
5.878 KB
-rw-r--r--
symtab.h
4.225 KB
-rw-r--r--
syslog.h
0.824 KB
-rw-r--r--
task.h
21.039 KB
-rw-r--r--
taskpool.h
3.622 KB
-rw-r--r--
thread.h
1.471 KB
-rw-r--r--
time.h
8.668 KB
-rw-r--r--
timer.h
10.542 KB
-rw-r--r--
tm.h
0.874 KB
-rw-r--r--
types.h
5.645 KB
-rw-r--r--
utf8.h
0.906 KB
-rw-r--r--
util.h
10.29 KB
-rw-r--r--
version.h
0.673 KB
-rw-r--r--
xml.h
1.068 KB
-rw-r--r--