1132451Sroberto/* Copyright (C) 1996 N.M. Maclaren 2132451Sroberto Copyright (C) 1996 The University of Cambridge 3132451Sroberto 4132451SrobertoThis includes all of the 'Internet' headers and definitions used across 5132451Srobertomodules, including those for handling timeouts. No changes should be needed 6132451Srobertofor any version of Unix with Internet (IP version 5) addressing, but would be 7132451Srobertofor other addressing domains. It needs <sys/socket.h> only because AF_INET is 8132451Srobertoneeded by gethostbyaddr and is defined there rather than in <netdb.h>, for some 9132451Srobertodamn-fool reason. */ 10132451Sroberto 11132451Sroberto 12132451Sroberto 13132451Sroberto#include <setjmp.h> 14132451Sroberto#include <signal.h> 15132451Sroberto 16132451Sroberto#include <unistd.h> 17132451Sroberto#include <sys/types.h> 18132451Sroberto#include <netinet/in.h> 19132451Sroberto#include <sys/socket.h> 20132451Sroberto 21132451Sroberto 22132451Sroberto 23132451Sroberto/* It is most unclear whether these should be here or in kludges.h, as they are 24132451Srobertokludges to keep 32-bit address dependencies out of the main body of internet.c, 25132451Srobertoto allow for the much heralded arrival of IP version 6. It will be interesting 26132451Srobertoto see whether the universal availability of 64-bit integers arrives first. */ 27132451Sroberto 28132451Sroberto#define local_to_address(x,y) ((x)->s_addr = htonl((unsigned long)y)) 29132451Sroberto#define network_to_address(x,y) ((x)->s_addr = (y)) 30132451Sroberto 31132451Sroberto#define NTP_PORT htons((unsigned short)123) /* If not in /etc/services */ 32132451Sroberto#define port_to_integer(x) (ntohs((unsigned short)(x))) 33132451Sroberto 34132451Sroberto 35132451Sroberto#if defined(_SS_MAXSIZE) || defined(_SS_SIZE) 36132451Sroberto#define HAVE_IPV6 37132451Sroberto#endif 38132451Sroberto 39132451Sroberto/* Defined in internet.c */ 40132451Sroberto#ifdef HAVE_IPV6 41132451Srobertoextern void find_address (struct sockaddr_storage *address, 42182007Sroberto struct sockaddr_storage *anywhere, 43132451Sroberto int *port, char *hostname, int timespan); 44132451Sroberto#else 45132451Srobertoextern void find_address (struct in_addr *address, struct in_addr *anywhere, 46182007Sroberto int *port, char *hostname, int timespan); 47132451Sroberto#endif 48