... | ... |
@@ -15,8 +15,10 @@ |
15 | 15 |
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
16 | 16 |
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
17 | 17 |
*/ |
18 |
-/* |
|
19 |
- * atomic operations and memory barriers (alpha specific) |
|
18 |
+ |
|
19 |
+/** @file |
|
20 |
+ * @brief atomic operations and memory barriers (alpha specific) |
|
21 |
+ * |
|
20 | 22 |
* WARNING: atomic ops do not include memory barriers |
21 | 23 |
* see atomic_ops.h for more details |
22 | 24 |
* |
... | ... |
@@ -15,7 +15,8 @@ |
15 | 15 |
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
16 | 16 |
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
17 | 17 |
*/ |
18 |
-/* |
|
18 |
+ |
|
19 |
+/** @file @brief |
|
19 | 20 |
* atomic ops and memory barriers for arm (>= v3) |
20 | 21 |
* see atomic_ops.h for more details |
21 | 22 |
* |
... | ... |
@@ -15,10 +15,12 @@ |
15 | 15 |
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
16 | 16 |
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
17 | 17 |
*/ |
18 |
-/* |
|
18 |
+ |
|
19 |
+/** @file @brief |
|
19 | 20 |
* common part for all the atomic operations (atomic_t and common operations) |
20 |
- * See atomic_ops.h for more info. |
|
21 |
+ * See @ref atomic_ops.h for more info. |
|
21 | 22 |
*/ |
23 |
+ |
|
22 | 24 |
/* |
23 | 25 |
* History: |
24 | 26 |
* -------- |
... | ... |
@@ -28,16 +30,18 @@ |
28 | 28 |
#ifndef __atomic_common |
29 | 29 |
#define __atomic_common |
30 | 30 |
|
31 |
-/* atomic_t defined as a struct to easily catch non atomic ops. on it, |
|
31 |
+/** @brief atomic_t defined as a struct to easily catch non atomic ops. on it, |
|
32 | 32 |
* e.g. atomic_t foo; foo++ will generate a compile error */ |
33 | 33 |
typedef struct{ volatile int val; } atomic_t; |
34 | 34 |
|
35 | 35 |
|
36 |
-/* store and load operations are atomic on all cpus, note however that they |
|
36 |
+/** @name AtomicOps store and load operations are atomic on all cpus, note however that they |
|
37 | 37 |
* don't include memory barriers so if you want to use atomic_{get,set} |
38 | 38 |
* to implement mutexes you must use the mb_* versions or explicitely use |
39 | 39 |
* the barriers */ |
40 | 40 |
|
41 |
+/*@{ */ |
|
42 |
+ |
|
41 | 43 |
#define atomic_set_int(pvar, i) (*(int*)(pvar)=i) |
42 | 44 |
#define atomic_set_long(pvar, i) (*(long*)(pvar)=i) |
43 | 45 |
#define atomic_get_int(pvar) (*(int*)(pvar)) |
... | ... |
@@ -50,5 +54,6 @@ inline static int atomic_get(atomic_t *v) |
50 | 50 |
return atomic_get_int(&(v->val)); |
51 | 51 |
} |
52 | 52 |
|
53 |
+/*@} */ |
|
53 | 54 |
|
54 | 55 |
#endif |
... | ... |
@@ -15,7 +15,8 @@ |
15 | 15 |
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
16 | 16 |
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
17 | 17 |
*/ |
18 |
-/* |
|
18 |
+ |
|
19 |
+/** @file @brief |
|
19 | 20 |
* atomic operations and memory barriers (mips isa 2 and mips64 specific) |
20 | 21 |
* WARNING: atomic ops do not include memory barriers |
21 | 22 |
* see atomic_ops.h for more details |
... | ... |
@@ -15,7 +15,8 @@ |
15 | 15 |
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
16 | 16 |
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
17 | 17 |
*/ |
18 |
-/* |
|
18 |
+ |
|
19 |
+/** @file @brief |
|
19 | 20 |
* include file for native (asm) atomic operations and memory barriers |
20 | 21 |
* WARNING: atomic ops do not include memory barriers |
21 | 22 |
* See atomic_ops.h for more info. |
... | ... |
@@ -15,7 +15,8 @@ |
15 | 15 |
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
16 | 16 |
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
17 | 17 |
*/ |
18 |
-/* |
|
18 |
+ |
|
19 |
+/** @file @brief |
|
19 | 20 |
* atomic operations and memory barriers (powerpc and powerpc64 versions) |
20 | 21 |
* WARNING: atomic ops do not include memory barriers |
21 | 22 |
* see atomic_ops.h for more details |
... | ... |
@@ -15,12 +15,14 @@ |
15 | 15 |
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
16 | 16 |
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
17 | 17 |
*/ |
18 |
-/* |
|
18 |
+ |
|
19 |
+/** @file @brief |
|
19 | 20 |
* memory barriers for sparc32 ( version < v 9)) |
20 | 21 |
* see atomic_ops.h for more details |
21 | 22 |
* |
22 | 23 |
* Config defines: NOSMP |
23 | 24 |
*/ |
25 |
+ |
|
24 | 26 |
/* |
25 | 27 |
* History: |
26 | 28 |
* -------- |
... | ... |
@@ -15,7 +15,8 @@ |
15 | 15 |
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
16 | 16 |
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
17 | 17 |
*/ |
18 |
-/* |
|
18 |
+ |
|
19 |
+/** @file @brief |
|
19 | 20 |
* atomic operations and memory barriers (sparc64 version, 32 and 64 bit modes) |
20 | 21 |
* WARNING: atomic ops do not include memory barriers |
21 | 22 |
* see atomic_ops.h for more details |
... | ... |
@@ -25,6 +26,7 @@ |
25 | 25 |
* sparc32plus code) |
26 | 26 |
* - NOSMP |
27 | 27 |
*/ |
28 |
+ |
|
28 | 29 |
/* |
29 | 30 |
* History: |
30 | 31 |
* -------- |
... | ... |
@@ -15,7 +15,8 @@ |
15 | 15 |
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
16 | 16 |
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
17 | 17 |
*/ |
18 |
-/* |
|
18 |
+ |
|
19 |
+/** @file @brief |
|
19 | 20 |
* atomic operations and memory barriers implemented using locks |
20 | 21 |
* (for architectures not yet supported via inline asm) |
21 | 22 |
* |
... | ... |
@@ -15,7 +15,8 @@ |
15 | 15 |
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
16 | 16 |
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
17 | 17 |
*/ |
18 |
-/* |
|
18 |
+ |
|
19 |
+/** @file @brief |
|
19 | 20 |
* atomic operations and memory barriers (x86 and x86_64/amd64 specific) |
20 | 21 |
* WARNING: atomic ops do not include memory barriers |
21 | 22 |
* see atomic_ops.h for more details |
... | ... |
@@ -175,7 +175,7 @@ |
175 | 175 |
|
176 | 176 |
#include "atomic/atomic_native.h" |
177 | 177 |
|
178 |
-/* if no native operations, emulate them using locks */ |
|
178 |
+/*! \brief if no native operations, emulate them using locks */ |
|
179 | 179 |
#if ! defined HAVE_ASM_INLINE_ATOMIC_OPS || ! defined HAVE_ASM_INLINE_MEMBAR |
180 | 180 |
|
181 | 181 |
#include "atomic/atomic_unknown.h" |
... | ... |
@@ -10,11 +10,6 @@ |
10 | 10 |
* the Free Software Foundation; either version 2 of the License, or |
11 | 11 |
* (at your option) any later version |
12 | 12 |
* |
13 |
- * For a license to use the ser software under conditions |
|
14 |
- * other than those described here, or to purchase support for this |
|
15 |
- * software, please contact iptel.org by e-mail at the following addresses: |
|
16 |
- * info@iptel.org |
|
17 |
- * |
|
18 | 13 |
* ser is distributed in the hope that it will be useful, |
19 | 14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
20 | 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
... | ... |
@@ -24,6 +19,7 @@ |
24 | 24 |
* along with this program; if not, write to the Free Software |
25 | 25 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
26 | 26 |
*/ |
27 |
+ |
|
27 | 28 |
/*! |
28 | 29 |
* \file |
29 | 30 |
* \brief SIP-router core :: atomic_ops init functions |
... | ... |
@@ -17,6 +17,7 @@ |
17 | 17 |
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
18 | 18 |
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
19 | 19 |
*/ |
20 |
+ |
|
20 | 21 |
/*! |
21 | 22 |
* \file |
22 | 23 |
* \brief SIP-router core :: convert/decode to/from ascii using various bases |
... | ... |
@@ -27,15 +28,6 @@ |
27 | 27 |
* |
28 | 28 |
* |
29 | 29 |
* Functions: |
30 |
- * - init_basex() : inits internal lookup tables |
|
31 |
- * - HEX_HI(unsigned char c) : returns the first 4 bits of c converted to a hex digit |
|
32 |
- * - HEX_LOW(unsigned char c) : returns the low 4 bits of converted to a hex digit |
|
33 |
- * - UNHEX(unsigned char hex_digit) : converts hex_digit to a |
|
34 |
- * number (0..15); it might |
|
35 |
- * return 0xff for invalid |
|
36 |
- * digit (but with some compile |
|
37 |
- * option it won't check) |
|
38 |
- * |
|
39 | 30 |
* - base16_enc(src, src_len, dst, dst_len) : encode to standard hex |
40 | 31 |
* - base16_dec(src, src_len, dst, dst_len) : decode from standard hex |
41 | 32 |
* - base16_enc_len(len) : length needed to encode len bytes (macro) |
... | ... |
@@ -61,7 +53,7 @@ |
61 | 61 |
* for some interesting tests and ideeas). |
62 | 62 |
* |
63 | 63 |
* Test results for 40 bytes (typical ser nounce) in average cpu cycles: |
64 |
-<verbatim> |
|
64 |
+\verbatim |
|
65 | 65 |
* lookup lookup_large lookup8k no-lookup |
66 | 66 |
* base16_enc 211/231 218/199 - 1331 |
67 | 67 |
* base16_dec 252/251 236 - 1226 |
... | ... |
@@ -70,7 +62,7 @@ |
70 | 70 |
* q_base64_enc - 288 |
71 | 71 |
* q_base64_dec - 281 |
72 | 72 |
* (see test/basex.txt for more results) |
73 |
-</verbatim> |
|
73 |
+\endverbatim |
|
74 | 74 |
* |
75 | 75 |
* Defines: |
76 | 76 |
* - BASE64_LOOKUP_TABLE/NO_BASE64_LOOKUP_TABLE : use (default)/don't use |
... | ... |
@@ -144,11 +136,17 @@ |
144 | 144 |
extern unsigned char _bx_hexdig_hi[256]; |
145 | 145 |
extern unsigned char _bx_hexdig_low[256]; |
146 | 146 |
|
147 |
+/*! \brief returns the first 4 bits of c converted to a hex digit */ |
|
147 | 148 |
#define HEX_HI(h) _bx_hexdig_hi[(unsigned char)(h)] |
149 |
+/*! \brief returns the low 4 bits of converted to a hex digit */ |
|
148 | 150 |
#define HEX_LOW(h) _bx_hexdig_low[(unsigned char)(h)] |
149 | 151 |
|
150 | 152 |
extern unsigned char _bx_unhexdig256[256]; |
151 | 153 |
|
154 |
+/*! \brief converts hex_digit to a number (0..15); it might |
|
155 |
+ * \return 0xff for invalid digit (but with some compile |
|
156 |
+ * option it won't check) |
|
157 |
+ */ |
|
152 | 158 |
#define UNHEX(h) _bx_unhexdig256[(h)] |
153 | 159 |
|
154 | 160 |
#else /* BASE16_LOOKUP_LARGE */ |
... | ... |
@@ -861,6 +859,7 @@ inline static int q_base64_dec(unsigned char* src, int slen, |
861 | 861 |
#undef q_b64_pad |
862 | 862 |
} |
863 | 863 |
|
864 |
+/*! \brief inits internal lookup tables */ |
|
864 | 865 |
int init_basex(); |
865 | 866 |
|
866 | 867 |
|
... | ... |
@@ -12,11 +12,6 @@ |
12 | 12 |
* the Free Software Foundation; either version 2 of the License, or |
13 | 13 |
* (at your option) any later version |
14 | 14 |
* |
15 |
- * For a license to use the ser software under conditions |
|
16 |
- * other than those described here, or to purchase support for this |
|
17 |
- * software, please contact iptel.org by e-mail at the following addresses: |
|
18 |
- * info@iptel.org |
|
19 |
- * |
|
20 | 15 |
* ser is distributed in the hope that it will be useful, |
21 | 16 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
22 | 17 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
... | ... |
@@ -43,7 +38,7 @@ |
43 | 43 |
#ifndef _clist_h |
44 | 44 |
#define _clist_h |
45 | 45 |
|
46 |
-/* circular list */ |
|
46 |
+/*! \brief circular list */ |
|
47 | 47 |
#define clist_init(c, next, prev) \ |
48 | 48 |
do{ \ |
49 | 49 |
(c)->next=(void*)(c); \ |
... | ... |
@@ -10,11 +10,6 @@ |
10 | 10 |
* the Free Software Foundation; either version 2 of the License, or |
11 | 11 |
* (at your option) any later version |
12 | 12 |
* |
13 |
- * For a license to use the ser software under conditions |
|
14 |
- * other than those described here, or to purchase support for this |
|
15 |
- * software, please contact iptel.org by e-mail at the following addresses: |
|
16 |
- * info@iptel.org |
|
17 |
- * |
|
18 | 13 |
* ser is distributed in the hope that it will be useful, |
19 | 14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
20 | 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
... | ... |
@@ -25,12 +20,12 @@ |
25 | 25 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
26 | 26 |
*/ |
27 | 27 |
|
28 |
-/* compatibility defs for emergency roll-back if things do not work ; |
|
28 |
+/*! \brief compatibility defs for emergency roll-back if things do not work ; |
|
29 | 29 |
* if that happens: |
30 |
- * a) define PRESERVE_ZT (affects most of parser) |
|
31 |
- * b) define DONT_REMOVE_ZT (affects first line) |
|
32 |
- * c) define SCRATCH |
|
33 |
- * d) undefine REMOVE_ALL_ZT (affects via) |
|
30 |
+ * - a) define PRESERVE_ZT (affects most of parser) |
|
31 |
+ * - b) define DONT_REMOVE_ZT (affects first line) |
|
32 |
+ * - c) define SCRATCH |
|
33 |
+ * - d) undefine REMOVE_ALL_ZT (affects via) |
|
34 | 34 |
*/ |
35 | 35 |
|
36 | 36 |
|
... | ... |
@@ -12,11 +12,6 @@ |
12 | 12 |
* the Free Software Foundation; either version 2 of the License, or |
13 | 13 |
* (at your option) any later version |
14 | 14 |
* |
15 |
- * For a license to use the ser software under conditions |
|
16 |
- * other than those described here, or to purchase support for this |
|
17 |
- * software, please contact iptel.org by e-mail at the following addresses: |
|
18 |
- * info@iptel.org |
|
19 |
- * |
|
20 | 15 |
* ser is distributed in the hope that it will be useful, |
21 | 16 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
22 | 17 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
... | ... |
@@ -26,6 +21,7 @@ |
26 | 26 |
* along with this program; if not, write to the Free Software |
27 | 27 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
28 | 28 |
*/ |
29 |
+ |
|
29 | 30 |
/* History: |
30 | 31 |
* -------- |
31 | 32 |
* 2003-01-29 s/int/enum ... more convenient for gdb (jiri) |
... | ... |
@@ -37,6 +33,13 @@ |
37 | 37 |
* |
38 | 38 |
*/ |
39 | 39 |
|
40 |
+/*! |
|
41 |
+ * \file |
|
42 |
+ * \brief SIP-router core :: Data_lumps |
|
43 |
+ * \ingroup core |
|
44 |
+ * Module: \ref core |
|
45 |
+ */ |
|
46 |
+ |
|
40 | 47 |
|
41 | 48 |
#ifndef data_lump_h |
42 | 49 |
#define data_lump_h |
... | ... |
@@ -45,42 +48,42 @@ |
45 | 45 |
#include "parser/msg_parser.h" |
46 | 46 |
#include "parser/hf.h" |
47 | 47 |
|
48 |
-/* adds a header to the end */ |
|
48 |
+/*! \brief adds a header to the end */ |
|
49 | 49 |
struct lump* append_new_lump(struct lump** list, char* new_hdr, |
50 | 50 |
int len, enum _hdr_types_t type); |
51 |
-/* inserts a header to the beginning */ |
|
51 |
+/*! \brief inserts a header to the beginning */ |
|
52 | 52 |
struct lump* insert_new_lump(struct lump** list, char* new_hdr, |
53 | 53 |
int len, enum _hdr_types_t type); |
54 | 54 |
struct lump* insert_new_lump_after(struct lump* after, |
55 | 55 |
char* new_hdr, int len, enum _hdr_types_t type); |
56 | 56 |
struct lump* insert_new_lump_before(struct lump* before, char* new_hdr, |
57 | 57 |
int len,enum _hdr_types_t type); |
58 |
-/* substitutions (replace with ip address, port etc) */ |
|
58 |
+/*! \brief substitutions (replace with ip address, port etc) */ |
|
59 | 59 |
struct lump* insert_subst_lump_after(struct lump* after, enum lump_subst subst, |
60 | 60 |
enum _hdr_types_t type); |
61 | 61 |
struct lump* insert_subst_lump_before(struct lump* before,enum lump_subst subst, |
62 | 62 |
enum _hdr_types_t type); |
63 | 63 |
|
64 |
-/* conditional lumps */ |
|
64 |
+/*! \brief conditional lumps */ |
|
65 | 65 |
struct lump* insert_cond_lump_after(struct lump* after, enum lump_conditions c, |
66 | 66 |
enum _hdr_types_t type); |
67 | 67 |
struct lump* insert_cond_lump_before(struct lump* after, enum lump_conditions c, |
68 | 68 |
enum _hdr_types_t type); |
69 | 69 |
|
70 |
-/* removes an already existing header */ |
|
70 |
+/*! \brief removes an already existing header */ |
|
71 | 71 |
struct lump* del_lump(struct sip_msg* msg, int offset, int len, enum _hdr_types_t type); |
72 |
-/* set an anchor */ |
|
72 |
+/*! \brief set an anchor */ |
|
73 | 73 |
struct lump* anchor_lump(struct sip_msg* msg, int offset, int len, enum _hdr_types_t type); |
74 | 74 |
|
75 | 75 |
|
76 | 76 |
|
77 |
-/* duplicates a lump list shallowly in pkg-mem */ |
|
77 |
+/*! \brief duplicates a lump list shallowly in pkg-mem */ |
|
78 | 78 |
struct lump* dup_lump_list( struct lump *l ); |
79 |
-/* frees a shallowly duplicated lump list */ |
|
79 |
+/*! \brief frees a shallowly duplicated lump list */ |
|
80 | 80 |
void free_duped_lump_list(struct lump* l); |
81 | 81 |
|
82 | 82 |
|
83 |
-/* remove all non-SHMEM lumps from the list */ |
|
83 |
+/*! \brief remove all non-SHMEM lumps from the list */ |
|
84 | 84 |
void del_nonshm_lump( struct lump** lump_list ); |
85 | 85 |
|
86 | 86 |
#endif |
... | ... |
@@ -11,11 +11,6 @@ |
11 | 11 |
* the Free Software Foundation; either version 2 of the License, or |
12 | 12 |
* (at your option) any later version |
13 | 13 |
* |
14 |
- * For a license to use the ser software under conditions |
|
15 |
- * other than those described here, or to purchase support for this |
|
16 |
- * software, please contact iptel.org by e-mail at the following addresses: |
|
17 |
- * info@iptel.org |
|
18 |
- * |
|
19 | 14 |
* ser is distributed in the hope that it will be useful, |
20 | 15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
21 | 16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
... | ... |
@@ -36,6 +31,14 @@ |
36 | 36 |
* more easy (andrei) |
37 | 37 |
*/ |
38 | 38 |
|
39 |
+/*! |
|
40 |
+ * \file |
|
41 |
+ * \brief SIP-router core :: Data lumps |
|
42 |
+ * \ingroup core |
|
43 |
+ * Module: \ref core |
|
44 |
+ */ |
|
45 |
+ |
|
46 |
+ |
|
39 | 47 |
|
40 | 48 |
#ifndef data_lump_rpl_h |
41 | 49 |
#define data_lump_rpl_h |
... | ... |
@@ -59,7 +62,7 @@ struct lump_rpl |
59 | 59 |
struct lump_rpl** add_lump_rpl2(struct sip_msg *, char *, int , int ); |
60 | 60 |
|
61 | 61 |
|
62 |
-/* compatibility wrapper for the old add_lump_rpl version */ |
|
62 |
+/*! \brief compatibility wrapper for the old add_lump_rpl version */ |
|
63 | 63 |
inline static struct lump_rpl* add_lump_rpl(struct sip_msg* msg, |
64 | 64 |
char* s, int len , int flags ) |
65 | 65 |
{ |
... | ... |
@@ -12,11 +12,6 @@ |
12 | 12 |
* the Free Software Foundation; either version 2 of the License, or |
13 | 13 |
* (at your option) any later version |
14 | 14 |
* |
15 |
- * For a license to use the ser software under conditions |
|
16 |
- * other than those described here, or to purchase support for this |
|
17 |
- * software, please contact iptel.org by e-mail at the following addresses: |
|
18 |
- * info@iptel.org |
|
19 |
- * |
|
20 | 15 |
* ser is distributed in the hope that it will be useful, |
21 | 16 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
22 | 17 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
... | ... |
@@ -26,6 +21,7 @@ |
26 | 26 |
* along with this program; if not, write to the Free Software |
27 | 27 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
28 | 28 |
*/ |
29 |
+ |
|
29 | 30 |
/* History: |
30 | 31 |
* -------- |
31 | 32 |
* 2006-07-13 created by andrei |
... | ... |
@@ -33,6 +29,14 @@ |
33 | 33 |
* 2007-07-30 DNS cache measurements added (Gergo) |
34 | 34 |
*/ |
35 | 35 |
|
36 |
+/** |
|
37 |
+ * @file |
|
38 |
+ * @brief SIP-router core :: resolver/dns related functions, dns cache and failover |
|
39 |
+ * @ingroup core |
|
40 |
+ * Module: @ref core |
|
41 |
+ */ |
|
42 |
+ |
|
43 |
+ |
|
36 | 44 |
|
37 | 45 |
#ifndef __dns_cache_h |
38 | 46 |
#define __dns_cache_h |
... | ... |
@@ -58,69 +62,74 @@ |
58 | 58 |
#define DEFAULT_DNS_CACHE_MAX_TTL ((unsigned int)(-1)) /* (maxint) */ |
59 | 59 |
#define DEFAULT_DNS_MAX_MEM 500 /* 500 Kb */ |
60 | 60 |
|
61 |
-/* uncomment the define below for SRV weight based load balancing */ |
|
61 |
+/** @brief uncomment the define below for SRV weight based load balancing */ |
|
62 | 62 |
#define DNS_SRV_LB |
63 | 63 |
|
64 | 64 |
#define DNS_LU_LST |
65 | 65 |
|
66 |
-/* dns functions return them as negative values (e.g. return -E_DNS_NO_IP) |
|
66 |
+/** @brief dns functions return them as negative values (e.g. return -E_DNS_NO_IP) |
|
67 |
+ * |
|
67 | 68 |
* listed in the order of importance ( if more errors, only the most important |
68 | 69 |
* is returned) |
69 | 70 |
*/ |
70 | 71 |
enum dns_errors{ |
71 | 72 |
E_DNS_OK=0, |
72 |
- E_DNS_EOR, /* no more records (not an error) |
|
73 |
+ E_DNS_EOR, /**< no more records (not an error) |
|
73 | 74 |
-- returned only by the dns_resolve* |
74 | 75 |
functions when called iteratively,; it |
75 | 76 |
signals the end of the ip/records list */ |
76 |
- E_DNS_UNKNOWN /* unkown error */, |
|
77 |
- E_DNS_INTERNAL_ERR /* internal error */, |
|
77 |
+ E_DNS_UNKNOWN /**< unkown error */, |
|
78 |
+ E_DNS_INTERNAL_ERR /**< internal error */, |
|
78 | 79 |
E_DNS_BAD_SRV_ENTRY, |
79 |
- E_DNS_NO_SRV /* unresolvable srv record */, |
|
80 |
+ E_DNS_NO_SRV /**< unresolvable srv record */, |
|
80 | 81 |
E_DNS_BAD_IP_ENTRY, |
81 |
- E_DNS_NO_IP /* unresolvable a or aaaa records*/, |
|
82 |
- E_DNS_BAD_IP /* the ip is invalid */, |
|
83 |
- E_DNS_BLACKLIST_IP /* the ip is blacklisted */, |
|
84 |
- E_DNS_NAME_TOO_LONG /* try again with a shorter name */, |
|
85 |
- E_DNS_AF_MISMATCH /* ipv4 or ipv6 only requested, but |
|
82 |
+ E_DNS_NO_IP /**< unresolvable a or aaaa records*/, |
|
83 |
+ E_DNS_BAD_IP /**< the ip is invalid */, |
|
84 |
+ E_DNS_BLACKLIST_IP /**< the ip is blacklisted */, |
|
85 |
+ E_DNS_NAME_TOO_LONG /**< try again with a shorter name */, |
|
86 |
+ E_DNS_AF_MISMATCH /**< ipv4 or ipv6 only requested, but |
|
86 | 87 |
name contains an ip addr. of the |
87 | 88 |
opossite type */ , |
88 |
- E_DNS_NO_NAPTR /* unresolvable naptr record */, |
|
89 |
- E_DNS_CRITICAL /* critical error, marks the end |
|
89 |
+ E_DNS_NO_NAPTR /**< unresolvable naptr record */, |
|
90 |
+ E_DNS_CRITICAL /**< critical error, marks the end |
|
90 | 91 |
of the error table (always last) */ |
91 | 92 |
}; |
92 | 93 |
|
93 | 94 |
|
94 | 95 |
|
95 |
-/* return a short string, printable error description (err <=0) */ |
|
96 |
+/** @brief return a short string, printable error description (err <=0) */ |
|
96 | 97 |
const char* dns_strerror(int err); |
97 | 98 |
|
98 |
-/* dns entry error flags */ |
|
99 |
+/** @brief dns entry error flags */ |
|
99 | 100 |
#define DNS_BAD_NAME 1 /* unresolvable */ |
100 | 101 |
|
101 |
-/* dns requests flags */ |
|
102 |
+/** @name dns requests flags */ |
|
103 |
+/*@{ */ |
|
102 | 104 |
#define DNS_NO_FLAGS 0 |
103 | 105 |
#define DNS_IPV4_ONLY 1 |
104 | 106 |
#define DNS_IPV6_ONLY 2 |
105 | 107 |
#define DNS_IPV6_FIRST 4 |
106 |
-#define DNS_SRV_RR_LB 8 /* SRV RR weight based load balancing */ |
|
107 |
-#define DNS_TRY_NAPTR 16 /* enable naptr lookup */ |
|
108 |
+#define DNS_SRV_RR_LB 8 /**< SRV RR weight based load balancing */ |
|
109 |
+#define DNS_TRY_NAPTR 16 /**< enable naptr lookup */ |
|
110 |
+/*@} */ |
|
108 | 111 |
|
109 | 112 |
|
110 |
-/* ip blacklist error flags */ |
|
113 |
+/** @name ip blacklist error flags */ |
|
114 |
+/*@{ */ |
|
111 | 115 |
#define IP_ERR_BAD_DST 2 /* destination is marked as bad (e.g. bad ip) */ |
112 | 116 |
#define IP_ERR_SND 3 /* send error while using this as destination */ |
113 | 117 |
#define IP_ERR_TIMEOUT 4 /* timeout waiting for a response */ |
114 | 118 |
#define IP_ERR_TCP_CON 5 /* could not establish tcp connection */ |
119 |
+/*@} */ |
|
115 | 120 |
|
116 | 121 |
|
117 |
-/* stripped down dns rr */ |
|
122 |
+/** @brief stripped down dns rr |
|
123 |
+ @note name, type and class are not needed, contained in struct dns_query */ |
|
118 | 124 |
struct dns_rr{ |
119 | 125 |
struct dns_rr* next; |
120 |
- void* rdata; /* depends on the type */ |
|
121 |
- /* name, type and class are not needed, contained in struct dns_query */ |
|
122 |
- ticks_t expire; /* = ttl + crt_time */ |
|
123 |
- unsigned char err_flags; /* if 0 everything is ok */ |
|
126 |
+ void* rdata; /**< depends on the type */ |
|
127 |
+ ticks_t expire; /**< = ttl + crt_time */ |
|
128 |
+ unsigned char err_flags; /**< if 0 everything is ok */ |
|
124 | 129 |
|
125 | 130 |
}; |
126 | 131 |
|
... | ... |
@@ -163,15 +172,15 @@ typedef unsigned long long srv_flags_t; |
163 | 163 |
#endif |
164 | 164 |
|
165 | 165 |
struct dns_srv_handle{ |
166 |
- struct dns_hash_entry* srv; /* srv entry */ |
|
167 |
- struct dns_hash_entry* a; /* a or aaaa current entry */ |
|
166 |
+ struct dns_hash_entry* srv; /**< srv entry */ |
|
167 |
+ struct dns_hash_entry* a; /**< a or aaaa current entry */ |
|
168 | 168 |
#ifdef DNS_SRV_LB |
169 | 169 |
srv_flags_t srv_tried_rrs; |
170 | 170 |
#endif |
171 |
- unsigned short port; /* current port */ |
|
172 |
- unsigned char srv_no; /* current record no. in the srv entry */ |
|
173 |
- unsigned char ip_no; /* current record no. in the a/aaaa entry */ |
|
174 |
- unsigned char proto; /* protocol number */ |
|
171 |
+ unsigned short port; /**< current port */ |
|
172 |
+ unsigned char srv_no; /**< current record no. in the srv entry */ |
|
173 |
+ unsigned char ip_no; /**< current record no. in the a/aaaa entry */ |
|
174 |
+ unsigned char proto; /**< protocol number */ |
|
175 | 175 |
}; |
176 | 176 |
|
177 | 177 |
|
... | ... |
@@ -209,7 +218,7 @@ inline static void dns_srv_handle_put(struct dns_srv_handle* h) |
209 | 209 |
|
210 | 210 |
|
211 | 211 |
|
212 |
-/* use it when copying, it manually increases the ref cound */ |
|
212 |
+/** @brief use it when copying, it manually increases the ref cound */ |
|
213 | 213 |
inline static void dns_srv_handle_ref(struct dns_srv_handle *h) |
214 | 214 |
{ |
215 | 215 |
if (h){ |
... | ... |
@@ -222,7 +231,7 @@ inline static void dns_srv_handle_ref(struct dns_srv_handle *h) |
222 | 222 |
|
223 | 223 |
|
224 | 224 |
|
225 |
-/* safe copy increases the refcnt, src must not change while in this function |
|
225 |
+/** @brief safe copy increases the refcnt, src must not change while in this function |
|
226 | 226 |
* WARNING: the copy must be dns_srv_handle_put ! */ |
227 | 227 |
inline static void dns_srv_handle_cpy(struct dns_srv_handle* dst, |
228 | 228 |
struct dns_srv_handle* src) |
... | ... |
@@ -233,7 +242,7 @@ inline static void dns_srv_handle_cpy(struct dns_srv_handle* dst, |
233 | 233 |
|
234 | 234 |
|
235 | 235 |
|
236 |
-/* same as above but assume shm_lock held (for internal tm use only) */ |
|
236 |
+/** @brief same as above but assume shm_lock held (for internal tm use only) */ |
|
237 | 237 |
inline static void dns_srv_handle_put_shm_unsafe(struct dns_srv_handle* h) |
238 | 238 |
{ |
239 | 239 |
if (h){ |
... | ... |
@@ -250,7 +259,7 @@ inline static void dns_srv_handle_put_shm_unsafe(struct dns_srv_handle* h) |
250 | 250 |
|
251 | 251 |
|
252 | 252 |
|
253 |
-/* get "next" ip next time a dns_srv_handle function is called |
|
253 |
+/** @brief get "next" ip next time a dns_srv_handle function is called |
|
254 | 254 |
* params: h - struct dns_srv_handler |
255 | 255 |
* err - return code of the last dns_*_resolve* call |
256 | 256 |
* returns: 0 if it doesn't make sense to try another record, |
... | ... |
@@ -278,7 +287,7 @@ inline static void dns_srv_handle_init(struct dns_srv_handle* h) |
278 | 278 |
|
279 | 279 |
|
280 | 280 |
|
281 |
-/* performes a srv query on name |
|
281 |
+/** @brief performes a srv query on name |
|
282 | 282 |
* Params: name - srv query target (e.g. _sip._udp.foo.bar) |
283 | 283 |
* ip - result: first good ip found |
284 | 284 |
* port - result: corresponding port number |
... | ... |
@@ -288,7 +297,7 @@ inline static void dns_srv_handle_init(struct dns_srv_handle* h) |
288 | 288 |
int dns_srv_get_ip(str* name, struct ip_addr* ip, unsigned short* port, |
289 | 289 |
int flags); |
290 | 290 |
|
291 |
-/* performs an A, AAAA (or both) query/queries |
|
291 |
+/** @brief performs an A, AAAA (or both) query/queries |
|
292 | 292 |
* Params: name - query target (e.g. foo.bar) |
293 | 293 |
* ip - result: first good ip found |
294 | 294 |
* flags - resolve options (like ipv4 only, ipv6 prefered a.s.o) |
... | ... |
@@ -300,7 +309,7 @@ struct hostent* dns_srv_get_he(str* name, unsigned short* port, int flags); |
300 | 300 |
struct hostent* dns_get_he(str* name, int flags); |
301 | 301 |
|
302 | 302 |
|
303 |
-/* resolve name to an ip, using srv record. Can be called multiple times |
|
303 |
+/** @brief resolve name to an ip, using srv record. Can be called multiple times |
|
304 | 304 |
* to iterate on all the possible ips, e.g : |
305 | 305 |
* dns_srv_handle_init(h); |
306 | 306 |
* ret_code=dns_sip_resolve(h,...); |
... | ... |
@@ -312,7 +321,7 @@ struct hostent* dns_get_he(str* name, int flags); |
312 | 312 |
int dns_sip_resolve(struct dns_srv_handle* h, str* name, struct ip_addr* ip, |
313 | 313 |
unsigned short* port, char* proto, int flags); |
314 | 314 |
|
315 |
-/* same as above, but fills su intead of changing port and filling an ip */ |
|
315 |
+/** @brief same as above, but fills su intead of changing port and filling an ip */ |
|
316 | 316 |
inline static int dns_sip_resolve2su(struct dns_srv_handle* h, |
317 | 317 |
union sockaddr_union* su, |
318 | 318 |
str* name, unsigned short port, |
... | ... |
@@ -327,17 +336,17 @@ inline static int dns_sip_resolve2su(struct dns_srv_handle* h, |
327 | 327 |
return ret; |
328 | 328 |
} |
329 | 329 |
|
330 |
-/* deletes all the entries from the cache */ |
|
330 |
+/** @brief deletes all the entries from the cache */ |
|
331 | 331 |
void dns_cache_flush(void); |
332 | 332 |
|
333 | 333 |
#ifdef DNS_WATCHDOG_SUPPORT |
334 |
-/* sets the state of the DNS servers: |
|
334 |
+/** @brief sets the state of the DNS servers: |
|
335 | 335 |
* 1: at least one server is up |
336 | 336 |
* 0: all the servers are down |
337 | 337 |
*/ |
338 | 338 |
void dns_set_server_state(int state); |
339 | 339 |
|
340 |
-/* returns the state of the DNS servers */ |
|
340 |
+/** @brief returns the state of the DNS servers */ |
|
341 | 341 |
int dns_get_server_state(void); |
342 | 342 |
#endif /* DNS_WATCHDOG_SUPPORT */ |
343 | 343 |
|
... | ... |
@@ -27,8 +27,6 @@ |
27 | 27 |
* Module: \ref utils |
28 | 28 |
*/ |
29 | 29 |
|
30 |
- |
|
31 |
- |
|
32 | 30 |
#include "conf.h" |
33 | 31 |
#include "../../mem/mem.h" |
34 | 32 |
#include "../../mem/shm_mem.h" |
... | ... |
@@ -41,11 +39,9 @@ |
41 | 41 |
#include <stdlib.h> |
42 | 42 |
#include <stdio.h> |
43 | 43 |
|
44 |
- |
|
45 | 44 |
#define BUFSIZE 1000 |
46 | 45 |
|
47 |
- |
|
48 |
-/* special filter indices */ |
|
46 |
+/*! \brief special filter indices */ |
|
49 | 47 |
enum { |
50 | 48 |
sfidx_request = 0, |
51 | 49 |
sfidx_reply, |
... | ... |
@@ -300,7 +296,9 @@ static int update_proxy(int id, char *host_str, char *port_str) |
300 | 300 |
* Parses a configuration string for switch settings and updates |
301 | 301 |
* the configuration structure. |
302 | 302 |
* \param settings the configuration string in the following form: |
303 |
+\verbatim |
|
303 | 304 |
* <id>=<switch>[,<id>=<switch>]... |
305 |
+\endverbatim |
|
304 | 306 |
* \return 1 on success, -1 otherwise |
305 | 307 |
*/ |
306 | 308 |
int conf_parse_switch(char *settings) |
... | ... |
@@ -400,7 +398,9 @@ error: |
400 | 400 |
* Parses a configuration string for switch settings and |
401 | 401 |
* updates the configuration structure. |
402 | 402 |
* \param settings The configuration string in the following form: |
403 |
+\verbatim |
|
403 | 404 |
* <id>=<filter>[:<filter>]...[,<id>=<filter>[:<filter>]...]... |
405 |
+\endverbatim |
|
404 | 406 |
* \return 1 on success, -1 otherwise |
405 | 407 |
*/ |
406 | 408 |
int conf_parse_filter(char *settings) |
... | ... |
@@ -443,7 +443,9 @@ int conf_parse_filter(char *settings) |
443 | 443 |
* Parses a configuration string for proxy settings and |
444 | 444 |
* updates the configuration structure. |
445 | 445 |
* \param settings: The configuration string in the following form: |
446 |
+\verbatim |
|
446 | 447 |
* <id>=<host>:<port>[,<id>=<host>:<port>]... |
448 |
+\endverbatim |
|
447 | 449 |
* \return: 1 on success, -1 otherwise |
448 | 450 |
*/ |
449 | 451 |
int conf_parse_proxy(char *settings) |
... | ... |
@@ -79,6 +79,7 @@ struct sip_uri *select_uri_p = NULL; |
79 | 79 |
* moves pointer p to the first unused char. |
80 | 80 |
* |
81 | 81 |
* The select identifier must be of the form: |
82 |
+\verbatim |
|
82 | 83 |
* [@] <sel_id> [ '.' <sel_id> ...] |
83 | 84 |
* |
84 | 85 |
* Where |
... | ... |
@@ -96,6 +97,7 @@ struct sip_uri *select_uri_p = NULL; |
96 | 96 |
* @eval.pop[-1] |
97 | 97 |
* contact.uri.params.maddr |
98 | 98 |
* cfg_get.rtp_proxy.enabled |
99 |
+\endverbatim |
|
99 | 100 |
* |
100 | 101 |
* @return -1 error |
101 | 102 |
* p points to the first unconsumed char |
... | ... |
@@ -186,6 +188,7 @@ error: |
186 | 186 |
* Parse select string into select structure s and |
187 | 187 |
* moves pointer p to the first unused char. |
188 | 188 |
* |
189 |
+\verbatim |
|
189 | 190 |
* The select identifier must be of the form: |
190 | 191 |
* [@] <sel_id> [ '.' <sel_id> ...] |
191 | 192 |
* |
... | ... |
@@ -204,6 +207,7 @@ error: |
204 | 204 |
* @eval.pop[-1] |
205 | 205 |
* contact.uri.params.maddr |
206 | 206 |
* cfg_get.rtp_proxy.enabled |
207 |
+\endverbatim |
|
207 | 208 |
* |
208 | 209 |
* @param p - double string (asciiz) pointer, *p is moved to the first char |
209 | 210 |
* after the select identifier |