26 #ifndef _ASTERISK_NETWORK_H
27 #define _ASTERISK_NETWORK_H
29 #if defined(__cplusplus) || defined(c_plusplus)
40 #ifdef HAVE_ARPA_INET_H
41 #include <netinet/in.h>
42 #include <arpa/inet.h>
43 #include <netinet/in_systm.h>
44 #include <netinet/ip.h>
45 #include <netinet/tcp.h>
47 #include <sys/socket.h>
49 #include <sys/ioctl.h>
50 #elif defined(HAVE_WINSOCK_H)
52 typedef int socklen_t;
53 #elif defined(HAVE_WINSOCK2_H)
57 #error "don't know how to handle network functions here."
60 #ifndef HAVE_INET_ATON
61 int inet_aton(
const char *cp,
struct in_addr *pin);
68 #ifndef MAXHOSTNAMELEN
69 #define MAXHOSTNAMELEN 256
87 #define inet_ntoa __dont__use__inet_ntoa__use__ast_inet_ntoa__instead__
92 return ((sin1->sin_addr.s_addr != sin2->sin_addr.s_addr)
93 || (sin1->sin_port != sin2->sin_port));
96 #if defined(__cplusplus) || defined(c_plusplus)
static force_inline int inaddrcmp(const struct sockaddr_in *sin1, const struct sockaddr_in *sin2)
Compares the source address and port of two sockaddr_in.
const char * ast_inet_ntoa(struct in_addr ia)
thread-safe replacement for inet_ntoa().
int inet_aton(const char *cp, struct in_addr *pin)