00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _ASTERISK_H
00019 #define _ASTERISK_H
00020
00021 #include "asterisk/autoconfig.h"
00022
00023 #if !defined(NO_MALLOC_DEBUG) && !defined(STANDALONE) && defined(MALLOC_DEBUG)
00024 #include "asterisk/astmm.h"
00025 #endif
00026
00027 #include "asterisk/compat.h"
00028
00029
00030
00031
00032 #ifndef AST_DIR_MODE
00033 #define AST_DIR_MODE 0777
00034 #endif
00035 #ifndef AST_FILE_MODE
00036 #define AST_FILE_MODE 0666
00037 #endif
00038
00039 #define DEFAULT_LANGUAGE "en"
00040
00041 #define DEFAULT_SAMPLE_RATE 8000
00042 #define DEFAULT_SAMPLES_PER_MS ((DEFAULT_SAMPLE_RATE)/1000)
00043 #define setpriority __PLEASE_USE_ast_set_priority_INSTEAD_OF_setpriority__
00044 #define sched_setscheduler __PLEASE_USE_ast_set_priority_INSTEAD_OF_sched_setscheduler__
00045
00046 #if defined(DEBUG_FD_LEAKS) && !defined(STANDALONE) && !defined(STANDALONE_AEL)
00047
00048 #include <stdio.h>
00049 #include <sys/types.h>
00050 #include <sys/stat.h>
00051 #include <sys/socket.h>
00052 #include <unistd.h>
00053 #include <fcntl.h>
00054
00055 #define open(a,...) __ast_fdleak_open(__FILE__,__LINE__,__PRETTY_FUNCTION__, a, __VA_ARGS__)
00056 #define pipe(a) __ast_fdleak_pipe(a, __FILE__,__LINE__,__PRETTY_FUNCTION__)
00057 #define socket(a,b,c) __ast_fdleak_socket(a, b, c, __FILE__,__LINE__,__PRETTY_FUNCTION__)
00058 #define close(a) __ast_fdleak_close(a)
00059 #define fopen(a,b) __ast_fdleak_fopen(a, b, __FILE__,__LINE__,__PRETTY_FUNCTION__)
00060 #define fclose(a) __ast_fdleak_fclose(a)
00061 #define dup2(a,b) __ast_fdleak_dup2(a, b, __FILE__,__LINE__,__PRETTY_FUNCTION__)
00062 #define dup(a) __ast_fdleak_dup(a, __FILE__,__LINE__,__PRETTY_FUNCTION__)
00063
00064 #if defined(__cplusplus) || defined(c_plusplus)
00065 extern "C" {
00066 #endif
00067 int __ast_fdleak_open(const char *file, int line, const char *func, const char *path, int flags, ...);
00068 int __ast_fdleak_pipe(int *fds, const char *file, int line, const char *func);
00069 int __ast_fdleak_socket(int domain, int type, int protocol, const char *file, int line, const char *func);
00070 int __ast_fdleak_close(int fd);
00071 FILE *__ast_fdleak_fopen(const char *path, const char *mode, const char *file, int line, const char *func);
00072 int __ast_fdleak_fclose(FILE *ptr);
00073 int __ast_fdleak_dup2(int oldfd, int newfd, const char *file, int line, const char *func);
00074 int __ast_fdleak_dup(int oldfd, const char *file, int line, const char *func);
00075 #if defined(__cplusplus) || defined(c_plusplus)
00076 }
00077 #endif
00078 #endif
00079
00080 int ast_set_priority(int);
00081 int ast_fd_init(void);
00082
00083
00084
00085
00086
00087
00088
00089
00090 int ast_register_atexit(void (*func)(void));
00091
00092
00093
00094
00095
00096 void ast_unregister_atexit(void (*func)(void));
00097
00098 #if !defined(LOW_MEMORY)
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108 void ast_register_file_version(const char *file, const char *version);
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119 void ast_unregister_file_version(const char *file);
00120
00121
00122
00123
00124
00125 const char *ast_file_version_find(const char *file);
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149 #ifdef MTX_PROFILE
00150 #define HAVE_MTX_PROFILE
00151 #define ASTERISK_FILE_VERSION(file, version) \
00152 static int mtx_prof = -1; \
00153 static void __attribute__((constructor)) __register_file_version(void) \
00154 { \
00155 mtx_prof = ast_add_profile("mtx_lock_" file, 0); \
00156 ast_register_file_version(file, version); \
00157 } \
00158 static void __attribute__((destructor)) __unregister_file_version(void) \
00159 { \
00160 ast_unregister_file_version(file); \
00161 }
00162 #else
00163 #define ASTERISK_FILE_VERSION(file, version) \
00164 static void __attribute__((constructor)) __register_file_version(void) \
00165 { \
00166 ast_register_file_version(file, version); \
00167 } \
00168 static void __attribute__((destructor)) __unregister_file_version(void) \
00169 { \
00170 ast_unregister_file_version(file); \
00171 }
00172 #endif
00173 #else
00174 #define ASTERISK_FILE_VERSION(file, x)
00175 #endif
00176
00177 #if !defined(LOW_MEMORY)
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193 int ast_add_profile(const char *, uint64_t scale);
00194 int64_t ast_profile(int, int64_t);
00195 int64_t ast_mark(int, int start1_stop0);
00196 #else
00197 #define ast_add_profile(a, b) 0
00198 #define ast_profile(a, b) do { } while (0)
00199 #define ast_mark(a, b) do { } while (0)
00200 #endif
00201
00202
00203
00204
00205
00206
00207
00208 struct ast_channel;
00209 struct ast_frame;
00210 struct ast_module;
00211 struct ast_variable;
00212 struct ast_str;
00213
00214 #ifdef bzero
00215 #undef bzero
00216 #endif
00217
00218 #ifdef bcopy
00219 #undef bcopy
00220 #endif
00221
00222 #define bzero 0x__dont_use_bzero__use_memset_instead""
00223 #define bcopy 0x__dont_use_bcopy__use_memmove_instead()
00224
00225 #endif