2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

174. [func] New public function isc_sockaddr_format(), for

formatting socket addresses in log messages.
This commit is contained in:
Andreas Gustafsson
2000-05-14 20:42:43 +00:00
parent f7d85bae58
commit 527ea00c17
3 changed files with 26 additions and 0 deletions

View File

@@ -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;