diff options
Diffstat (limited to 'sntp/internet.h')
-rw-r--r-- | sntp/internet.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/sntp/internet.h b/sntp/internet.h new file mode 100644 index 0000000..993dce6 --- /dev/null +++ b/sntp/internet.h @@ -0,0 +1,47 @@ +/* Copyright (C) 1996 N.M. Maclaren + Copyright (C) 1996 The University of Cambridge + +This includes all of the 'Internet' headers and definitions used across +modules, including those for handling timeouts. No changes should be needed +for any version of Unix with Internet (IP version 5) addressing, but would be +for other addressing domains. It needs <sys/socket.h> only because AF_INET is +needed by gethostbyaddr and is defined there rather than in <netdb.h>, for some +damn-fool reason. */ + + + +#include <setjmp.h> +#include <signal.h> + +#include <unistd.h> +#include <sys/types.h> +#include <netinet/in.h> +#include <sys/socket.h> + + + +/* It is most unclear whether these should be here or in kludges.h, as they are +kludges to keep 32-bit address dependencies out of the main body of internet.c, +to allow for the much heralded arrival of IP version 6. It will be interesting +to see whether the universal availability of 64-bit integers arrives first. */ + +#define local_to_address(x,y) ((x)->s_addr = htonl((unsigned long)y)) +#define network_to_address(x,y) ((x)->s_addr = (y)) + +#define NTP_PORT htons((unsigned short)123) /* If not in /etc/services */ +#define port_to_integer(x) (ntohs((unsigned short)(x))) + + +#if defined(_SS_MAXSIZE) || defined(_SS_SIZE) +#define HAVE_IPV6 +#endif + +/* Defined in internet.c */ +#ifdef HAVE_IPV6 +extern void find_address (struct sockaddr_storage *address, + struct sockaddr_storage *anywhere, struct sockaddr_storage *everwhere, + int *port, char *hostname, int timespan); +#else +extern void find_address (struct in_addr *address, struct in_addr *anywhere, + struct in_addr *everwhere, int *port, char *hostname, int timespan); +#endif |