chanvars.h File Reference

Channel Variables. More...

#include "asterisk/linkedlists.h"

Include dependency graph for chanvars.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ast_var_t
struct  varshead

Defines

#define AST_VAR_LIST_TRAVERSE(head, var)   AST_LIST_TRAVERSE(head, var, entries)

Functions

struct ast_var_tast_var_assign (const char *name, const char *value)
void ast_var_delete (struct ast_var_t *var)
char * ast_var_find (const struct varshead *head, const char *name)
const char * ast_var_full_name (const struct ast_var_t *var)
struct varsheadast_var_list_clone (struct varshead *head)
struct varsheadast_var_list_create (void)
void ast_var_list_destroy (struct varshead *head)
static void AST_VAR_LIST_INSERT_HEAD (struct varshead *head, struct ast_var_t *var)
static void AST_VAR_LIST_INSERT_TAIL (struct varshead *head, struct ast_var_t *var)
const char * ast_var_name (const struct ast_var_t *var)
const char * ast_var_value (const struct ast_var_t *var)


Detailed Description

Channel Variables.

Definition in file chanvars.h.


Define Documentation

#define AST_VAR_LIST_TRAVERSE ( head,
var   )     AST_LIST_TRAVERSE(head, var, entries)

Definition at line 51 of file chanvars.h.

Referenced by add_user_extension(), ast_var_list_clone(), fields_handler(), and load_users().


Function Documentation

static struct ast_var_t * ast_var_assign ( const char *  name,
const char *  value 
) [read]

static void ast_var_delete ( struct ast_var_t var  ) 

char* ast_var_find ( const struct varshead head,
const char *  name 
)

Definition at line 93 of file chanvars.c.

References AST_LIST_TRAVERSE, ast_var_t::entries, ast_var_t::name, NULL, and ast_var_t::value.

Referenced by add_user_extension(), ast_phoneprov_add_extension(), build_extension(), load_users(), phoneprov_callback(), phoneprov_destroy(), and users_apply_handler().

00094 {
00095    struct ast_var_t *var;
00096 
00097    AST_LIST_TRAVERSE(head, var, entries) {
00098       if (!strcmp(name, var->name)) {
00099          return var->value;
00100       }
00101    }
00102    return NULL;
00103 }

const char* ast_var_full_name ( const struct ast_var_t var  ) 

Definition at line 83 of file chanvars.c.

References ast_var_t::name, and NULL.

Referenced by ast_channel_inherit_variables(), and ast_unreal_call_setup().

00084 {
00085    return (var ? var->name : NULL);
00086 }

struct varshead* ast_var_list_clone ( struct varshead head  )  [read]

Definition at line 132 of file chanvars.c.

References ast_var_assign(), ast_var_list_create(), ast_var_list_destroy(), AST_VAR_LIST_INSERT_TAIL(), AST_VAR_LIST_TRAVERSE, ast_var_t::name, NULL, and ast_var_t::value.

Referenced by build_extension().

00133 {
00134    struct varshead *clone;
00135    struct ast_var_t *var, *newvar;
00136 
00137    if (!head) {
00138       return NULL;
00139    }
00140 
00141    clone = ast_var_list_create();
00142    if (!clone) {
00143       return NULL;
00144    }
00145 
00146    AST_VAR_LIST_TRAVERSE(head, var) {
00147       newvar = ast_var_assign(var->name, var->value);
00148       if (!newvar) {
00149          ast_var_list_destroy(clone);
00150          return NULL;
00151       }
00152       AST_VAR_LIST_INSERT_TAIL(clone, newvar);
00153    }
00154 
00155    return clone;
00156 }

struct varshead* ast_var_list_create ( void   )  [read]

Definition at line 105 of file chanvars.c.

References ast_calloc, AST_LIST_HEAD_INIT_NOLOCK, and NULL.

Referenced by ast_var_list_clone(), build_profile(), get_defaults(), handle_aor(), handle_registrations(), load_users(), and phoneprov_alloc().

00106 {
00107    struct varshead *head;
00108 
00109    head = ast_calloc(1, sizeof(*head));
00110    if (!head) {
00111       return NULL;
00112    }
00113    AST_LIST_HEAD_INIT_NOLOCK(head);
00114    return head;
00115 }

void ast_var_list_destroy ( struct varshead head  ) 

Definition at line 117 of file chanvars.c.

References ast_free, AST_LIST_REMOVE_HEAD, ast_var_delete(), and ast_var_t::entries.

Referenced by ast_var_list_clone(), delete_extension(), get_defaults(), handle_aor(), handle_registrations(), load_users(), and phoneprov_destroy().

00118 {
00119    struct ast_var_t *var;
00120 
00121    if (!head) {
00122       return;
00123    }
00124 
00125    while ((var = AST_LIST_REMOVE_HEAD(head, entries))) {
00126       ast_var_delete(var);
00127    }
00128 
00129    ast_free(head);
00130 }

static void AST_VAR_LIST_INSERT_HEAD ( struct varshead head,
struct ast_var_t var 
) [inline, static]

Definition at line 59 of file chanvars.h.

References AST_LIST_INSERT_HEAD.

00059                                                                                           {
00060    if (var) {
00061       AST_LIST_INSERT_HEAD(head, var, entries);
00062    }
00063 }

static void AST_VAR_LIST_INSERT_TAIL ( struct varshead head,
struct ast_var_t var 
) [inline, static]

const char* ast_var_name ( const struct ast_var_t var  ) 

const char* ast_var_value ( const struct ast_var_t var  ) 


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