conf2ael.c

Go to the documentation of this file.
00001 /*  
00002  * Asterisk -- An open source telephony toolkit.
00003  *
00004  * Copyright (C) 2007, Digium, Inc.
00005  *
00006  * Steve Murphy <murf@digium.com>
00007  *
00008  * See http://www.asterisk.org for more information about
00009  * the Asterisk project. Please do not directly contact
00010  * any of the maintainers of this project for assistance;
00011  * the project provides a web site, mailing lists and IRC
00012  * channels for your use.
00013  *
00014  * This program is free software, distributed under the terms of
00015  * the GNU General Public License Version 2. See the LICENSE file
00016  * at the top of the source tree.
00017  */
00018 
00019 /*
00020  *
00021  * Reverse compile extensions.conf code into prototype AEL code
00022  *
00023  */
00024 
00025 /*** MODULEINFO
00026    <depend>res_ael_share</depend>
00027    <support_level>extended</support_level>
00028  ***/
00029 
00030 #include "asterisk.h"
00031 ASTERISK_FILE_VERSION(__FILE__, "$Revision: 433695 $")
00032 
00033 #include "asterisk/paths.h"   /* CONFIG_DIR */
00034 #include <locale.h>
00035 #include <ctype.h>
00036 #if !defined(SOLARIS) && !defined(__CYGWIN__)
00037 #include <err.h>
00038 #endif
00039 #include <regex.h>
00040 
00041 #include "asterisk.h"
00042 #include "asterisk/pbx.h"
00043 #include "asterisk/ast_expr.h"
00044 #include "asterisk/channel.h"
00045 #include "asterisk/chanvars.h"
00046 #include "asterisk/module.h"
00047 #include "asterisk/app.h"
00048 #include "asterisk/config.h"
00049 #include "asterisk/options.h"
00050 #include "asterisk/callerid.h"
00051 #include "asterisk/lock.h"
00052 #include "asterisk/hashtab.h"
00053 #include "asterisk/ael_structs.h"
00054 #include "asterisk/devicestate.h"
00055 #include "asterisk/stringfields.h"
00056 #include "asterisk/pval.h"
00057 #include "asterisk/extconf.h"
00058 
00059 const char *ast_config_AST_CONFIG_DIR = "/etc/asterisk"; /* placeholder */
00060 
00061 void get_start_stop(unsigned int *word, int bitsperword, int totalbits, int *start, int *end);
00062 int all_bits_set(unsigned int *word, int bitsperword, int totalbits);
00063 extern char *days[];
00064 extern char *months[];
00065 
00066 char *config = "extensions.conf";
00067 
00068 /* 
00069 static char *registrar = "conf2ael";
00070 static char userscontext[AST_MAX_EXTENSION] = "default";
00071 static int static_config = 0;
00072 static int write_protect_config = 1;
00073 static int autofallthrough_config = 0;
00074 static int clearglobalvars_config = 0;
00075 char ast_config_AST_SYSTEM_NAME[20] = ""; */
00076 
00077 /* static AST_RWLIST_HEAD_STATIC(acf_root, ast_custom_function); */
00078 //extern char ast_config_AST_CONFIG_DIR[PATH_MAX];
00079 int option_debug = 0;
00080 int option_verbose = 0;
00081 
00082 void ast_register_file_version(const char *file, const char *version);
00083 void ast_register_file_version(const char *file, const char *version)
00084 {
00085 }
00086 
00087 void ast_unregister_file_version(const char *file);
00088 void ast_unregister_file_version(const char *file)
00089 {
00090 }
00091 #if !defined(LOW_MEMORY)
00092 int ast_add_profile(const char *x, uint64_t scale) { return 0;}
00093 #endif
00094 /* Our own version of ast_log, since the expr parser uses it. -- stolen from utils/check_expr.c */
00095 void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...) __attribute__((format(printf,5,6)));
00096 
00097 void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...)
00098 {
00099    va_list vars;
00100    va_start(vars,fmt);
00101    
00102    printf("LOG: lev:%d file:%s  line:%d func: %s  ",
00103          level, file, line, function);
00104    vprintf(fmt, vars);
00105    fflush(stdout);
00106    va_end(vars);
00107 }
00108 
00109 /* stolen from pbx.c */
00110 struct ast_context;
00111 struct ast_app;
00112 #ifdef LOW_MEMORY
00113 #define EXT_DATA_SIZE 256
00114 #else
00115 #define EXT_DATA_SIZE 8192
00116 #endif
00117 
00118 #define SWITCH_DATA_LENGTH 256
00119 
00120 #define VAR_BUF_SIZE 4096
00121 
00122 #define  VAR_NORMAL     1
00123 #define  VAR_SOFTTRAN   2
00124 #define  VAR_HARDTRAN   3
00125 
00126 #define BACKGROUND_SKIP    (1 << 0)
00127 #define BACKGROUND_NOANSWER   (1 << 1)
00128 #define BACKGROUND_MATCHEXTEN (1 << 2)
00129 #define BACKGROUND_PLAYBACK   (1 << 3)
00130 
00131 /*!
00132    \brief ast_exten: An extension
00133    The dialplan is saved as a linked list with each context
00134    having it's own linked list of extensions - one item per
00135    priority.
00136 */
00137 struct ast_exten {
00138    char *exten;         /*!< Extension name */
00139    int matchcid;        /*!< Match caller id ? */
00140    const char *cidmatch;      /*!< Caller id to match for this extension */
00141    int priority;        /*!< Priority */
00142    const char *label;      /*!< Label */
00143    struct ast_context *parent;   /*!< The context this extension belongs to  */
00144    const char *app;     /*!< Application to execute */
00145    struct ast_app *cached_app;     /*!< Cached location of application */
00146    void *data;       /*!< Data to use (arguments) */
00147    void (*datad)(void *);     /*!< Data destructor */
00148    struct ast_exten *peer;    /*!< Next higher priority with our extension */
00149    const char *registrar;     /*!< Registrar */
00150    struct ast_exten *next;    /*!< Extension with a greater ID */
00151    char stuff[0];
00152 };
00153 
00154 
00155 /*! \brief ast_include: include= support in extensions.conf */
00156 struct ast_include {
00157    const char *name;
00158    const char *rname;         /*!< Context to include */
00159    const char *registrar;        /*!< Registrar */
00160    int hastime;            /*!< If time construct exists */
00161    struct ast_timing timing;               /*!< time construct */
00162    struct ast_include *next;     /*!< Link them together */
00163    char stuff[0];
00164 };
00165 
00166 /*! \brief ast_sw: Switch statement in extensions.conf */
00167 struct ast_sw {
00168    char *name;
00169    const char *registrar;        /*!< Registrar */
00170    char *data;          /*!< Data load */
00171    int eval;
00172    AST_LIST_ENTRY(ast_sw) list;
00173    char *tmpdata;
00174    char stuff[0];
00175 };
00176 
00177 /*! \brief ast_ignorepat: Ignore patterns in dial plan */
00178 struct ast_ignorepat {
00179    const char *registrar;
00180    struct ast_ignorepat *next;
00181    const char pattern[0];
00182 };
00183 
00184 /*! \brief ast_context: An extension context */
00185 struct ast_context {
00186    ast_rwlock_t lock;         /*!< A lock to prevent multiple threads from clobbering the context */
00187    struct ast_exten *root;       /*!< The root of the list of extensions */
00188    struct ast_context *next;     /*!< Link them together */
00189    struct ast_include *includes;    /*!< Include other contexts */
00190    struct ast_ignorepat *ignorepats;   /*!< Patterns for which to continue playing dialtone */
00191    const char *registrar;        /*!< Registrar */
00192    AST_LIST_HEAD_NOLOCK(, ast_sw) alts;   /*!< Alternative switches */
00193    ast_mutex_t macrolock;        /*!< A lock to implement "exclusive" macros - held whilst a call is executing in the macro */
00194    char name[0];           /*!< Name of the context */
00195 };
00196 
00197 
00198 /*! \brief ast_app: A registered application */
00199 struct ast_app {
00200    int (*execute)(struct ast_channel *chan, void *data);
00201    const char *synopsis;         /*!< Synopsis text for 'show applications' */
00202    const char *description;      /*!< Description (help text) for 'show application &lt;name&gt;' */
00203    AST_RWLIST_ENTRY(ast_app) list;     /*!< Next app in list */
00204    struct module *module;        /*!< Module this app belongs to */
00205    char name[0];           /*!< Name of the application */
00206 };
00207 
00208 /*! \brief ast_state_cb: An extension state notify register item */
00209 struct ast_state_cb {
00210    int id;
00211    void *data;
00212    ast_state_cb_type callback;
00213    struct ast_state_cb *next;
00214 };
00215 
00216 /*! \brief Structure for dial plan hints
00217 
00218   \note Hints are pointers from an extension in the dialplan to one or
00219   more devices (tech/name) 
00220    - See \ref AstExtState
00221 */
00222 struct ast_hint {
00223    struct ast_exten *exten;   /*!< Extension */
00224    int laststate;          /*!< Last known state */
00225    struct ast_state_cb *callbacks;  /*!< Callback list for this extension */
00226    AST_RWLIST_ENTRY(ast_hint) list;/*!< Pointer to next hint in list */
00227 };
00228 
00229 struct store_hint {
00230    char *context;
00231    char *exten;
00232    struct ast_state_cb *callbacks;
00233    int laststate;
00234    AST_LIST_ENTRY(store_hint) list;
00235    char data[1];
00236 };
00237 
00238 AST_LIST_HEAD(store_hints, store_hint);
00239 
00240 #define STATUS_NO_CONTEXT  1
00241 #define STATUS_NO_EXTENSION   2
00242 #define STATUS_NO_PRIORITY 3
00243 #define STATUS_NO_LABEL    4
00244 #define STATUS_SUCCESS     5
00245 
00246 extern struct ast_context *local_contexts;
00247 extern struct ast_context *contexts;
00248 
00249 
00250 struct ast_custom_function *ast_custom_function_find(const char *name);
00251 
00252 
00253 struct ast_custom_function *ast_custom_function_find(const char *name)
00254 {
00255    return 0; /* in "standalone" mode, functions are just not avail */
00256 }
00257 
00258 
00259 struct profile_entry {
00260    const char *name;
00261    uint64_t scale;   /* if non-zero, values are scaled by this */
00262    int64_t  mark;
00263    int64_t  value;
00264    int64_t  events;
00265 };
00266 
00267 struct profile_data {
00268    int entries;
00269    int max_size;
00270    struct profile_entry e[0];
00271 };
00272 
00273 static int bit_at(unsigned int *word, int bitsperword, int bitnum)
00274 {
00275    return word[bitnum/bitsperword] & (1 << (bitnum % bitsperword));
00276 }
00277 
00278 void get_start_stop(unsigned int *word, int bitsperword, int totalbits, int *start, int *end)
00279 {
00280    int i;
00281    int thisbit, thatbit = bit_at(word, bitsperword, totalbits-1);
00282    
00283    for (i=0; i<totalbits; i++) {
00284       thisbit = bit_at(word, bitsperword, i);
00285       
00286       if (thisbit != thatbit ) {
00287          if (thisbit) {
00288             *start = i;
00289          } else {
00290             *end = i;
00291          }
00292       }
00293       thatbit = thisbit;
00294    }
00295 }
00296 
00297 int all_bits_set(unsigned int *word, int bitsperword, int totalbits )
00298 {
00299    
00300    int i, total=totalbits/bitsperword,bitmask = 0;
00301    
00302    for (i=0; i<bitsperword; i++)
00303    {
00304       bitmask |= (1 << i);
00305    }
00306    
00307    for (i=0; i<total; i++)
00308    {
00309       if (word[i] != bitmask)
00310          return 0;
00311    }
00312    return 1;
00313 }
00314 
00315 
00316 int main(int argc, char **argv)
00317 {
00318    struct ast_context *tmp;
00319    struct ast_exten *e, *eroot;
00320    pval *tree, *tmptree, *sws;
00321    struct ast_include *tmpi;
00322    struct ast_sw *sw = 0;
00323    struct ast_ignorepat *ipi;
00324    pval *incl=0;
00325    int localdir = 0, i;
00326 
00327    tree = 0;
00328    tmptree = 0;
00329 
00330    /* process the command line args */
00331    for (i=1; i<argc; i++)
00332    {
00333       if (strcmp(argv[i],"-d")==0)
00334          localdir =1;
00335    }
00336    
00337    /* 3 simple steps: */
00338    /*   1. read in the extensions.conf config file 
00339     *   2. traverse, and build an AEL tree
00340     *   3. Output the AEL tree into a file
00341     */
00342    printf("WARNING: This is an EXTREMELY preliminary version of a program\n");
00343    printf("         that will someday hopefully do a thoughful and intelligent\n");
00344    printf("         job of transforming your extensions.conf file into an\n");
00345    printf("         extensions.ael file.\n");
00346    printf("         This version has absolutely no intelligence, and pretty\n");
00347    printf("         much just does a direct conversion\n");
00348    printf("         The result will most likely need careful attention to\n");
00349    printf("         finish the job!!!!!\n");
00350 
00351    if (!localdir)
00352       printf(" (You could use -d the use the extensions.conf in the current directory!)\n");
00353 
00354    printf("Loading %s/%s...\n", ast_config_AST_CONFIG_DIR, config);
00355 
00356    if (!localdir)
00357       localized_use_conf_dir();
00358    localized_pbx_load_module();
00359    
00360    printf("... Done!\n");
00361    
00362    tmp = 0;
00363    while ((tmp = localized_walk_contexts(tmp)) ) {
00364       printf("Context: %s\n", tmp->name);
00365    }
00366    printf("=========\n");
00367    tmp = 0;
00368    while ((tmp = localized_walk_contexts(tmp)) ) {
00369       /* printf("Context: %s\n", tmp->name); */
00370       tmptree = pvalCreateNode(PV_CONTEXT);
00371       if (!tree)
00372          tree = tmptree;
00373       else
00374          pvalTopLevAddObject(tree, tmptree);
00375       
00376       pvalContextSetName(tmptree, ast_strdup(tmp->name));
00377       
00378       if (tmp->includes) {
00379          incl = pvalCreateNode(PV_INCLUDES);
00380          pvalContextAddStatement(tmptree, incl);
00381          for (tmpi = tmp->includes; tmpi; ) { /* includes */
00382             if (strchr(tmpi->name,'|')==0) {
00383                if (tmpi->hastime)
00384                {
00385                   char timerange[15];
00386                   char dowrange[10];
00387                   char domrange[10];
00388                   char monrange[10];
00389                   int startbit=0, endbit=0;
00390                   
00391                   if (all_bits_set(tmpi->timing.minmask, 30, 720))
00392                      strcpy(timerange, "*");
00393                   else {
00394                      int hr, min;
00395                      char tbuf[20];
00396                      get_start_stop(tmpi->timing.minmask, 30, 720, &startbit, &endbit);
00397                      hr = startbit/30;
00398                      min = (startbit % 30) * 2;
00399                      sprintf(tbuf,"%02d:%02d", hr, min);
00400                      strcpy(timerange, tbuf);
00401                      hr = endbit/30;
00402                      min = (endbit % 30) * 2;
00403                      sprintf(tbuf,"%02d:%02d", hr, min);
00404                      strcat(timerange,"-");
00405                      strcat(timerange,tbuf);
00406                   }
00407                   
00408                   if (all_bits_set(&tmpi->timing.dowmask, 7, 7))
00409                      strcpy(dowrange, "*");
00410                   else {
00411                      get_start_stop(&tmpi->timing.dowmask, 7, 7, &startbit, &endbit);
00412                      strcpy(dowrange, days[startbit]);
00413                      strcat(dowrange,"-");
00414                      strcat(dowrange, days[endbit]);
00415                   }
00416                   
00417                   if (all_bits_set(&tmpi->timing.monthmask, 12, 12))
00418                      strcpy(monrange, "*");
00419                   else {
00420                      get_start_stop(&tmpi->timing.monthmask, 12, 12, &startbit, &endbit);
00421                      strcpy(monrange, months[startbit]);
00422                      strcat(monrange,"-");
00423                      strcat(monrange, months[endbit]);
00424                   }
00425                   
00426                   if (all_bits_set(&tmpi->timing.daymask, 31, 31))
00427                      strcpy(domrange, "*");
00428                   else {
00429                      char tbuf[20];
00430                      get_start_stop(&tmpi->timing.daymask, 31, 31, &startbit, &endbit);
00431                      sprintf(tbuf,"%d", startbit);
00432                      strcpy(domrange, tbuf);
00433                      strcat(domrange,"-");
00434                      sprintf(tbuf,"%d", endbit);
00435                      strcat(domrange, tbuf);
00436                   }
00437                   /* now all 4 fields are set; what do we do? */
00438                   pvalIncludesAddIncludeWithTimeConstraints(incl, strdup(tmpi->name), strdup(timerange), strdup(domrange), strdup(dowrange), strdup(monrange));
00439                   
00440                } else {
00441                   pvalIncludesAddInclude(incl, strdup(tmpi->name));
00442                }
00443             } else { /* it appears the timing constraint info is tacked onto the name, carve it up and divvy it out */
00444                char *dow,*dom,*mon;
00445                char *all = strdup(tmpi->name);
00446                char *hr = strchr(all,'|');
00447                if (hr) {
00448                   *hr++ = 0;
00449                   dow = strchr(hr,'|');
00450                   if (dow) {
00451                      *dow++ = 0;
00452                      dom = strchr(dow,'|');
00453                      if (dom) {
00454                         *dom++ = 0;
00455                         mon = strchr(dom,'|');
00456                         if (mon) {
00457                            *mon++ = 0;
00458                            /* now all 4 fields are set; what do we do? */
00459                            pvalIncludesAddIncludeWithTimeConstraints(incl, strdup(all), strdup(hr), strdup(dow), strdup(dom), strdup(mon));
00460                            /* the original data is always best to keep (no 2-min rounding) */
00461                         } else {
00462                            ast_log(LOG_ERROR,"No month spec attached to include!\n");
00463                         }
00464                      } else {
00465                         ast_log(LOG_ERROR,"No day of month spec attached to include!\n");
00466                      }
00467                   } else {
00468                      ast_log(LOG_ERROR,"No day of week spec attached to include!\n");
00469                   }
00470                }
00471                free(all);
00472             }
00473             tmpi = tmpi->next;
00474          }
00475       }
00476       for (ipi = tmp->ignorepats; ipi; ) { /* ignorepats */
00477          incl = pvalCreateNode(PV_IGNOREPAT);
00478          pvalIgnorePatSetPattern(incl,(char *)ipi->pattern);
00479          pvalContextAddStatement(tmptree, incl);
00480          ipi = ipi->next;
00481       }
00482       eroot=0;
00483       while ( (eroot = localized_walk_context_extensions(tmp, eroot)) ) {
00484          pval *exten = pvalCreateNode(PV_EXTENSION);
00485          pvalContextAddStatement(tmptree, exten);
00486          pvalExtenSetName(exten, ast_strdup(eroot->exten));
00487       
00488          if (eroot->peer) {
00489             pval *block = pvalCreateNode(PV_STATEMENTBLOCK);
00490             pvalExtenSetStatement(exten, block);
00491             
00492             e = 0;
00493             while ( (e = localized_walk_extension_priorities(eroot, e)) ) {
00494                
00495                pval *statemnt = pvalCreateNode(PV_APPLICATION_CALL);
00496                pval *args = pvalCreateNode(PV_WORD);
00497                
00498                /* printf("           %s(%s)\n", e->app, (char*)e->data); */
00499 
00500                pvalAppCallSetAppName(statemnt, ast_strdup(e->app));
00501                pvalWordSetString(args, ast_strdup(e->data));
00502                pvalAppCallAddArg(statemnt, args);
00503                
00504                pvalStatementBlockAddStatement(block, statemnt);
00505             }
00506          } else if (eroot->priority == -1) {
00507 
00508             pval *statemnt = pvalCreateNode(PV_APPLICATION_CALL);
00509             pval *args = pvalCreateNode(PV_WORD);
00510 
00511             /* printf("Mike, we have a hint on exten %s with data %s\n", eroot->exten, eroot->app); */
00512 
00513             pvalAppCallSetAppName(statemnt, "NoOp");
00514             pvalWordSetString(args, ast_strdup(eroot->app));
00515 
00516 
00517             pvalExtenSetStatement(exten, statemnt);
00518             pvalExtenSetHints(exten, ast_strdup(eroot->app));
00519          } else {
00520 
00521             pval *statemnt = pvalCreateNode(PV_APPLICATION_CALL);
00522             pval *args = pvalCreateNode(PV_WORD);
00523    
00524             /* printf("           %s (%s)\n", eroot->app, (char *)eroot->data); */
00525             
00526             pvalAppCallSetAppName(statemnt, ast_strdup(eroot->app));
00527             pvalWordSetString(args, ast_strdup(eroot->data));
00528 
00529             
00530             pvalAppCallAddArg(statemnt, args);
00531             pvalExtenSetStatement(exten, statemnt);
00532          }
00533 
00534          /* printf("   extension: %s\n", eroot->exten); */
00535       }
00536       if (AST_LIST_FIRST(&tmp->alts)) {
00537          sws = pvalCreateNode(PV_SWITCHES);
00538          pvalContextAddStatement(tmptree,sws);
00539          
00540          sw = 0;
00541          while ((sw = localized_walk_context_switches(tmp,sw)) ) {
00542             pvalSwitchesAddSwitch(sws, ast_strdup(sw->name));
00543          }
00544       }
00545    }
00546    printf("Generating aelout.ael file...\n");
00547    
00548    ael2_print("aelout.ael", tree);
00549    
00550    printf("...Done!\n");
00551    return 0;
00552 }
00553 
00554 
00555 /* ==================================== for linking internal stuff to external stuff */
00556 
00557 int pbx_builtin_setvar(struct ast_channel *chan, const char *data)
00558 {
00559    return localized_pbx_builtin_setvar(chan, data);
00560 }
00561 
00562 void pbx_substitute_variables_helper(struct ast_channel *c,const char *cp1,char *cp2,int count);
00563 void pbx_substitute_variables_helper(struct ast_channel *c,const char *cp1,char *cp2,int count)
00564 {
00565    if (cp1 && *cp1)
00566       strncpy(cp2,cp1,AST_MAX_EXTENSION); /* Right now, this routine is ONLY being called for 
00567                                     a possible var substitution on extension names,
00568                                     so....! */
00569    else
00570       *cp2 = 0;
00571 }
00572 
00573 int ast_add_extension2(struct ast_context *con,
00574                   int replace, const char *extension, int priority, const char *label, const char *callerid,
00575                   const char *application, void *data, void (*datad)(void *),
00576                   const char *registrar)
00577 {
00578    return localized_add_extension2(con, replace, extension, priority, label, callerid, application, data, datad, registrar);
00579 }
00580 
00581 int ast_context_add_ignorepat2(struct ast_context *con, const char *value, const char *registrar)
00582 {
00583    
00584    return localized_context_add_ignorepat2(con, value, registrar);
00585 }
00586 
00587 int ast_context_add_switch2(struct ast_context *con, const char *value,
00588                          const char *data, int eval, const char *registrar)
00589 {
00590    
00591    return localized_context_add_switch2(con, value, data, eval, registrar);
00592 }
00593 
00594 int ast_context_add_include2(struct ast_context *con, const char *value,
00595                           const char *registrar)
00596 {
00597    
00598    return localized_context_add_include2(con, value,registrar);
00599 }
00600 
00601 struct ast_context *ast_context_find_or_create(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *name, const char *registrar)
00602 {
00603    printf("find/Creating context %s, registrar=%s\n", name, registrar);
00604    
00605    return localized_context_find_or_create(extcontexts, exttable, name, registrar);
00606 }
00607 
00608 void ast_cli_register_multiple(void);
00609 
00610 void ast_cli_register_multiple(void)
00611 {
00612 }
00613 
00614 void ast_module_register(const struct ast_module_info *x)
00615 {
00616 }
00617 
00618 void ast_module_unregister(const struct ast_module_info *x)
00619 {
00620 }
00621 
00622 void ast_cli_unregister_multiple(void);
00623 
00624 void ast_cli_unregister_multiple(void)
00625 {
00626 }
00627 
00628 struct ast_context *ast_walk_contexts(struct ast_context *con);
00629 struct ast_context *ast_walk_contexts(struct ast_context *con)
00630 {
00631    return localized_walk_contexts(con);
00632 }
00633 
00634 void ast_context_destroy(struct ast_context *con, const char *registrar);
00635 
00636 void ast_context_destroy(struct ast_context *con, const char *registrar)
00637 {
00638    return localized_context_destroy(con, registrar);
00639 }
00640 
00641 int ast_context_verify_includes(struct ast_context *con);
00642 
00643 int ast_context_verify_includes(struct ast_context *con)
00644 {
00645    return  localized_context_verify_includes(con);
00646 }
00647 
00648 void ast_merge_contexts_and_delete(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *registrar);
00649 
00650 void ast_merge_contexts_and_delete(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *registrar)
00651 {
00652    localized_merge_contexts_and_delete(extcontexts, exttable, registrar);
00653 }
00654 
00655 const char *ast_get_context_name(struct ast_context *con);
00656 const char *ast_get_context_name(struct ast_context *con)
00657 {
00658    return con ? con->name : NULL;
00659 }
00660 
00661 struct ast_exten *ast_walk_context_extensions(struct ast_context *con, struct ast_exten *exten);
00662 struct ast_exten *ast_walk_context_extensions(struct ast_context *con, struct ast_exten *exten)
00663 {
00664    return NULL;
00665 }
00666 
00667 struct ast_include *ast_walk_context_includes(struct ast_context *con, struct ast_include *inc);
00668 struct ast_include *ast_walk_context_includes(struct ast_context *con, struct ast_include *inc)
00669 {
00670    return NULL;
00671 }
00672 
00673 struct ast_ignorepat *ast_walk_context_ignorepats(struct ast_context *con, struct ast_ignorepat *ip);
00674 struct ast_ignorepat *ast_walk_context_ignorepats(struct ast_context *con, struct ast_ignorepat *ip)
00675 {
00676    return NULL;
00677 }
00678 
00679 struct ast_sw *ast_walk_context_switches(struct ast_context *con, struct ast_sw *sw);
00680 struct ast_sw *ast_walk_context_switches(struct ast_context *con, struct ast_sw *sw)
00681 {
00682    return NULL;
00683 }
00684 
00685 struct ast_exten *pbx_find_extension(struct ast_channel *chan,
00686                             struct ast_context *bypass,
00687                             struct pbx_find_info *q,
00688                             const char *context, 
00689                             const char *exten, 
00690                             int priority,
00691                             const char *label, 
00692                             const char *callerid, 
00693                             enum ext_match_t action);
00694 
00695 struct ast_exten *pbx_find_extension(struct ast_channel *chan,
00696                             struct ast_context *bypass,
00697                             struct pbx_find_info *q,
00698                             const char *context, 
00699                             const char *exten, 
00700                             int priority,
00701                             const char *label, 
00702                             const char *callerid, 
00703                             enum ext_match_t action)
00704 {
00705    return localized_find_extension(bypass, q, context, exten, priority, label, callerid, action);
00706 }
00707 
00708 int ast_hashtab_compare_contexts(const void *ah_a, const void *ah_b);
00709 
00710 int ast_hashtab_compare_contexts(const void *ah_a, const void *ah_b)
00711 {
00712    return 0;
00713 }
00714 
00715 unsigned int ast_hashtab_hash_contexts(const void *obj);
00716 
00717 unsigned int ast_hashtab_hash_contexts(const void *obj)
00718 {
00719    return 0;
00720 }
00721 
00722 #ifdef DEBUG_THREADS
00723 #if !defined(LOW_MEMORY)
00724 void ast_mark_lock_acquired(void *lock_addr)
00725 {
00726 }
00727 #ifdef HAVE_BKTR
00728 void ast_remove_lock_info(void *lock_addr, struct ast_bt *bt)
00729 {
00730 }
00731 
00732 void ast_store_lock_info(enum ast_lock_type type, const char *filename,
00733    int line_num, const char *func, const char *lock_name, void *lock_addr, struct ast_bt *bt)
00734 {
00735 }
00736 
00737 int __ast_bt_get_addresses(struct ast_bt *bt)
00738 {
00739    return 0;
00740 }
00741 
00742 char **__ast_bt_get_symbols(void **addresses, size_t num_frames)
00743 {
00744    char **foo = calloc(num_frames, sizeof(char *) + 1);
00745    if (foo) {
00746       int i;
00747       for (i = 0; i < num_frames; i++) {
00748          foo[i] = (char *) foo + sizeof(char *) * num_frames;
00749       }
00750    }
00751    return foo;
00752 }
00753 
00754 #else
00755 void ast_remove_lock_info(void *lock_addr)
00756 {
00757 }
00758 
00759 void ast_store_lock_info(enum ast_lock_type type, const char *filename,
00760    int line_num, const char *func, const char *lock_name, void *lock_addr)
00761 {
00762 }
00763 #endif /* HAVE_BKTR */
00764 void ast_suspend_lock_info(void *lock_addr)
00765 {
00766 }
00767 void ast_restore_lock_info(void *lock_addr)
00768 {
00769 }
00770 #endif /* !defined(LOW_MEMORY) */
00771 #endif /* DEBUG_THREADS */

Generated on Thu Apr 16 06:27:31 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6