00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef _COMPAT_H
00017 #define _COMPAT_H
00018
00019 #include "asterisk/autoconfig.h"
00020 #include <inttypes.h>
00021 #include <sys/types.h>
00022 #include <stdarg.h>
00023
00024 #if !defined(HAVE_ASPRINTF) && !defined(__AST_DEBUG_MALLOC)
00025 int asprintf(char **str, const char *fmt, ...);
00026 #endif
00027
00028 #ifndef HAVE_GETLOADAVG
00029 int getloadavg(double *list, int nelem);
00030 #endif
00031
00032 #ifndef HAVE_SETENV
00033 int setenv(const char *name, const char *value, int overwrite);
00034 #endif
00035
00036 #ifndef HAVE_STRCASESTR
00037 char *strcasestr(const char *, const char *);
00038 #endif
00039
00040 #if !defined(HAVE_STRNDUP) && !defined(__AST_DEBUG_MALLOC)
00041 char *strndup(const char *, size_t);
00042 #endif
00043
00044 #ifndef HAVE_STRNLEN
00045 size_t strnlen(const char *, size_t);
00046 #endif
00047
00048 #ifndef HAVE_STRSEP
00049 char* strsep(char** str, const char* delims);
00050 #endif
00051
00052 #ifndef HAVE_STRTOQ
00053 uint64_t strtoq(const char *nptr, char **endptr, int base);
00054 #endif
00055
00056 #ifndef HAVE_UNSETENV
00057 int unsetenv(const char *name);
00058 #endif
00059
00060 #if !defined(HAVE_VASPRINTF) && !defined(__AST_DEBUG_MALLOC)
00061 int vasprintf(char **strp, const char *fmt, va_list ap);
00062 #endif
00063
00064 #ifndef HAVE_STRLCAT
00065 size_t strlcat(char *dst, const char *src, size_t siz);
00066 #endif
00067
00068 #ifndef HAVE_STRLCPY
00069 size_t strlcpy(char *dst, const char *src, size_t siz);
00070 #endif
00071
00072 #ifdef SOLARIS
00073 #define __BEGIN_DECLS
00074 #define __END_DECLS
00075
00076 #ifndef __P
00077 #define __P(p) p
00078 #endif
00079
00080 #include <alloca.h>
00081 #include <strings.h>
00082 #include <string.h>
00083 #include <pthread.h>
00084 #include <sys/stat.h>
00085 #include <signal.h>
00086 #include <netinet/in.h>
00087 #include <sys/loadavg.h>
00088 #include <dat/dat_platform_specific.h>
00089
00090 #ifndef BYTE_ORDER
00091 #define LITTLE_ENDIAN 1234
00092 #define BIG_ENDIAN 4321
00093
00094 #ifdef __sparc__
00095 #define BYTE_ORDER BIG_ENDIAN
00096 #else
00097 #define BYTE_ORDER LITTLE_ENDIAN
00098 #endif
00099 #endif
00100
00101 #ifndef __BYTE_ORDER
00102 #define __LITTLE_ENDIAN LITTLE_ENDIAN
00103 #define __BIG_ENDIAN BIG_ENDIAN
00104 #define __BYTE_ORDER BYTE_ORDER
00105 #endif
00106
00107 #ifndef __BIT_TYPES_DEFINED__
00108 #define __BIT_TYPES_DEFINED__
00109 typedef unsigned char u_int8_t;
00110 typedef unsigned short u_int16_t;
00111 typedef unsigned int u_int32_t;
00112 #endif
00113
00114 #endif
00115
00116 #ifdef __CYGWIN__
00117 #define _WIN32_WINNT 0x0500
00118 #ifndef INET_ADDRSTRLEN
00119 #define INET_ADDRSTRLEN 16
00120 #endif
00121 #ifndef INET6_ADDRSTRLEN
00122 #define INET6_ADDRSTRLEN 46
00123 #endif
00124 #endif
00125
00126 #ifdef __CYGWIN__
00127 typedef unsigned long long uint64_t;
00128 #endif
00129
00130 #endif