Asterisk.org: Developer Documentation (28 Oct 2009)

Wed Oct 28 15:47:53 2009

## 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-2005, Mark Spencer
    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 #ifdef SOLARIS
    00020 #define __BEGIN_DECLS
    00021 #define __END_DECLS
    00022
    00023 #ifndef __P
    00024 #define __P(p) p
    00025 #endif
    00026
    00027 #include <alloca.h>
    00028 #include <strings.h>
    00029 #include <string.h>
    00030 #include <pthread.h>
    00031 #include <sys/stat.h>
    00032 #include <signal.h>
    00033 #include <netinet/in.h>
    00034
    00035 #ifndef BYTE_ORDER
    00036 #define LITTLE_ENDIAN   1234
    00037 #define BIG_ENDIAN   4321
    00038
    00039 #ifdef __sparc__
    00040 #define BYTE_ORDER   BIG_ENDIAN
    00041 #else
    00042 #define BYTE_ORDER   LITTLE_ENDIAN
    00043 #endif
    00044 #endif
    00045
    00046 #ifndef __BYTE_ORDER
    00047 #define __LITTLE_ENDIAN LITTLE_ENDIAN
    00048 #define __BIG_ENDIAN BIG_ENDIAN
    00049 #define __BYTE_ORDER BYTE_ORDER
    00050 #endif
    00051
    00052 #ifndef __BIT_TYPES_DEFINED__
    00053 #define __BIT_TYPES_DEFINED__
    00054 typedef unsigned char   u_int8_t;
    00055 typedef unsigned short  u_int16_t;
    00056 typedef unsigned int u_int32_t;
    00057 typedef unsigned int uint;
    00058 #endif
    00059
    00060 char* strsep(char** str, const char* delims);
    00061 int setenv(const char *name, const char *value, int overwrite);
    00062 int unsetenv(const char *name);
    00063 #endif /* SOLARIS */
    00064
    00065 #ifdef __CYGWIN__
    00066 #define _WIN32_WINNT 0x0500
    00067 #ifndef INET_ADDRSTRLEN
    00068 #define INET_ADDRSTRLEN  16
    00069 #endif
    00070 #ifndef INET6_ADDRSTRLEN
    00071 #define INET6_ADDRSTRLEN 46
    00072 #endif
    00073 #endif /* __CYGWIN__ */
    00074
    00075 #define HAVE_VASPRINTF
    00076 #define HAVE_STRTOQ
    00077
    00078 #ifdef _BSD_SOURCE
    00079 #define HAVE_GETLOADAVG
    00080 #endif
    00081
    00082 #ifdef __linux__
    00083 #define HAVE_STRCASESTR
    00084 #define HAVE_STRNDUP
    00085 #define HAVE_STRNLEN
    00086 #endif
    00087
    00088 #ifdef SOLARIS
    00089 #undef HAVE_VASPRINTF
    00090 #undef HAVE_STRTOQ
    00091 #endif
    00092
    00093 #ifdef __CYGWIN__
    00094 #undef HAVE_STRTOQ
    00095 typedef unsigned long long uint64_t;
    00096 #endif
    00097
    00098 #endif