Commit 527ea00c authored by Andreas Gustafsson's avatar Andreas Gustafsson
Browse files

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

                        formatting socket addresses in log messages.
parent f7d85bae
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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment