#### 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,152 +0,0 @@ 1 -/*  2 - * Copyright (C) 2005 iptelorg GmbH 3 - * 4 - * This file is part of ser, a free SIP server. 5 - * 6 - * ser 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 - * For a license to use the ser software under conditions 12 - * other than those described here, or to purchase support for this 13 - * software, please contact iptel.org by e-mail at the following addresses: 14 - * info@iptel.org 15 - * 16 - * ser is distributed in the hope that it will be useful, 17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 - * GNU General Public License for more details. 20 - * 21 - * You should have received a copy of the GNU General Public License 22 - * along with this program; if not, write to the Free Software 23 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 24 - */ 25 - 26 -#ifndef __DSTRING_H 27 -#define __DSTRING_H 28 - 29 -#include  30 - 31 -#ifdef __cplusplus 32 -extern "C" { 33 -#endif 34 - 35 -/** \ingroup cds 36 - * @{  37 - * 38 - * \defgroup cds_dstring Dynamic strings 39 - * 40 - * Dynamic strings were introduced to satisfy needs of presence 41 - * modules when building presence documents. 42 - * 43 - * Dynamic string uses a list of buffers holding data.  44 - * Buffers are allocated when needed - when there is not enough 45 - * space in the last buffer. The whole result can be copied into one 46 - * destination buffer with \ref dstr_get_data, \ref dstr_get_str 47 - * or \ref dstr_get_str_pkg function. 48 - * 49 - * \todo Function with sprintf syntax which will help with  50 - * readibility of code using dynamic strings. 51 - * @{ 52 - * */ 53 - 54 -/** Buffer used by dynamic string.  55 - * 56 - * \todo 'len' and 'used' can be replaced by 'unused' member  57 - * but it doesn't save too much */ 58 -typedef struct _dstr_buff_t { 59 - int len; /**< the buffer length */ 60 - int used; /**< already used bytes from buffer */ 61 - struct _dstr_buff_t *next; /**< pointer to next buffer in the list*/ 62 - char data[1]; /** buffer data */ 63 -} dstr_buff_t; 64 - 65 -/** Dynamic string structure. It is used 66 - * for muliple appends of any strings.  67 - * 68 - * \note There was an attempt to add flags for SHM/PKG memory using, ... 69 - * but it shows that it slows down, thus they were removed and only the 70 - * "most quick" version is used (rather two functions than one with param) */ 71 -typedef struct _dstring_t { 72 - /** pointer to the first buffer in the list */ 73 - dstr_buff_t *first; 74 - /** pointer to the last buffer in the list */ 75 - dstr_buff_t *last; 76 - /** the length of whole string */ 77 - int len; 78 - /** predefined buffer size */ 79 - int buff_size; 80 - 81 - /** a operation on this string was unsuccesfull ->  82 - * all other operations will produce error */ 83 - int error; 84 -} dstring_t; 85 - 86 -/** Appends zero terminated string to dynamic string. 87 - * \retval 0 if successful 88 - * \retval negative on error */ 89 -int dstr_append_zt(dstring_t *dstr, const char *s); 90 - 91 -/** Appends string with given length to dynamic string. 92 - * \retval 0 if successful 93 - * \retval negative on error */ 94 -int dstr_append(dstring_t *dstr, const char *s, int len); 95 - 96 -/** Appends string to dynamic string. 97 - * \retval 0 if successful 98 - * \retval negative on error */ 99 -int dstr_append_str(dstring_t *dstr, const str_t *s); 100 - 101 -/* int dstr_get_data_length(dstring_t *dstr); */ 102 - 103 -/** Returns data stored in dynamic string. It does NOT allocate 104 - * space for them - it expects that the buffer is already allocated.  105 - * \retval 0 if successful 106 - * \retval negative on error */ 107 -int dstr_get_data(dstring_t *dstr, char *dst); 108 - 109 -/** Returns data stored in dynamic string. It allocates space for 110 - * them with cds_malloc (SER's shared memory).  111 - * \retval 0 if successful 112 - * \retval negative on error */ 113 -int dstr_get_str(dstring_t *dstr, str_t *dst); 114 - 115 -/** Returns data stored in dynamic string. It allocates space for 116 - * them with cds_malloc_pkg (SER's package memory). 117 - * \retval 0 if successful 118 - * \retval negative on error */ 119 -int dstr_get_str_pkg(dstring_t *dstr, str_t *dst); 120 -/** Initializes dynamic string. 121 - * \param dstr dynamic string to be initialized 122 - * \param buff_size size of buffer used with this dynamic string  123 - * \retval 0 if successful 124 - * \retval negative on error */ 125 -int dstr_init(dstring_t *dstr, int buff_size); 126 - 127 -/** Destroys dynamic string. It frees all allocated buffers. */ 128 -int dstr_destroy(dstring_t *dstr); 129 - 130 -/* returns nozero if error !!! */ 131 -/* int dstr_error(dstring_t *dstr); 132 -void dstr_clear_error(dstring_t *dstr); */ 133 - 134 -/** Macro returning length of data stored in dynamic string. */ 135 -#define dstr_get_data_length(dstr) (dstr)->len 136 - 137 -/** Macro pointing to error in dynamic string. If set 138 - * there was an error during a previous operation with 139 - * this dynamic string. */ 140 -#define dstr_error(dstr) (dstr)->error 141 - 142 -/** Macro for cleaning error flag in dynamic string. */ 143 -#define dstr_clear_error(dstr) (dstr)->error = 0 144 - 145 -/** @}  146 - @} */ 147 - 148 -#ifdef __cplusplus 149 -} 150 -#endif 151 -  152 -#endif

#### all: updated FSF address in GPL text

Anthony Messina authored on 04/07/2014 09:36:37 • Daniel-Constantin Mierla committed on 04/07/2014 09:37:36
Showing 1 changed files
 ... ... @@ -20,7 +20,7 @@ 20 20  * 21 21  * You should have received a copy of the GNU General Public License 22 22  * along with this program; if not, write to the Free Software 23 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 24 24  */ 25 25   26 26  #ifndef __DSTRING_H

#### next piece of documentation

Vaclav Kubart authored on 10/05/2007 16:46:08
Showing 1 changed files
 ... ... @@ -32,47 +32,119 @@ 32 32  extern "C" { 33 33  #endif 34 34   35 +/** \ingroup cds 36 + * @{  37 + * 38 + * \defgroup cds_dstring Dynamic strings 39 + * 40 + * Dynamic strings were introduced to satisfy needs of presence 41 + * modules when building presence documents. 42 + * 43 + * Dynamic string uses a list of buffers holding data.  44 + * Buffers are allocated when needed - when there is not enough 45 + * space in the last buffer. The whole result can be copied into one 46 + * destination buffer with \ref dstr_get_data, \ref dstr_get_str 47 + * or \ref dstr_get_str_pkg function. 48 + * 49 + * \todo Function with sprintf syntax which will help with  50 + * readibility of code using dynamic strings. 51 + * @{ 52 + * */ 53 + 54 +/** Buffer used by dynamic string.  55 + * 56 + * \todo 'len' and 'used' can be replaced by 'unused' member  57 + * but it doesn't save too much */ 35 58  typedef struct _dstr_buff_t { 36 - int len; 37 - int used; 38 - struct _dstr_buff_t *next; /* pointer to next buffer */ 39 - char data[1]; 59 + int len; /**< the buffer length */ 60 + int used; /**< already used bytes from buffer */ 61 + struct _dstr_buff_t *next; /**< pointer to next buffer in the list*/ 62 + char data[1]; /** buffer data */ 40 63  } dstr_buff_t; 41 64   42 65  /** Dynamic string structure. It is used 43 66  * for muliple appends of any strings.  44 67  * 45 - * There was an attempt to add flags for SHM/PKG memory using, ... 68 + * \note There was an attempt to add flags for SHM/PKG memory using, ... 46 69  * but it shows that it slows down, thus they were removed and only the 47 70  * "most quick" version is used (rather two functions than one with param) */ 48 71  typedef struct _dstring_t { 49 - dstr_buff_t *first, *last; 72 + /** pointer to the first buffer in the list */ 73 + dstr_buff_t *first; 74 + /** pointer to the last buffer in the list */ 75 + dstr_buff_t *last; 50 76  /** the length of whole string */ 51 77  int len; 78 + /** predefined buffer size */ 52 79  int buff_size; 53 80   54 - /** a operation on this string was unsuccesfull -> all other will produce error */ 81 + /** a operation on this string was unsuccesfull ->  82 + * all other operations will produce error */ 55 83  int error; 56 84  } dstring_t; 57 85   86 +/** Appends zero terminated string to dynamic string. 87 + * \retval 0 if successful 88 + * \retval negative on error */ 58 89  int dstr_append_zt(dstring_t *dstr, const char *s); 90 + 91 +/** Appends string with given length to dynamic string. 92 + * \retval 0 if successful 93 + * \retval negative on error */ 59 94  int dstr_append(dstring_t *dstr, const char *s, int len); 95 + 96 +/** Appends string to dynamic string. 97 + * \retval 0 if successful 98 + * \retval negative on error */ 60 99  int dstr_append_str(dstring_t *dstr, const str_t *s); 100 + 61 101  /* int dstr_get_data_length(dstring_t *dstr); */ 102 + 103 +/** Returns data stored in dynamic string. It does NOT allocate 104 + * space for them - it expects that the buffer is already allocated.  105 + * \retval 0 if successful 106 + * \retval negative on error */ 62 107  int dstr_get_data(dstring_t *dstr, char *dst); 108 + 109 +/** Returns data stored in dynamic string. It allocates space for 110 + * them with cds_malloc (SER's shared memory).  111 + * \retval 0 if successful 112 + * \retval negative on error */ 63 113  int dstr_get_str(dstring_t *dstr, str_t *dst); 114 + 115 +/** Returns data stored in dynamic string. It allocates space for 116 + * them with cds_malloc_pkg (SER's package memory). 117 + * \retval 0 if successful 118 + * \retval negative on error */ 64 119  int dstr_get_str_pkg(dstring_t *dstr, str_t *dst); 120 +/** Initializes dynamic string. 121 + * \param dstr dynamic string to be initialized 122 + * \param buff_size size of buffer used with this dynamic string  123 + * \retval 0 if successful 124 + * \retval negative on error */ 65 125  int dstr_init(dstring_t *dstr, int buff_size); 126 + 127 +/** Destroys dynamic string. It frees all allocated buffers. */ 66 128  int dstr_destroy(dstring_t *dstr); 67 129   68 130  /* returns nozero if error !!! */ 69 131  /* int dstr_error(dstring_t *dstr); 70 132  void dstr_clear_error(dstring_t *dstr); */ 71 133   134 +/** Macro returning length of data stored in dynamic string. */ 72 135  #define dstr_get_data_length(dstr) (dstr)->len 136 + 137 +/** Macro pointing to error in dynamic string. If set 138 + * there was an error during a previous operation with 139 + * this dynamic string. */ 73 140  #define dstr_error(dstr) (dstr)->error 141 + 142 +/** Macro for cleaning error flag in dynamic string. */ 74 143  #define dstr_clear_error(dstr) (dstr)->error = 0 75 144   145 +/** @}  146 + @} */ 147 + 76 148  #ifdef __cplusplus 77 149  } 78 150  #endif

#### optimalizations of string and dstring functions

Vaclav Kubart authored on 28/06/2006 15:22:37
Showing 1 changed files
 ... ... @@ -27,22 +27,26 @@ 27 27  #define __DSTRING_H 28 28   29 29  #include  30 -#include  31 30   32 31  #ifdef __cplusplus 33 32  extern "C" { 34 33  #endif 35 34   36 -typedef struct dstr_buff { 35 +typedef struct _dstr_buff_t { 37 36  int len; 38 37  int used; 38 + struct _dstr_buff_t *next; /* pointer to next buffer */ 39 39  char data[1]; 40 40  } dstr_buff_t; 41 41   42 42  /** Dynamic string structure. It is used 43 - * for muliple appends of any strings. */ 43 + * for muliple appends of any strings.  44 + * 45 + * There was an attempt to add flags for SHM/PKG memory using, ... 46 + * but it shows that it slows down, thus they were removed and only the 47 + * "most quick" version is used (rather two functions than one with param) */ 44 48  typedef struct _dstring_t { 45 - dlink_t buffers; 49 + dstr_buff_t *first, *last; 46 50  /** the length of whole string */ 47 51  int len; 48 52  int buff_size; ... ... @@ -54,15 +58,20 @@ typedef struct _dstring_t { 54 58  int dstr_append_zt(dstring_t *dstr, const char *s); 55 59  int dstr_append(dstring_t *dstr, const char *s, int len); 56 60  int dstr_append_str(dstring_t *dstr, const str_t *s); 57 -int dstr_get_data_length(dstring_t *dstr); 61 +/* int dstr_get_data_length(dstring_t *dstr); */ 58 62  int dstr_get_data(dstring_t *dstr, char *dst); 59 63  int dstr_get_str(dstring_t *dstr, str_t *dst); 64 +int dstr_get_str_pkg(dstring_t *dstr, str_t *dst); 60 65  int dstr_init(dstring_t *dstr, int buff_size); 61 66  int dstr_destroy(dstring_t *dstr); 62 67   63 68  /* returns nozero if error !!! */ 64 -int dstr_error(dstring_t *dstr); 65 -void dstr_clear_error(dstring_t *dstr); 69 +/* int dstr_error(dstring_t *dstr); 70 +void dstr_clear_error(dstring_t *dstr); */ 71 + 72 +#define dstr_get_data_length(dstr) (dstr)->len 73 +#define dstr_error(dstr) (dstr)->error 74 +#define dstr_clear_error(dstr) (dstr)->error = 0 66 75   67 76  #ifdef __cplusplus 68 77  }

#### improved robustness

Vaclav Kubart authored on 06/03/2006 14:42:28
Showing 1 changed files
 ... ... @@ -46,6 +46,9 @@ typedef struct _dstring_t { 46 46  /** the length of whole string */ 47 47  int len; 48 48  int buff_size; 49 + 50 + /** a operation on this string was unsuccesfull -> all other will produce error */ 51 + int error; 49 52  } dstring_t; 50 53   51 54  int dstr_append_zt(dstring_t *dstr, const char *s); ... ... @@ -57,6 +60,10 @@ int dstr_get_str(dstring_t *dstr, str_t *dst); 57 60  int dstr_init(dstring_t *dstr, int buff_size); 58 61  int dstr_destroy(dstring_t *dstr); 59 62   63 +/* returns nozero if error !!! */ 64 +int dstr_error(dstring_t *dstr); 65 +void dstr_clear_error(dstring_t *dstr); 66 + 60 67  #ifdef __cplusplus 61 68  } 62 69  #endif

#### Added first attempt to CDS library documentation with very short description in README.

Vaclav Kubart authored on 03/11/2005 09:59:37
Showing 1 changed files
 ... ... @@ -41,7 +41,7 @@ typedef struct dstr_buff { 41 41   42 42  /** Dynamic string structure. It is used 43 43  * for muliple appends of any strings. */ 44 -typedef struct dstring { 44 +typedef struct _dstring_t { 45 45  dlink_t buffers; 46 46  /** the length of whole string */ 47 47  int len;

#### Added a set of shared libraries with useful functions and common data structures. Short description is in lib/README, more documentation will be added soon.

Vaclav Kubart authored on 25/10/2005 14:10:16
Showing 1 changed files
 1 1 new file mode 100644 ... ... @@ -0,0 +1,64 @@ 1 +/*  2 + * Copyright (C) 2005 iptelorg GmbH 3 + * 4 + * This file is part of ser, a free SIP server. 5 + * 6 + * ser 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 + * For a license to use the ser software under conditions 12 + * other than those described here, or to purchase support for this 13 + * software, please contact iptel.org by e-mail at the following addresses: 14 + * info@iptel.org 15 + * 16 + * ser is distributed in the hope that it will be useful, 17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 + * GNU General Public License for more details. 20 + * 21 + * You should have received a copy of the GNU General Public License 22 + * along with this program; if not, write to the Free Software 23 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 + */ 25 + 26 +#ifndef __DSTRING_H 27 +#define __DSTRING_H 28 + 29 +#include  30 +#include  31 + 32 +#ifdef __cplusplus 33 +extern "C" { 34 +#endif 35 + 36 +typedef struct dstr_buff { 37 + int len; 38 + int used; 39 + char data[1]; 40 +} dstr_buff_t; 41 + 42 +/** Dynamic string structure. It is used 43 + * for muliple appends of any strings. */ 44 +typedef struct dstring { 45 + dlink_t buffers; 46 + /** the length of whole string */ 47 + int len; 48 + int buff_size; 49 +} dstring_t; 50 + 51 +int dstr_append_zt(dstring_t *dstr, const char *s); 52 +int dstr_append(dstring_t *dstr, const char *s, int len); 53 +int dstr_append_str(dstring_t *dstr, const str_t *s); 54 +int dstr_get_data_length(dstring_t *dstr); 55 +int dstr_get_data(dstring_t *dstr, char *dst); 56 +int dstr_get_str(dstring_t *dstr, str_t *dst); 57 +int dstr_init(dstring_t *dstr, int buff_size); 58 +int dstr_destroy(dstring_t *dstr); 59 + 60 +#ifdef __cplusplus 61 +} 62 +#endif 63 +  64 +#endif