]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - contrib/ntp/sntp/internet.h
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / contrib / ntp / sntp / internet.h
1 /*  Copyright (C) 1996 N.M. Maclaren
2     Copyright (C) 1996 The University of Cambridge
3
4 This includes all of the 'Internet' headers and definitions used across
5 modules, including those for handling timeouts.  No changes should be needed
6 for any version of Unix with Internet (IP version 5) addressing, but would be
7 for other addressing domains.  It needs <sys/socket.h> only because AF_INET is
8 needed by gethostbyaddr and is defined there rather than in <netdb.h>, for some
9 damn-fool reason. */
10
11
12
13 #include <setjmp.h>
14 #include <signal.h>
15
16 #include <unistd.h>
17 #include <sys/types.h>
18 #include <netinet/in.h>
19 #include <sys/socket.h>
20
21
22
23 /* It is most unclear whether these should be here or in kludges.h, as they are
24 kludges to keep 32-bit address dependencies out of the main body of internet.c,
25 to allow for the much heralded arrival of IP version 6.  It will be interesting
26 to see whether the universal availability of 64-bit integers arrives first. */
27
28 #define local_to_address(x,y) ((x)->s_addr = htonl((unsigned long)y))
29 #define network_to_address(x,y) ((x)->s_addr = (y))
30
31 #define NTP_PORT htons((unsigned short)123)    /* If not in /etc/services */
32 #define port_to_integer(x) (ntohs((unsigned short)(x)))
33
34
35 #if defined(_SS_MAXSIZE) || defined(_SS_SIZE)
36 #define HAVE_IPV6
37 #endif
38
39 /* Defined in internet.c */
40 #ifdef HAVE_IPV6
41 extern void find_address (struct sockaddr_storage *address,
42     struct sockaddr_storage *anywhere,
43     int *port, char *hostname, int timespan);
44 #else
45 extern void find_address (struct in_addr *address, struct in_addr *anywhere,
46     int *port, char *hostname, int timespan);
47 #endif