![]() |
Home page |
Mailing list |
Docs
Asterisk developer's documentation :: Codename Pineapple
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 #ifdef SOLARIS 00065 #define __BEGIN_DECLS 00066 #define __END_DECLS 00067 00068 #ifndef __P 00069 #define __P(p) p 00070 #endif 00071 00072 #include <alloca.h> 00073 #include <strings.h> 00074 #include <string.h> 00075 #include <pthread.h> 00076 #include <sys/stat.h> 00077 #include <signal.h> 00078 #include <netinet/in.h> 00079 #include <dat/dat_platform_specific.h> 00080 00081 #ifndef BYTE_ORDER 00082 #define LITTLE_ENDIAN 1234 00083 #define BIG_ENDIAN 4321 00084 00085 #ifdef __sparc__ 00086 #define BYTE_ORDER BIG_ENDIAN 00087 #else 00088 #define BYTE_ORDER LITTLE_ENDIAN 00089 #endif 00090 #endif 00091 00092 #ifndef __BYTE_ORDER 00093 #define __LITTLE_ENDIAN LITTLE_ENDIAN 00094 #define __BIG_ENDIAN BIG_ENDIAN 00095 #define __BYTE_ORDER BYTE_ORDER 00096 #endif 00097 00098 #ifndef __BIT_TYPES_DEFINED__ 00099 #define __BIT_TYPES_DEFINED__ 00100 typedef unsigned char u_int8_t; 00101 typedef unsigned short u_int16_t; 00102 typedef unsigned int u_int32_t; 00103 #endif 00104 00105 #endif /* SOLARIS */ 00106 00107 #ifdef __CYGWIN__ 00108 #define _WIN32_WINNT 0x0500 00109 #ifndef INET_ADDRSTRLEN 00110 #define INET_ADDRSTRLEN 16 00111 #endif 00112 #ifndef INET6_ADDRSTRLEN 00113 #define INET6_ADDRSTRLEN 46 00114 #endif 00115 #endif /* __CYGWIN__ */ 00116 00117 #ifdef __CYGWIN__ 00118 typedef unsigned long long uint64_t; 00119 #endif 00120 00121 #endif