Asterisk - The Open Source Telephony Project  GIT-master-44aef04
chanvars.h
Go to the documentation of this file.
1 /*
2  * Asterisk -- An open source telephony toolkit.
3  *
4  * Copyright (C) 1999 - 2005, Digium, Inc.
5  *
6  * Mark Spencer <markster@digium.com>
7  *
8  * See http://www.asterisk.org for more information about
9  * the Asterisk project. Please do not directly contact
10  * any of the maintainers of this project for assistance;
11  * the project provides a web site, mailing lists and IRC
12  * channels for your use.
13  *
14  * This program is free software, distributed under the terms of
15  * the GNU General Public License Version 2. See the LICENSE file
16  * at the top of the source tree.
17  */
18 
19 /*! \file
20  * \brief Channel Variables
21  */
22 
23 #ifndef _ASTERISK_CHANVARS_H
24 #define _ASTERISK_CHANVARS_H
25 
26 #include "asterisk/linkedlists.h"
27 
28 struct ast_var_t {
30  char *value;
31  char name[0];
32 };
33 
35 
36 struct varshead *ast_var_list_create(void);
37 void ast_var_list_destroy(struct varshead *head);
38 
39 struct ast_var_t *_ast_var_assign(const char *name, const char *value, const char *file, int lineno, const char *function);
40 #define ast_var_assign(name, value) _ast_var_assign(name, value, __FILE__, __LINE__, __PRETTY_FUNCTION__)
41 
42 void ast_var_delete(struct ast_var_t *var);
43 const char *ast_var_name(const struct ast_var_t *var);
44 const char *ast_var_full_name(const struct ast_var_t *var);
45 const char *ast_var_value(const struct ast_var_t *var);
46 char *ast_var_find(const struct varshead *head, const char *name);
47 struct varshead *ast_var_list_clone(struct varshead *head);
48 
49 #define AST_VAR_LIST_TRAVERSE(head, var) AST_LIST_TRAVERSE(head, var, entries)
50 
51 static inline void AST_VAR_LIST_INSERT_TAIL(struct varshead *head, struct ast_var_t *var) {
52  if (var) {
53  AST_LIST_INSERT_TAIL(head, var, entries);
54  }
55 }
56 
57 static inline void AST_VAR_LIST_INSERT_HEAD(struct varshead *head, struct ast_var_t *var) {
58  if (var) {
59  AST_LIST_INSERT_HEAD(head, var, entries);
60  }
61 }
62 
63 #endif /* _ASTERISK_CHANVARS_H */
const char * ast_var_value(const struct ast_var_t *var)
Definition: chanvars.c:80
const char * ast_var_name(const struct ast_var_t *var)
Definition: chanvars.c:60
#define var
Definition: ast_expr2f.c:614
struct varshead * ast_var_list_clone(struct varshead *head)
Definition: chanvars.c:124
struct ast_var_t::@243 entries
static void AST_VAR_LIST_INSERT_HEAD(struct varshead *head, struct ast_var_t *var)
Definition: chanvars.h:57
A set of macros to manage forward-linked lists.
AST_LIST_HEAD_NOLOCK(contactliststruct, contact)
struct ast_var_t * _ast_var_assign(const char *name, const char *value, const char *file, int lineno, const char *function)
Definition: chanvars.c:36
char name[0]
Definition: chanvars.h:31
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
Definition: linkedlists.h:730
void ast_var_delete(struct ast_var_t *var)
Definition: extconf.c:2473
char * value
Definition: chanvars.h:30
const char * ast_var_full_name(const struct ast_var_t *var)
Definition: chanvars.c:75
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
Definition: linkedlists.h:409
#define AST_LIST_INSERT_HEAD(head, elm, field)
Inserts a list entry at the head of a list.
Definition: linkedlists.h:710
char * ast_var_find(const struct varshead *head, const char *name)
Definition: chanvars.c:85
struct varshead * ast_var_list_create(void)
Definition: chanvars.c:97
void ast_var_list_destroy(struct varshead *head)
Definition: chanvars.c:109
static void AST_VAR_LIST_INSERT_TAIL(struct varshead *head, struct ast_var_t *var)
Definition: chanvars.h:51