1 /* $NetBSD: socktoa.c,v 1.3 2006/03/18 12:40:48 kardel Exp $ */
4 * socktoa - return a numeric host name from a sockaddr_storage structure
10 #include <sys/socket.h>
11 #include <netinet/in.h>
13 #include <arpa/inet.h>
15 #ifdef ISC_PLATFORM_NEEDNTOP
22 #include "lib_strbuf.h"
23 #include "ntp_stdlib.h"
28 struct sockaddr_storage
* sock
31 register char *buffer
;
36 strcpy(buffer
, "null");
40 switch(sock
->ss_family
) {
44 inet_ntop(AF_INET
, &GET_INADDR(*sock
), buffer
,
49 inet_ntop(AF_INET6
, &GET_INADDR6(*sock
), buffer
,
53 strcpy(buffer
, "unknown");