core, lib, modules: restructured source code tree

- new folder src/ to hold the source code for main project applications
- main.c is in src/
- all core files are subfolder are in src/core/
- modules are in src/modules/
- libs are in src/lib/
- application Makefiles are in src/
- application binary is built in src/ (src/kamailio)

Daniel-Constantin Mierla authored on 07/12/2016 11:03:51
Showing 1 changed files
 1 1 deleted file mode 100644 ... ... @@ -1,94 +0,0 @@ 1 -/* 2 - * Copyright (C) 2009 iptelorg GmbH 3 - * 4 - * Permission to use, copy, modify, and distribute this software for any 5 - * purpose with or without fee is hereby granted, provided that the above 6 - * copyright notice and this permission notice appear in all copies. 7 - * 8 - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 - */ 16 - 17 -/*! 18 - * \file 19 - * \brief Kamailio core :: pv_core.c - pvars needed in the core, e.g. $?,$retcode 20 - * 21 - * \note Note: in general please avoid adding pvars directly to the core, unless 22 - * absolutely necessary (use/create a new module instead). 23 - * \ingroup core 24 - * Module: \ref core 25 - */ 26 - 27 -#include "pv_core.h" 28 -#include "pvar.h" 29 -#include "str.h" 30 - 31 -static int pv_get_retcode(struct sip_msg*, pv_param_t*, pv_value_t*); 32 - 33 -static pv_export_t core_pvs[] = { 34 - /* return code, various synonims */ 35 - { STR_STATIC_INIT("?"), PVT_OTHER, pv_get_retcode, 0, 0, 0, 0, 0 }, 36 - { STR_STATIC_INIT("rc"), PVT_OTHER, pv_get_retcode, 0, 0, 0, 0, 0 }, 37 - { STR_STATIC_INIT("retcode"), PVT_OTHER, pv_get_retcode, 0, 0, 0, 0, 0 }, 38 - 39 - { {0, 0}, 0, 0, 0, 0, 0, 0, 0 } 40 -}; 41 - 42 - 43 -/** ugly hack to get the return code, needed because the PVs do not know (yet) 44 - * about the script context */ 45 -extern int _last_returned_code; 46 - 47 -static int pv_get_retcode(struct sip_msg* msg, pv_param_t* p, pv_value_t* res) 48 -{ 49 - /* FIXME: as soon as PVs support script context, use it instead of the 50 - * return in global variable hack */ 51 - return pv_get_sintval(msg, p, res, _last_returned_code); 52 -} 53 - 54 - 55 - 56 -/** 57 - * register built-in core pvars. 58 - * should be called before parsing the config script. 59 - * @return 0 on success 60 - */ 61 -int pv_register_core_vars(void) 62 -{ 63 - return register_pvars_mod("core", core_pvs); 64 -} 65 - 66 -/** 67 - * 68 - */ 69 -int pv_eval_str(sip_msg_t *msg, str *dst, str *src) 70 -{ 71 - pv_elem_t *xmodel=NULL; 72 - str sval = STR_NULL; 73 - 74 - if(pv_parse_format(src, &xmodel)<0) { 75 - LM_ERR("error in parsing src parameter\n"); 76 - return -1; 77 - } 78 - 79 - if(pv_printf_s(msg, xmodel, &sval)!=0) { 80 - LM_ERR("cannot eval parsed parameter\n"); 81 - pv_elem_free_all(xmodel); 82 - goto error; 83 - } 84 - 85 - dst->s = sval.s; 86 - dst->len = sval.len; 87 - pv_elem_free_all(xmodel); 88 - 89 - return 1; 90 -error: 91 - return -1; 92 -} 93 - 94 -/* vi: set ts=4 sw=4 tw=79:ai:cindent: */

core: pv - helper function to evaluate a dynamic string

Daniel-Constantin Mierla authored on 02/05/2016 07:08:05
Showing 1 changed files
 ... ... @@ -53,7 +53,8 @@ static int pv_get_retcode(struct sip_msg* msg, pv_param_t* p, pv_value_t* res) 53 53   54 54   55 55   56 -/** register built-in core pvars. 56 +/** 57 + * register built-in core pvars. 57 58  * should be called before parsing the config script. 58 59  * @return 0 on success 59 60  */ ... ... @@ -62,4 +63,32 @@ int pv_register_core_vars(void) 62 63  return register_pvars_mod("core", core_pvs); 63 64  } 64 65   66 +/** 67 + * 68 + */ 69 +int pv_eval_str(sip_msg_t *msg, str *dst, str *src) 70 +{ 71 + pv_elem_t *xmodel=NULL; 72 + str sval = STR_NULL; 73 + 74 + if(pv_parse_format(src, &xmodel)<0) { 75 + LM_ERR("error in parsing src parameter\n"); 76 + return -1; 77 + } 78 + 79 + if(pv_printf_s(msg, xmodel, &sval)!=0) { 80 + LM_ERR("cannot eval parsed parameter\n"); 81 + pv_elem_free_all(xmodel); 82 + goto error; 83 + } 84 + 85 + dst->s = sval.s; 86 + dst->len = sval.len; 87 + pv_elem_free_all(xmodel); 88 + 89 + return 1; 90 +error: 91 + return -1; 92 +} 93 + 65 94  /* vi: set ts=4 sw=4 tw=79:ai:cindent: */

core: pv - coherent indentation and whitespacing

Daniel-Constantin Mierla authored on 02/05/2016 06:51:44
Showing 1 changed files
 ... ... @@ -1,4 +1,4 @@ 1 -/*  1 +/* 2 2  * Copyright (C) 2009 iptelorg GmbH 3 3  * 4 4  * Permission to use, copy, modify, and distribute this software for any ... ... @@ -35,19 +35,19 @@ static pv_export_t core_pvs[] = { 35 35  { STR_STATIC_INIT("?"), PVT_OTHER, pv_get_retcode, 0, 0, 0, 0, 0 }, 36 36  { STR_STATIC_INIT("rc"), PVT_OTHER, pv_get_retcode, 0, 0, 0, 0, 0 }, 37 37  { STR_STATIC_INIT("retcode"), PVT_OTHER, pv_get_retcode, 0, 0, 0, 0, 0 }, 38 -  38 + 39 39  { {0, 0}, 0, 0, 0, 0, 0, 0, 0 } 40 40  }; 41 41   42 42   43 43  /** ugly hack to get the return code, needed because the PVs do not know (yet) 44 - about the script context */ 44 + * about the script context */ 45 45  extern int _last_returned_code; 46 46   47 47  static int pv_get_retcode(struct sip_msg* msg, pv_param_t* p, pv_value_t* res) 48 48  { 49 49  /* FIXME: as soon as PVs support script context, use it instead of the 50 - return in global variable hack */ 50 + * return in global variable hack */ 51 51  return pv_get_sintval(msg, p, res, _last_returned_code); 52 52  } 53 53   ... ... @@ -55,7 +55,7 @@ static int pv_get_retcode(struct sip_msg* msg, pv_param_t* p, pv_value_t* res) 55 55   56 56  /** register built-in core pvars. 57 57  * should be called before parsing the config script. 58 - * @return 0 on success  58 + * @return 0 on success 59 59  */ 60 60  int pv_register_core_vars(void) 61 61  {

Core Removed history, svn $id$ and doxygen udpates on the .c files

Olle E. Johansson authored on 03/01/2015 09:53:17
Showing 1 changed files
 ... ... @@ -1,6 +1,4 @@ 1 1  /*  2 - * $Id$ 3 - *  4 2  * Copyright (C) 2009 iptelorg GmbH 5 3  * 6 4  * Permission to use, copy, modify, and distribute this software for any ... ... @@ -15,16 +13,13 @@ 15 13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 15  */ 18 -/* 19 - * pv_core.c - pvars needed in the core, e.g. $?,$retcode 20 - * 21 - * Note: in general please avoid adding pvars directly to the core, unless 22 - * absolutely necessary (use/create a new module instead). 23 - */ 24 16   25 17  /*! 26 18  * \file 27 - * \brief SIP-router core ::  19 + * \brief Kamailio core :: pv_core.c - pvars needed in the core, e.g. $?,$retcode 20 + * 21 + * \note Note: in general please avoid adding pvars directly to the core, unless 22 + * absolutely necessary (use/create a new module instead). 28 23  * \ingroup core 29 24  * Module: \ref core 30 25  */ ... ... @@ -45,7 +40,7 @@ static pv_export_t core_pvs[] = { 45 40  }; 46 41   47 42   48 -/* ugly hack to get the return code, needed because the PVs do not know (yet) 43 +/** ugly hack to get the return code, needed because the PVs do not know (yet) 49 44  about the script context */ 50 45  extern int _last_returned_code; 51 46 

Adding doxygen template to all core .c files

Please fill in after the :: to explain the function of this file.

oej authored on 10/10/2009 13:54:13
Showing 1 changed files
 ... ... @@ -22,6 +22,13 @@ 22 22  * absolutely necessary (use/create a new module instead). 23 23  */ 24 24   25 +/*! 26 + * \file 27 + * \brief SIP-router core ::  28 + * \ingroup core 29 + * Module: \ref core 30 + */ 31 + 25 32  #include "pv_core.h" 26 33  #include "pvar.h" 27 34  #include "str.h"

core: core pvars added for $?/$retcode/$rc - added core pvars (registered before script parsing) for the return code ($?, $retcode,$rc). This solves script conflicts
between the different return code handling (kamailio - pvars and
ser built-in expr. elem).
- removed ser expr. elem for retcode (not needed anymore)
- added '?' as a valid pvar char (needed so that $? will be accepted) Andrei Pelinescu-Onciul authored on 07/10/2009 21:57:45 Showing 1 changed files  1 1 new file mode 100644 ... ... @@ -0,0 +1,63 @@ 1 +/*  2 + *$Id$ 3 + *  4 + * Copyright (C) 2009 iptelorg GmbH 5 + * 6 + * Permission to use, copy, modify, and distribute this software for any 7 + * purpose with or without fee is hereby granted, provided that the above 8 + * copyright notice and this permission notice appear in all copies. 9 + * 10 + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 + */ 18 +/* 19 + * pv_core.c - pvars needed in the core, e.g.$?, \$retcode 20 + * 21 + * Note: in general please avoid adding pvars directly to the core, unless 22 + * absolutely necessary (use/create a new module instead). 23 + */ 24 + 25 +#include "pv_core.h" 26 +#include "pvar.h" 27 +#include "str.h" 28 + 29 +static int pv_get_retcode(struct sip_msg*, pv_param_t*, pv_value_t*); 30 + 31 +static pv_export_t core_pvs[] = { 32 + /* return code, various synonims */ 33 + { STR_STATIC_INIT("?"), PVT_OTHER, pv_get_retcode, 0, 0, 0, 0, 0 }, 34 + { STR_STATIC_INIT("rc"), PVT_OTHER, pv_get_retcode, 0, 0, 0, 0, 0 }, 35 + { STR_STATIC_INIT("retcode"), PVT_OTHER, pv_get_retcode, 0, 0, 0, 0, 0 }, 36 +  37 + { {0, 0}, 0, 0, 0, 0, 0, 0, 0 } 38 +}; 39 + 40 + 41 +/* ugly hack to get the return code, needed because the PVs do not know (yet) 42 + about the script context */ 43 +extern int _last_returned_code; 44 + 45 +static int pv_get_retcode(struct sip_msg* msg, pv_param_t* p, pv_value_t* res) 46 +{ 47 + /* FIXME: as soon as PVs support script context, use it instead of the 48 + return in global variable hack */ 49 + return pv_get_sintval(msg, p, res, _last_returned_code); 50 +} 51 + 52 + 53 + 54 +/** register built-in core pvars. 55 + * should be called before parsing the config script. 56 + * @return 0 on success  57 + */ 58 +int pv_register_core_vars(void) 59 +{ 60 + return register_pvars_mod("core", core_pvs); 61 +} 62 + 63 +/* vi: set ts=4 sw=4 tw=79:ai:cindent: */