File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / ntp / libntp / socktohost.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue May 29 12:08:38 2012 UTC (12 years, 5 months ago) by misho
Branches: ntp, MAIN
CVS tags: v4_2_6p5p0, v4_2_6p5, HEAD
ntp 4.2.6p5

    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>