~ubuntu-branches/debian/squeeze/ntp/squeeze-201010051545

« back to all changes in this revision

Viewing changes to libntp/socktohost.c

  • Committer: Bazaar Package Importer
  • Author(s): Matt Zimmerman
  • Date: 2004-10-11 16:10:27 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20041011161027-icyjbji8ujym633o
Tags: 1:4.2.0a-10ubuntu2
Use ntp.ubuntulinux.org instead of pool.ntp.org

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * socktoa - return a numeric host name from a sockaddr_storage structure
 
3
 */
 
4
#include <sys/types.h>
 
5
#include <sys/socket.h>
 
6
#include <netdb.h>
 
7
#include <netinet/in.h>
 
8
 
 
9
#include <arpa/inet.h>
 
10
 
 
11
#include <stdio.h>
 
12
 
 
13
#include "ntp_fp.h"
 
14
#include "lib_strbuf.h"
 
15
#include "ntp_stdlib.h"
 
16
#include "ntp.h"
 
17
 
 
18
 
 
19
char *
 
20
socktohost(
 
21
        struct sockaddr_storage* sock
 
22
        )
 
23
{
 
24
        register char *buffer;
 
25
 
 
26
        LIB_GETBUF(buffer);
 
27
        if (getnameinfo((struct sockaddr *)sock, SOCKLEN(sock), buffer,
 
28
            LIB_BUFLENGTH /* NI_MAXHOST*/, NULL, 0, 0))
 
29
                return stoa(sock);
 
30
 
 
31
        return buffer;
 
32
}