1: /*
2: * socktoa - return a numeric host name from a sockaddr_storage structure
3: */
4: #include <sys/types.h>
5: #ifdef HAVE_SYS_SOCKET_H
6: #include <sys/socket.h>
7: #endif
8: #ifdef HAVE_NETINET_IN_H
9: #include <netinet/in.h>
10: #endif
11:
12: #include <arpa/inet.h>
13:
14: #include <stdio.h>
15:
16: #include "ntp_fp.h"
17: #include "lib_strbuf.h"
18: #include "ntp_stdlib.h"
19: #include "ntp.h"
20:
21:
22: char *
23: socktohost(
24: const sockaddr_u *sock
25: )
26: {
27: register char *buffer;
28:
29: LIB_GETBUF(buffer);
30: if (getnameinfo(&sock->sa, SOCKLEN(sock), buffer,
31: LIB_BUFLENGTH, NULL, 0, 0))
32: return stoa(sock);
33:
34: return buffer;
35: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>