network.h
Go to the documentation of this file.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 #include <net/if.h>
00049 #include <sys/ioctl.h>
00050 #elif defined(HAVE_WINSOCK_H)
00051 #include <winsock.h>
00052 typedef int socklen_t;
00053 #elif defined(HAVE_WINSOCK2_H)
00054 #include <winsock2.h>
00055 #include <ws2tcpip.h>
00056 #else
00057 #error "don't know how to handle network functions here."
00058 #endif
00059
00060 #ifndef HAVE_INET_ATON
00061 int inet_aton(const char *cp, struct in_addr *pin);
00062 #endif
00063
00064 #ifndef IFNAMSIZ
00065 #define IFNAMSIZ 16
00066 #endif
00067
00068 #ifndef MAXHOSTNAMELEN
00069 #define MAXHOSTNAMELEN 256
00070 #endif
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082 const char *ast_inet_ntoa(struct in_addr ia);
00083
00084 #ifdef inet_ntoa
00085 #undef inet_ntoa
00086 #endif
00087 #define inet_ntoa __dont__use__inet_ntoa__use__ast_inet_ntoa__instead__
00088
00089
00090 static force_inline int inaddrcmp(const struct sockaddr_in *sin1, const struct sockaddr_in *sin2)
00091 {
00092 return ((sin1->sin_addr.s_addr != sin2->sin_addr.s_addr)
00093 || (sin1->sin_port != sin2->sin_port));
00094 }
00095
00096 #if defined(__cplusplus) || defined(c_plusplus)
00097 }
00098 #endif
00099
00100 #endif