mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-04 16:45:24 +00:00
174. [func] New public function isc_sockaddr_format(), for
formatting socket addresses in log messages.
This commit is contained in:
3
CHANGES
3
CHANGES
@@ -1,3 +1,6 @@
|
||||
174. [func] New public function isc_sockaddr_format(), for
|
||||
formatting socket addresses in log messages.
|
||||
|
||||
173. [func] Keep a queue of zones waiting for zone transfer
|
||||
quota so that a new transfer can be dispatched
|
||||
immediately whenever quota becomes available.
|
||||
|
@@ -111,6 +111,14 @@ isc_sockaddr_totext(const isc_sockaddr_t *sockaddr, isc_buffer_t *target);
|
||||
* ISC_R_NOSPACE The text or the null termination did not fit.
|
||||
*/
|
||||
|
||||
void
|
||||
isc_sockaddr_format(isc_sockaddr_t *sa, char *array, unsigned int size);
|
||||
/*
|
||||
* Format a human-readable representation of the socket address '*sa'
|
||||
* into the character array 'array', which is of size 'size'.
|
||||
* The resulting string is guaranteed to be null-terminated.
|
||||
*/
|
||||
|
||||
ISC_LANG_ENDDECLS
|
||||
|
||||
#endif /* ISC_SOCKADDR_H */
|
||||
|
@@ -155,6 +155,21 @@ isc_sockaddr_totext(const isc_sockaddr_t *sockaddr, isc_buffer_t *target) {
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
void
|
||||
isc_sockaddr_format(isc_sockaddr_t *sa, char *array, unsigned int size) {
|
||||
isc_result_t result;
|
||||
isc_buffer_t buf;
|
||||
|
||||
isc_buffer_init(&buf, array, size);
|
||||
result = isc_sockaddr_totext(sa, &buf);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
snprintf(array, size,
|
||||
"<unknown address, family %u>",
|
||||
sa->type.sa.sa_family);
|
||||
array[size - 1] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int
|
||||
isc_sockaddr_hash(const isc_sockaddr_t *sockaddr, isc_boolean_t address_only) {
|
||||
unsigned int length;
|
||||
|
Reference in New Issue
Block a user