Fri Aug 24 02:22:14 2007

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 <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 <dat/dat_platform_specific.h>
00088 
00089 #ifndef BYTE_ORDER
00090 #define LITTLE_ENDIAN   1234
00091 #define BIG_ENDIAN   4321
00092 
00093 #ifdef __sparc__
00094 #define BYTE_ORDER   BIG_ENDIAN
00095 #else
00096 #define BYTE_ORDER   LITTLE_ENDIAN
00097 #endif
00098 #endif
00099 
00100 #ifndef __BYTE_ORDER
00101 #define __LITTLE_ENDIAN LITTLE_ENDIAN
00102 #define __BIG_ENDIAN BIG_ENDIAN
00103 #define __BYTE_ORDER BYTE_ORDER
00104 #endif
00105 
00106 #ifndef __BIT_TYPES_DEFINED__
00107 #define __BIT_TYPES_DEFINED__
00108 typedef unsigned char   u_int8_t;
00109 typedef unsigned short  u_int16_t;
00110 typedef unsigned int u_int32_t;
00111 #endif
00112 
00113 #endif /* SOLARIS */
00114 
00115 #ifdef __CYGWIN__
00116 #define _WIN32_WINNT 0x0500
00117 #ifndef INET_ADDRSTRLEN
00118 #define INET_ADDRSTRLEN  16
00119 #endif
00120 #ifndef INET6_ADDRSTRLEN
00121 #define INET6_ADDRSTRLEN 46
00122 #endif
00123 #endif /* __CYGWIN__ */
00124 
00125 #ifdef __CYGWIN__
00126 typedef unsigned long long uint64_t;
00127 #endif
00128 
00129 #endif

Generated on Fri Aug 24 02:22:14 2007 for Asterisk - the Open Source PBX by  doxygen 1.5.1