Asterisk - The Open Source Telephony Project  21.4.1
Macros | Functions
pbx_private.h File Reference

Private include file for pbx. More...

Go to the source code of this file.

Macros

#define VAR_BUF_SIZE   4096
 

Functions

const char * app_name (struct ast_app *app)
 
 AST_VECTOR (ast_ignorepats, struct ast_ignorepat *)
 
 AST_VECTOR (ast_includes, struct ast_include *)
 
 AST_VECTOR (ast_sws, struct ast_sw *)
 
struct ast_ignorepatignorepat_alloc (const char *value, const char *registrar)
 
void ignorepat_free (struct ast_ignorepat *ip)
 
struct ast_includeinclude_alloc (const char *value, const char *registrar)
 
void include_free (struct ast_include *inc)
 
const char * include_rname (const struct ast_include *inc)
 
int include_valid (const struct ast_include *inc)
 
int indicate_busy (struct ast_channel *, const char *)
 
int indicate_congestion (struct ast_channel *, const char *)
 
struct ast_switchpbx_findswitch (const char *sw)
 
int raise_exception (struct ast_channel *chan, const char *reason, int priority)
 
void set_ext_pri (struct ast_channel *c, const char *exten, int pri)
 
struct ast_swsw_alloc (const char *value, const char *data, int eval, const char *registrar)
 
void sw_free (struct ast_sw *sw)
 
void unreference_cached_app (struct ast_app *app)
 
void wait_for_hangup (struct ast_channel *chan, const void *data)
 

Detailed Description

Private include file for pbx.

Definition in file pbx_private.h.

Function Documentation

const char* app_name ( struct ast_app app)

pbx_app.c functions needed by pbx.c

Definition at line 463 of file pbx_app.c.

Referenced by app_exec(), handle_exec(), lua_pbx_exec(), lua_pbx_findapp(), pbx_extension_helper(), and stasis_app_set_global_debug().

464 {
465  return app->name;
466 }
struct ast_include* include_alloc ( const char *  value,
const char *  registrar 
)

Allocate and initialize an ast_include.

Definition at line 74 of file pbx_include.c.

References ast_build_timing(), ast_calloc, ast_include::hastime, ast_include::registrar, ast_include::rname, and ast_include::timing.

Referenced by ast_context_add_include2().

75 {
76  struct ast_include *new_include;
77  char *c;
78  int valuebufsz = strlen(value) + 1;
79  char *p;
80 
81  /* allocate new include structure ... */
82  new_include = ast_calloc(1, sizeof(*new_include) + (valuebufsz * 2));
83  if (!new_include) {
84  return NULL;
85  }
86 
87  /* Fill in this structure. Use 'p' for assignments, as the fields
88  * in the structure are 'const char *'
89  */
90  p = new_include->stuff;
91  new_include->name = p;
92  strcpy(p, value);
93  p += valuebufsz;
94  new_include->rname = p;
95  strcpy(p, value);
96  /* Strip off timing info, and process if it is there */
97  if ( (c = strchr(p, '|')) || (c = strchr(p, ',')) ) {
98  *c++ = '\0';
99  new_include->hastime = ast_build_timing(&(new_include->timing), c);
100  }
101  new_include->registrar = registrar;
102 
103  return new_include;
104 }
ast_include: include= support in extensions.conf
Definition: pbx_include.c:37
int ast_build_timing(struct ast_timing *i, const char *info_in)
Construct a timing bitmap, for use in time-based conditionals.
Definition: extconf.c:3806
struct ast_timing timing
Definition: pbx_include.c:46
#define ast_calloc(num, len)
A wrapper for calloc()
Definition: astmm.h:202
const char * rname
Definition: pbx_include.c:40
const char * registrar
Definition: pbx_include.c:42
void include_free ( struct ast_include inc)

Free an ast_include and associated data.

Definition at line 106 of file pbx_include.c.

References ast_destroy_timing(), and ast_include::timing.

Referenced by ast_context_add_include2(), and ast_context_remove_include2().

107 {
108  ast_destroy_timing(&(inc->timing));
109  ast_free(inc);
110 }
struct ast_timing timing
Definition: pbx_include.c:46
int ast_destroy_timing(struct ast_timing *i)
Deallocates memory structures associated with a timing bitmap.
Definition: pbx_timing.c:279
struct ast_switch* pbx_findswitch ( const char *  sw)

pbx_switch.c functions needed by pbx.c

Definition at line 40 of file pbx_switch.c.

References AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, and ast_switch::name.

41 {
42  struct ast_switch *asw;
43 
45  AST_RWLIST_TRAVERSE(&switches, asw, list) {
46  if (!strcasecmp(asw->name, sw))
47  break;
48  }
50 
51  return asw;
52 }
#define AST_RWLIST_RDLOCK(head)
Read locks a list.
Definition: linkedlists.h:78
const char * name
Definition: pbx.h:162
#define AST_RWLIST_UNLOCK(head)
Attempts to unlock a read/write based list.
Definition: linkedlists.h:151
int raise_exception ( struct ast_channel chan,
const char *  reason,
int  priority 
)

pbx.c functions needed by pbx_builtins.c

Definition at line 2806 of file pbx.c.

References ast_calloc_with_stringfields, ast_channel_datastore_add(), ast_channel_datastore_find(), ast_datastore_free(), ast_string_field_set, ast_datastore::data, pbx_exception::priority, and set_ext_pri().

Referenced by __ast_pbx_run().

2807 {
2808  struct ast_datastore *ds = ast_channel_datastore_find(chan, &exception_store_info, NULL);
2809  struct pbx_exception *exception = NULL;
2810 
2811  if (!ds) {
2812  ds = ast_datastore_alloc(&exception_store_info, NULL);
2813  if (!ds)
2814  return -1;
2815  if (!(exception = ast_calloc_with_stringfields(1, struct pbx_exception, 128))) {
2816  ast_datastore_free(ds);
2817  return -1;
2818  }
2819  ds->data = exception;
2820  ast_channel_datastore_add(chan, ds);
2821  } else
2822  exception = ds->data;
2823 
2824  ast_string_field_set(exception, reason, reason);
2825  ast_string_field_set(exception, context, ast_channel_context(chan));
2826  ast_string_field_set(exception, exten, ast_channel_exten(chan));
2827  exception->priority = ast_channel_priority(chan);
2828  set_ext_pri(chan, "e", priority);
2829  return 0;
2830 }
const ast_string_field exten
Definition: pbx.c:630
#define ast_calloc_with_stringfields(n, type, size)
Allocate a structure with embedded stringfields in a single allocation.
Definition: stringfields.h:432
Structure for a data store object.
Definition: datastore.h:64
struct ast_datastore * ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a channel.
Definition: channel.c:2399
int ast_datastore_free(struct ast_datastore *datastore)
Free a data store object.
Definition: datastore.c:68
const ast_string_field reason
Definition: pbx.c:630
int priority
Definition: pbx.c:632
void set_ext_pri(struct ast_channel *c, const char *exten, int pri)
Definition: pbx.c:4264
void * data
Definition: datastore.h:66
const ast_string_field context
Definition: pbx.c:630
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
Definition: channel.c:2385
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
Definition: stringfields.h:521
void set_ext_pri ( struct ast_channel c,
const char *  exten,
int  pri 
)

helper function to set extension and priority

Definition at line 4264 of file pbx.c.

Referenced by __ast_pbx_run(), and raise_exception().

4265 {
4266  ast_channel_lock(c);
4267  ast_channel_exten_set(c, exten);
4268  ast_channel_priority_set(c, pri);
4269  ast_channel_unlock(c);
4270 }
const ast_string_field exten
Definition: pbx.c:630
void unreference_cached_app ( struct ast_app app)

pbx.c function needed by pbx_app.c

Definition at line 6130 of file pbx.c.

References ast_rdlock_contexts(), and ast_unlock_contexts().

Referenced by ast_unregister_application().

6131 {
6132  struct ast_context *context = NULL;
6133  struct ast_exten *eroot = NULL, *e = NULL;
6134 
6136  while ((context = ast_walk_contexts(context))) {
6137  while ((eroot = ast_walk_context_extensions(context, eroot))) {
6138  while ((e = ast_walk_extension_priorities(eroot, e))) {
6139  if (e->cached_app == app)
6140  e->cached_app = NULL;
6141  }
6142  }
6143  }
6145 
6146  return;
6147 }
ast_exten: An extension The dialplan is saved as a linked list with each context having it's own link...
Definition: pbx.c:237
int ast_rdlock_contexts(void)
Read locks the context list.
Definition: pbx.c:8468
int ast_unlock_contexts(void)
Unlocks contexts.
Definition: pbx.c:8473
ast_context: An extension context
Definition: pbx.c:284