2 * Asterisk -- A telephony toolkit for Linux.
4 * Copyright (C) 1999-2006, Digium, Inc.
6 * Mark Spencer <markster@digium.com>
8 * This program is free software, distributed under the terms of
9 * the GNU General Public License
13 * \brief General Definitions for Asterisk top level program
14 * Included by asterisk.h to handle platform-specific issues
15 * especially those related to header files.
18 #include "asterisk/compiler.h"
23 #ifndef __STDC_VERSION__
24 /* flex output wants to find this defined. */
25 #define __STDC_VERSION__ 0
28 #ifdef HAVE_INTTYPES_H
44 #ifdef HAVE_SYS_TYPES_H
45 #include <sys/types.h>
55 #include <alloca.h> /* not necessarily present - could be in stdlib */
56 #elif defined(HAVE_ALLOCA) && defined(__MINGW32__)
57 #include <malloc.h> /* see if it is here... */
60 #include <stdio.h> /* this is always present */
66 #ifdef HAVE_SYS_POLL_H
69 #include "asterisk/poll-compat.h"
72 #if !defined(HAVE_ASPRINTF) && !defined(__AST_DEBUG_MALLOC)
73 int asprintf(char **str, const char *fmt, ...);
76 #ifndef HAVE_GETLOADAVG
77 int getloadavg(double *list, int nelem);
81 int setenv(const char *name, const char *value, int overwrite);
84 #ifndef HAVE_STRCASESTR
85 char *strcasestr(const char *, const char *);
88 #if !defined(HAVE_STRNDUP) && !defined(__AST_DEBUG_MALLOC)
89 char *strndup(const char *, size_t);
93 size_t strnlen(const char *, size_t);
97 char* strsep(char** str, const char* delims);
101 uint64_t strtoq(const char *nptr, char **endptr, int base);
104 #ifndef HAVE_UNSETENV
105 int unsetenv(const char *name);
108 #if !defined(HAVE_VASPRINTF) && !defined(__AST_DEBUG_MALLOC)
109 int vasprintf(char **strp, const char *fmt, va_list ap);
113 size_t strlcat(char *dst, const char *src, size_t siz);
117 size_t strlcpy(char *dst, const char *src, size_t siz);
123 #define __BEGIN_DECLS
134 #include <sys/stat.h>
136 #include <netinet/in.h>
137 #include <dat/dat_platform_specific.h>
140 #define LITTLE_ENDIAN 1234
141 #define BIG_ENDIAN 4321
144 #define BYTE_ORDER BIG_ENDIAN
146 #define BYTE_ORDER LITTLE_ENDIAN
151 #define __LITTLE_ENDIAN LITTLE_ENDIAN
152 #define __BIG_ENDIAN BIG_ENDIAN
153 #define __BYTE_ORDER BYTE_ORDER
156 #ifndef __BIT_TYPES_DEFINED__
157 #define __BIT_TYPES_DEFINED__
158 typedef unsigned char u_int8_t;
159 typedef unsigned short u_int16_t;
160 typedef unsigned int u_int32_t;
166 #define _WIN32_WINNT 0x0500
167 #ifndef INET_ADDRSTRLEN
168 #define INET_ADDRSTRLEN 16
170 #ifndef INET6_ADDRSTRLEN
171 #define INET6_ADDRSTRLEN 46
173 #endif /* __CYGWIN__ */
176 typedef unsigned long long uint64_t;
180 * Definition of various structures that many asterisk files need,
181 * but only because they need to know that the type exists.
183 * We can move them to a different global header if necessary.