Wed Oct 28 11:52:09 2009

Asterisk developer's documentation


chanvars.c File Reference

Channel Variables. More...

#include "asterisk.h"
#include "asterisk/chanvars.h"
#include "asterisk/strings.h"
#include "asterisk/utils.h"

Include dependency graph for chanvars.c:

Go to the source code of this file.

Functions

struct ast_var_tast_var_assign (const char *name, const char *value)
void ast_var_delete (struct ast_var_t *var)
const char * ast_var_full_name (const 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.

Author:
Mark Spencer <markster@digium.com>

Definition in file chanvars.c.


Function Documentation

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

Definition at line 37 of file chanvars.c.

References __ast_calloc(), ast_calloc, ast_copy_string(), ast_var_t::name, ast_var_t::value, and var.

Referenced by acf_iaxvar_write(), add_user_extension(), ast_cdr_copy_vars(), ast_cdr_setvar(), ast_channel_inherit_variables(), ast_iax2_new(), authenticate_reply(), build_extension(), build_profile(), clone_variables(), do_say(), dundi_lookup_local(), frame_set_var(), iax2_dup_variable_datastore(), loopback_subst(), pbx_builtin_pushvar_helper(), pbx_builtin_setvar_helper(), phoneprov_callback(), set_config(), set_timezone_variables(), shared_write(), and socket_process().

00039 {  
00040    struct ast_var_t *var;
00041    int name_len = strlen(name) + 1;
00042    int value_len = strlen(value) + 1;
00043 
00044 #ifdef MALLOC_DEBUG
00045    if (!(var = __ast_calloc(sizeof(*var) + name_len + value_len, sizeof(char), file, lineno, function))) {
00046 #else
00047    if (!(var = ast_calloc(sizeof(*var) + name_len + value_len, sizeof(char)))) {
00048 #endif
00049       return NULL;
00050    }
00051 
00052    ast_copy_string(var->name, name, name_len);
00053    var->value = var->name + name_len;
00054    ast_copy_string(var->value, value, value_len);
00055    
00056    return var;
00057 }  

void ast_var_delete ( struct ast_var_t var  ) 

const char* ast_var_full_name ( const struct ast_var_t var  ) 

Definition at line 80 of file chanvars.c.

References ast_var_t::name.

Referenced by ast_channel_inherit_variables().

00081 {
00082    return (var ? var->name : NULL);
00083 }

const char* ast_var_name ( const struct ast_var_t var  ) 

Definition at line 65 of file chanvars.c.

References ast_var_t::name.

Referenced by ast_cdr_copy_vars(), ast_cdr_getvar_internal(), ast_cdr_serialize_variables(), ast_cdr_setvar(), ast_channel_inherit_variables(), cdr_merge_vars(), clearvar_prefix(), frame_set_var(), gosub_release_frame(), handle_show_globals(), hashkeys_read(), iax2_call(), iax2_dup_variable_datastore(), local_read(), mgcp_call(), ospauth_exec(), ospfinished_exec(), osplookup_exec(), ospnext_exec(), pbx_builtin_getvar_helper(), pbx_builtin_serialize_variables(), pbx_builtin_setvar_helper(), pbx_retrieve_variable(), shared_read(), shared_write(), sip_call(), and transmit_invite().

00066 {
00067    const char *name;
00068 
00069    if (var == NULL || (name = var->name) == NULL)
00070       return NULL;
00071    /* Return the name without the initial underscores */
00072    if (name[0] == '_') {
00073       name++;
00074       if (name[0] == '_')
00075          name++;
00076    }
00077    return name;
00078 }

const char* ast_var_value ( const struct ast_var_t var  ) 


Generated on Wed Oct 28 11:52:09 2009 for Asterisk - the Open Source PBX by  doxygen 1.5.6