Sat Aug 6 00:39:28 2011

Asterisk developer's documentation


compat.h

Go to the documentation of this file.
00001 /*
00002  * Asterisk -- A telephony toolkit for Linux.
00003  * 
00004  * Copyright (C) 1999-2006, Digium, Inc.
00005  *
00006  * Mark Spencer <markster@digium.com>
00007  *
00008  * This program is free software, distributed under the terms of
00009  * the GNU General Public License
00010  */
00011 
00012 /*! \file
00013  * \brief General Definitions for Asterisk top level program
00014  */
00015 
00016 #ifndef _COMPAT_H
00017 #define _COMPAT_H
00018 
00019 #include "asterisk/autoconfig.h"
00020 #include "asterisk/compiler.h"
00021 #include <inttypes.h>
00022 #include <sys/types.h>
00023 #include <stdarg.h>
00024 
00025 #if !defined(HAVE_ASPRINTF) && !defined(__AST_DEBUG_MALLOC)
00026 int asprintf(char **str, const char *fmt, ...);
00027 #endif
00028 
00029 #ifndef HAVE_GETLOADAVG
00030 int getloadavg(double *list, int nelem);
00031 #endif
00032 
00033 #ifndef HAVE_SETENV
00034 int setenv(const char *name, const char *value, int overwrite);
00035 #endif
00036 
00037 #ifndef HAVE_STRCASESTR
00038 char *strcasestr(const char *, const char *);
00039 #endif
00040 
00041 #if !defined(HAVE_STRNDUP) && !defined(__AST_DEBUG_MALLOC)
00042 char *strndup(const char *, size_t);
00043 #endif
00044 
00045 #ifndef HAVE_STRNLEN
00046 size_t strnlen(const char *, size_t);
00047 #endif
00048 
00049 #ifndef HAVE_STRSEP
00050 char* strsep(char** str, const char* delims);
00051 #endif
00052 
00053 #ifndef HAVE_STRTOQ
00054 uint64_t strtoq(const char *nptr, char **endptr, int base);
00055 #endif
00056 
00057 #ifndef HAVE_UNSETENV
00058 int unsetenv(const char *name);
00059 #endif
00060 
00061 #if !defined(HAVE_VASPRINTF) && !defined(__AST_DEBUG_MALLOC)
00062 int vasprintf(char **strp, const char *fmt, va_list ap);
00063 #endif
00064 
00065 #ifndef HAVE_TIMERSUB
00066 void timersub(struct timeval *tvend, struct timeval *tvstart, struct timeval *tvdiff);
00067 #endif
00068 
00069 #ifndef HAVE_STRLCAT
00070 size_t strlcat(char *dst, const char *src, size_t siz) attribute_deprecated;
00071 #endif
00072 
00073 #ifndef HAVE_STRLCPY
00074 size_t strlcpy(char *dst, const char *src, size_t siz) attribute_deprecated;
00075 #endif
00076 
00077 #ifdef SOLARIS
00078 #define __BEGIN_DECLS
00079 #define __END_DECLS
00080 
00081 #ifndef __P
00082 #define __P(p) p
00083 #endif
00084 
00085 #include <alloca.h>
00086 #include <strings.h>
00087 #include <string.h>
00088 #include <pthread.h>
00089 #include <sys/stat.h>
00090 #include <signal.h>
00091 #include <netinet/in.h>
00092 #include <sys/loadavg.h>
00093 #include <dat/dat_platform_specific.h>
00094 
00095 #ifndef BYTE_ORDER
00096 #define LITTLE_ENDIAN   1234
00097 #define BIG_ENDIAN   4321
00098 
00099 #ifdef __sparc__
00100 #define BYTE_ORDER   BIG_ENDIAN
00101 #else
00102 #define BYTE_ORDER   LITTLE_ENDIAN
00103 #endif
00104 #endif
00105 
00106 #ifndef __BYTE_ORDER
00107 #define __LITTLE_ENDIAN LITTLE_ENDIAN
00108 #define __BIG_ENDIAN BIG_ENDIAN
00109 #define __BYTE_ORDER BYTE_ORDER
00110 #endif
00111 
00112 #ifndef __BIT_TYPES_DEFINED__
00113 #define __BIT_TYPES_DEFINED__
00114 typedef unsigned char   u_int8_t;
00115 typedef unsigned short  u_int16_t;
00116 typedef unsigned int u_int32_t;
00117 typedef unsigned int uint;
00118 #endif
00119 
00120 #endif /* SOLARIS */
00121 
00122 #ifdef __CYGWIN__
00123 #define _WIN32_WINNT 0x0500
00124 #ifndef INET_ADDRSTRLEN
00125 #define INET_ADDRSTRLEN  16
00126 #endif
00127 #ifndef INET6_ADDRSTRLEN
00128 #define INET6_ADDRSTRLEN 46
00129 #endif
00130 #endif /* __CYGWIN__ */
00131 
00132 #ifdef __CYGWIN__
00133 typedef unsigned long long uint64_t;
00134 #endif
00135 
00136 /* glob compat stuff */ 
00137 #if defined(__Darwin__) || defined(__CYGWIN__)
00138 #define GLOB_ABORTED GLOB_ABEND
00139 #endif
00140 
00141 #if !defined(HAVE_GLOB_NOMAGIC) || !defined(HAVE_GLOB_BRACE)
00142 #define MY_GLOB_FLAGS   GLOB_NOCHECK
00143 #else
00144 #define MY_GLOB_FLAGS   (GLOB_NOMAGIC | GLOB_BRACE)
00145 #endif
00146 
00147 #endif

Generated on Sat Aug 6 00:39:28 2011 for Asterisk - the Open Source PBX by  doxygen 1.4.7