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_AEL) && defined(MALLOC_DEBUG)
00024 #include "asterisk/astmm.h"
00025 #endif
00026
00027 #include "asterisk/compat.h"
00028
00029 #include "asterisk/paths.h"
00030
00031 #define DEFAULT_LANGUAGE "en"
00032
00033 #define DEFAULT_SAMPLE_RATE 8000
00034 #define DEFAULT_SAMPLES_PER_MS ((DEFAULT_SAMPLE_RATE)/1000)
00035 #define setpriority __PLEASE_USE_ast_set_priority_INSTEAD_OF_setpriority__
00036 #define sched_setscheduler __PLEASE_USE_ast_set_priority_INSTEAD_OF_sched_setscheduler__
00037
00038 #if defined(DEBUG_FD_LEAKS) && !defined(STANDALONE) && !defined(STANDALONE_AEL)
00039
00040 #include <stdio.h>
00041 #include <sys/types.h>
00042 #include <sys/stat.h>
00043 #include <sys/socket.h>
00044 #include <unistd.h>
00045 #include <fcntl.h>
00046
00047 #define open(a,...) __ast_fdleak_open(__FILE__,__LINE__,__PRETTY_FUNCTION__, a, __VA_ARGS__)
00048 #define pipe(a) __ast_fdleak_pipe(a, __FILE__,__LINE__,__PRETTY_FUNCTION__)
00049 #define socket(a,b,c) __ast_fdleak_socket(a, b, c, __FILE__,__LINE__,__PRETTY_FUNCTION__)
00050 #define close(a) __ast_fdleak_close(a)
00051 #define fopen(a,b) __ast_fdleak_fopen(a, b, __FILE__,__LINE__,__PRETTY_FUNCTION__)
00052 #define fclose(a) __ast_fdleak_fclose(a)
00053 #define dup2(a,b) __ast_fdleak_dup2(a, b, __FILE__,__LINE__,__PRETTY_FUNCTION__)
00054 #define dup(a) __ast_fdleak_dup(a, __FILE__,__LINE__,__PRETTY_FUNCTION__)
00055
00056 #if defined(__cplusplus) || defined(c_plusplus)
00057 extern "C" {
00058 #endif
00059 int __ast_fdleak_open(const char *file, int line, const char *func, const char *path, int flags, ...);
00060 int __ast_fdleak_pipe(int *fds, const char *file, int line, const char *func);
00061 int __ast_fdleak_socket(int domain, int type, int protocol, const char *file, int line, const char *func);
00062 int __ast_fdleak_close(int fd);
00063 FILE *__ast_fdleak_fopen(const char *path, const char *mode, const char *file, int line, const char *func);
00064 int __ast_fdleak_fclose(FILE *ptr);
00065 int __ast_fdleak_dup2(int oldfd, int newfd, const char *file, int line, const char *func);
00066 int __ast_fdleak_dup(int oldfd, const char *file, int line, const char *func);
00067 #if defined(__cplusplus) || defined(c_plusplus)
00068 }
00069 #endif
00070 #endif
00071
00072
00073 extern char ast_config_AST_CONFIG_DIR[PATH_MAX];
00074 extern char ast_config_AST_CONFIG_FILE[PATH_MAX];
00075 extern char ast_config_AST_MODULE_DIR[PATH_MAX];
00076 extern char ast_config_AST_SPOOL_DIR[PATH_MAX];
00077 extern char ast_config_AST_MONITOR_DIR[PATH_MAX];
00078 extern char ast_config_AST_VAR_DIR[PATH_MAX];
00079 extern char ast_config_AST_DATA_DIR[PATH_MAX];
00080 extern char ast_config_AST_LOG_DIR[PATH_MAX];
00081 extern char ast_config_AST_AGI_DIR[PATH_MAX];
00082 extern char ast_config_AST_DB[PATH_MAX];
00083 extern char ast_config_AST_KEY_DIR[PATH_MAX];
00084 extern char ast_config_AST_PID[PATH_MAX];
00085 extern char ast_config_AST_SOCKET[PATH_MAX];
00086 extern char ast_config_AST_RUN_DIR[PATH_MAX];
00087 extern char ast_config_AST_RUN_USER[PATH_MAX];
00088 extern char ast_config_AST_RUN_GROUP[PATH_MAX];
00089 extern char ast_config_AST_CTL_PERMISSIONS[PATH_MAX];
00090 extern char ast_config_AST_CTL_OWNER[PATH_MAX];
00091 extern char ast_config_AST_CTL_GROUP[PATH_MAX];
00092 extern char ast_config_AST_CTL[PATH_MAX];
00093 extern char ast_config_AST_SYSTEM_NAME[20];
00094
00095 int ast_set_priority(int);
00096 int load_modules(unsigned int);
00097 int load_pbx(void);
00098 int init_logger(void);
00099 void close_logger(void);
00100 int reload_logger(int);
00101 int init_framer(void);
00102 int ast_term_init(void);
00103 int astdb_init(void);
00104 void ast_channels_init(void);
00105 void ast_builtins_init(void);
00106 int dnsmgr_init(void);
00107 void dnsmgr_start_refresh(void);
00108 int dnsmgr_reload(void);
00109 void threadstorage_init(void);
00110 int astobj2_init(void);
00111 void ast_autoservice_init(void);
00112 int ast_fd_init(void);
00113
00114
00115 struct ast_channel;
00116
00117
00118 struct ast_module;
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134 int ast_module_reload(const char *name);
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146 void ast_process_pending_reloads(void);
00147
00148
00149
00150
00151
00152
00153
00154 int ast_register_atexit(void (*func)(void));
00155
00156
00157
00158
00159
00160 void ast_unregister_atexit(void (*func)(void));
00161
00162 #if !defined(LOW_MEMORY)
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172 void ast_register_file_version(const char *file, const char *version);
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183 void ast_unregister_file_version(const char *file);
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206 #ifdef MTX_PROFILE
00207 #define HAVE_MTX_PROFILE
00208 #define ASTERISK_FILE_VERSION(file, version) \
00209 static int mtx_prof = -1; \
00210 static void __attribute__((constructor)) __register_file_version(void) \
00211 { \
00212 mtx_prof = ast_add_profile("mtx_lock_" file, 0); \
00213 ast_register_file_version(file, version); \
00214 } \
00215 static void __attribute__((destructor)) __unregister_file_version(void) \
00216 { \
00217 ast_unregister_file_version(file); \
00218 }
00219 #else
00220 #define ASTERISK_FILE_VERSION(file, version) \
00221 static void __attribute__((constructor)) __register_file_version(void) \
00222 { \
00223 ast_register_file_version(file, version); \
00224 } \
00225 static void __attribute__((destructor)) __unregister_file_version(void) \
00226 { \
00227 ast_unregister_file_version(file); \
00228 }
00229 #endif
00230 #else
00231 #define ASTERISK_FILE_VERSION(file, x)
00232 #endif
00233
00234 #if !defined(LOW_MEMORY)
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250 int ast_add_profile(const char *, uint64_t scale);
00251 int64_t ast_profile(int, int64_t);
00252 int64_t ast_mark(int, int start1_stop0);
00253 #else
00254 #define ast_add_profile(a, b) 0
00255 #define ast_profile(a, b) do { } while (0)
00256 #define ast_mark(a, b) do { } while (0)
00257 #endif
00258
00259 #endif