Thu Mar 25 12:09:34 2010

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_STRLCAT
00066 size_t strlcat(char *dst, const char *src, size_t siz) attribute_deprecated;
00067 #endif
00068 
00069 #ifndef HAVE_STRLCPY
00070 size_t strlcpy(char *dst, const char *src, size_t siz) attribute_deprecated;
00071 #endif
00072 
00073 #ifdef SOLARIS
00074 #define __BEGIN_DECLS
00075 #define __END_DECLS
00076 
00077 #ifndef __P
00078 #define __P(p) p
00079 #endif
00080 
00081 #include <alloca.h>
00082 #include <strings.h>
00083 #include <string.h>
00084 #include <pthread.h>
00085 #include <sys/stat.h>
00086 #include <signal.h>
00087 #include <netinet/in.h>
00088 #include <sys/loadavg.h>
00089 #include <dat/dat_platform_specific.h>
00090 
00091 #ifndef BYTE_ORDER
00092 #define LITTLE_ENDIAN   1234
00093 #define BIG_ENDIAN   4321
00094 
00095 #ifdef __sparc__
00096 #define BYTE_ORDER   BIG_ENDIAN
00097 #else
00098 #define BYTE_ORDER   LITTLE_ENDIAN
00099 #endif
00100 #endif
00101 
00102 #ifndef __BYTE_ORDER
00103 #define __LITTLE_ENDIAN LITTLE_ENDIAN
00104 #define __BIG_ENDIAN BIG_ENDIAN
00105 #define __BYTE_ORDER BYTE_ORDER
00106 #endif
00107 
00108 #ifndef __BIT_TYPES_DEFINED__
00109 #define __BIT_TYPES_DEFINED__
00110 typedef unsigned char   u_int8_t;
00111 typedef unsigned short  u_int16_t;
00112 typedef unsigned int u_int32_t;
00113 typedef unsigned int uint;
00114 #endif
00115 
00116 #endif /* SOLARIS */
00117 
00118 #ifdef __CYGWIN__
00119 #define _WIN32_WINNT 0x0500
00120 #ifndef INET_ADDRSTRLEN
00121 #define INET_ADDRSTRLEN  16
00122 #endif
00123 #ifndef INET6_ADDRSTRLEN
00124 #define INET6_ADDRSTRLEN 46
00125 #endif
00126 #endif /* __CYGWIN__ */
00127 
00128 #ifdef __CYGWIN__
00129 typedef unsigned long long uint64_t;
00130 #endif
00131 
00132 /* glob compat stuff */ 
00133 #if defined(__Darwin__) || defined(__CYGWIN__)
00134 #define GLOB_ABORTED GLOB_ABEND
00135 #endif
00136 
00137 #if !defined(HAVE_GLOB_NOMAGIC) || !defined(HAVE_GLOB_BRACE)
00138 #define MY_GLOB_FLAGS   GLOB_NOCHECK
00139 #else
00140 #define MY_GLOB_FLAGS   (GLOB_NOMAGIC | GLOB_BRACE)
00141 #endif
00142 
00143 #endif

Generated on Thu Mar 25 12:09:34 2010 for Asterisk - the Open Source PBX by  doxygen 1.4.7