1 /* 2 * Copyright (C) 2008 iptelorg GmbH 3 * 4 * This file is part of Kamailio, a free SIP server. 5 * 6 * Kamailio is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version 10 * 11 * Kamailio is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 * 20 */ 21 22 #ifndef _CFG_SCRIPT_H 23 #define _CFG_SCRIPT_H 24 25 #include "../str.h" 26 #include "cfg_struct.h" 27 28 /* structure used for temporary storing the variables 29 * which are declared in the script */ 30 typedef struct _cfg_script_var { 31 unsigned int type; 32 union { 33 str s; 34 int i; 35 } val; 36 int min; 37 int max; 38 struct _cfg_script_var *next; 39 int name_len; 40 char *name; 41 char *descr; 42 } cfg_script_var_t; 43 44 /* allocates memory for a new config script variable 45 * The value of the variable is not set! 46 */ 47 cfg_script_var_t *new_cfg_script_var(char *gname, char *vname, unsigned int type, 48 char *descr); 49 50 /* Rewrite the value of an already declared script variable before forking. 51 * Return value: 52 * 0: success 53 * -1: error 54 * 1: variable not found 55 */ 56 int cfg_set_script_var(cfg_group_t *group, str *var_name, 57 void *val, unsigned int val_type); 58 59 /* fix-up the dynamically declared group */ 60 int cfg_script_fixup(cfg_group_t *group, unsigned char *block); 61 62 /* destory a dynamically allocated group definition */ 63 void cfg_script_destroy(cfg_group_t *group); 64 65 #endif /* _CFG_SCRIPT_H */ 66