00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef _ASTERISK_NETWORK_H
00027 #define _ASTERISK_NETWORK_H
00028
00029 #if defined(__cplusplus) || defined(c_plusplus)
00030 extern "C" {
00031 #endif
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifdef HAVE_ARPA_INET_H
00041 #include <netinet/in.h>
00042 #include <arpa/inet.h>
00043 #include <netinet/in_systm.h>
00044 #include <netinet/ip.h>
00045 #include <netinet/tcp.h>
00046 #include <netdb.h>
00047 #include <sys/socket.h>
00048 #elif defined(HAVE_WINSOCK_H)
00049 #include <winsock.h>
00050 typedef int socklen_t;
00051 #elif defined(HAVE_WINSOCK2_H)
00052 #include <winsock2.h>
00053 #include <ws2tcpip.h>
00054 #else
00055 #error "don't know how to handle network functions here."
00056 #endif
00057
00058 #ifndef HAVE_INET_ATON
00059 int inet_aton(const char *cp, struct in_addr *pin);
00060 #endif
00061
00062 #ifndef IFNAMSIZ
00063 #define IFNAMSIZ 16
00064 #endif
00065
00066 #ifndef MAXHOSTNAMELEN
00067 #define MAXHOSTNAMELEN 256
00068 #endif
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080 const char *ast_inet_ntoa(struct in_addr ia);
00081
00082 #ifdef inet_ntoa
00083 #undef inet_ntoa
00084 #endif
00085 #define inet_ntoa __dont__use__inet_ntoa__use__ast_inet_ntoa__instead__
00086
00087
00088 static force_inline int inaddrcmp(const struct sockaddr_in *sin1, const struct sockaddr_in *sin2)
00089 {
00090 return ((sin1->sin_addr.s_addr != sin2->sin_addr.s_addr)
00091 || (sin1->sin_port != sin2->sin_port));
00092 }
00093
00094 #if defined(__cplusplus) || defined(c_plusplus)
00095 }
00096 #endif
00097
00098 #endif