Browse code

core: fix all reported doxygen errors in PV and value evaluation code

Henning Westerholt authored on 28/07/2011 21:58:00
Showing 4 changed files
... ...
@@ -1,6 +1,4 @@
1 1
 /* 
2
- * $Id$
3
- * 
4 2
  * Copyright (C) 2008 iptelorg GmbH
5 3
  *
6 4
  * Permission to use, copy, modify, and distribute this software for any
... ...
@@ -15,10 +13,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
 /**
19 20
  * @file 
20
- * @brief lvalues (assignment)
21
+ * @brief SIP-router core :: lvalues (assignment)
22
+ * \ingroup core
23
+ * Module: \ref core
21 24
  */
25
+
22 26
 /* 
23 27
  * History:
24 28
  * --------
... ...
@@ -29,12 +31,6 @@
29 29
  *              delete the lvalue (similar to perl)  (andrei)
30 30
  */
31 31
 
32
-/*!
33
- * \file
34
- * \brief SIP-router core :: 
35
- * \ingroup core
36
- * Module: \ref core
37
- */
38 32
 
39 33
 #include "lvalue.h"
40 34
 #include "dprint.h"
... ...
@@ -42,15 +38,15 @@
42 42
 
43 43
 
44 44
 
45
-/** eval rve and assign the result to an avp
46
- * lv->lv.avp=eval(rve)
47
- *
48
- * based on do_action() ASSIGN_T
49
- *
45
+/**
46
+ * @brief eval rve and assign the result to an avp
47
+ * 
48
+ * eval rve and assign the result to an avp, lv->lv.avp=eval(rve)
49
+ * based on do_action() ASSIGN_T.
50 50
  * @param h  - script context
51 51
  * @param msg - sip msg
52 52
  * @param lv - lvalue
53
- * @param rve - rvalue expression
53
+ * @param rv - rvalue expression
54 54
  * @return >= 0 on success (expr. bool value), -1 on error
55 55
  */
56 56
 inline static int lval_avp_assign(struct run_act_ctx* h, struct sip_msg* msg,
... ...
@@ -232,15 +228,15 @@ drop:
232 232
 
233 233
 
234 234
 
235
-/** eval rve and assign the result to a pvar
236
- * lv->lv.pvar=eval(rve)
237
- *
238
- * based on do_action() ASSIGN_T
235
+/**
236
+ * @brief eval rve and assign the result to a pvar
239 237
  *
238
+ * eval rve and assign the result to a pvar, lv->lv.pvar=eval(rve)
239
+ * based on do_action() ASSIGN_T.
240 240
  * @param h  - script context
241 241
  * @param msg - sip msg
242 242
  * @param lv - lvalue
243
- * @param rve - rvalue expression
243
+ * @param rv - rvalue expression
244 244
  * @return >= 0 on success (expr. bool value), -1 on error
245 245
  */
246 246
 inline static int lval_pvar_assign(struct run_act_ctx* h, struct sip_msg* msg,
... ...
@@ -1,6 +1,4 @@
1 1
 /*
2
- * $Id$
3
- *
4 2
  * Copyright (C) 2001-2003 FhG Fokus
5 3
  *
6 4
  * This file is part of SIP-Router, a free SIP server.
... ...
@@ -22,7 +20,7 @@
22 22
 
23 23
 /*!
24 24
  * \file
25
- * \brief SIP-router core ::  PV API specification
25
+ * \brief SIP-router core :: PV API specification
26 26
  * \ingroup core
27 27
  * Module: \ref core
28 28
  */
... ...
@@ -44,8 +42,8 @@
44 44
 
45 45
 #define is_in_str(p, in) (p<in->s+in->len && *p)
46 46
 
47
-#define PV_TABLE_SIZE	16
48
-#define TR_TABLE_SIZE	4
47
+#define PV_TABLE_SIZE	16 /*!< pseudo-variable table size */
48
+#define TR_TABLE_SIZE	4  /*!< PV transformation size */
49 49
 
50 50
 
51 51
 void tr_destroy(trans_t *t);
... ...
@@ -72,7 +70,9 @@ void pv_init_table(void)
72 72
 }
73 73
 
74 74
 /**
75
- *
75
+ * @brief Check if a char is valid according to the PV syntax
76
+ * @param c checked char
77
+ * @return 1 if char is valid, 0 if not valid
76 78
  */
77 79
 static int is_pv_valid_char(char c)
78 80
 {
... ...
@@ -1335,11 +1335,10 @@ void tr_destroy(trans_t *t)
1335 1335
 /*!
1336 1336
  * \brief Exec transformation on a pseudo-variable value
1337 1337
  * \param msg SIP message
1338
- * \param tr one or more transformations
1339
- * \param val pseudo-variable value
1338
+ * \param t one or more transformations
1339
+ * \param v pseudo-variable value
1340 1340
  * \return 0 on success, -1 on error
1341 1341
  */
1342
-
1343 1342
 int tr_exec(struct sip_msg *msg, trans_t *t, pv_value_t *v)
1344 1343
 {
1345 1344
 	int r;
... ...
@@ -1,6 +1,4 @@
1 1
 /* 
2
- * $Id$
3
- * 
4 2
  * Copyright (C) 2008 iptelorg GmbH
5 3
  *
6 4
  * Permission to use, copy, modify, and distribute this software for any
... ...
@@ -15,10 +13,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
 /**
19 20
  * @file 
20
- * @brief rvalue expressions
21
+ * @brief SIP-router core :: rvalue expressions
22
+ * @ingroup core
23
+ * Module: \ref core
21 24
  */
25
+
22 26
 /* 
23 27
  * History:
24 28
  * --------
... ...
@@ -58,12 +60,6 @@
58 58
  *                           Depends on RV_STR2INT_ERR.
59 59
  */
60 60
 
61
-/*!
62
- * \file
63
- * \brief SIP-router core :: 
64
- * \ingroup core
65
- * Module: \ref core
66
- */
67 61
 
68 62
 #include "rvalue.h"
69 63
 
... ...
@@ -344,14 +340,14 @@ char* rval_type_name(enum rval_type type)
344 344
 
345 345
 
346 346
 
347
-/** create a new pk_malloc'ed rvalue from a rval_val union.
348
-  *
349
-  * @param s - pointer to str, must be non-null
350
-  * @param extra_size - extra space to allocate
351
-  *                    (so that future string operation can reuse
352
-  *                     the space)
353
-  * @return new rv or 0 on error
354
-  */
347
+/**
348
+ * @brief create a new pk_malloc'ed rvalue from a rval_val union
349
+ * @param t rvalue type
350
+ * @param v rvalue value
351
+ * @param extra_size extra space to allocate
352
+ * (so that future string operation can reuse the space)
353
+ * @return new rv or 0 on error
354
+ */
355 355
 struct rvalue* rval_new(enum rval_type t, union rval_val* v, int extra_size)
356 356
 {
357 357
 	struct rvalue* rv;
... ...
@@ -375,18 +371,21 @@ struct rvalue* rval_new(enum rval_type t, union rval_val* v, int extra_size)
375 375
 
376 376
 
377 377
 
378
-/** get rvalue basic type (RV_INT or RV_STR).
379
-  *
380
-  * Given a rvalue it tries to determinte its basic type.
381
-  * Fills val_cache if non-null and empty (can be used in other rval*
382
-  * function calls, to avoid re-resolving avps or pvars). It must be
383
-  * rval_cache_clean()'en when no longer needed.
384
-  *
385
-  * @param rv - target rvalue
386
-  * @param val_cache - write-only: value cache, might be filled if non-null,
387
-  *                    it _must_ be rval_cache_clean()'en when done.
388
-  * @return - basic type or RV_NONE on error
389
-  */
378
+/**
379
+ * @brief get rvalue basic type (RV_INT or RV_STR)
380
+ *
381
+ * Given a rvalue it tries to determinte its basic type.
382
+ * Fills val_cache if non-null and empty (can be used in other rval*
383
+ * function calls, to avoid re-resolving avps or pvars). It must be
384
+ * rval_cache_clean()'en when no longer needed.
385
+ *
386
+ * @param h run action context
387
+ * @param msg SIP message
388
+ * @param rv target rvalue
389
+ * @param val_cache write-only value cache, might be filled if non-null,
390
+ * it _must_ be rval_cache_clean()'en when done.
391
+ * @return basic type or RV_NONE on error
392
+ */
390 393
 inline static enum rval_type rval_get_btype(struct run_act_ctx* h,
391 394
 											struct sip_msg* msg,
392 395
 											struct rvalue* rv,
... ...
@@ -675,18 +674,19 @@ static int rve_op_unary(enum rval_expr_op op)
675 675
 
676 676
 
677 677
 
678
-/** returns 1 if expression is valid (type-wise).
679
-  * @param type - filled with the type of the expression (RV_INT, RV_STR or
680
-  *                RV_NONE if it's dynamic)
681
-  * @param rve  - checked expression
682
-  * @param bad_rve - set on failure to the subexpression for which the 
683
-  *                    type check failed
684
-  * @param bad_type - set on failure to the type of the bad subexpression
685
-  * @param exp_type - set on failure to the expected type for the bad
686
-  *                   subexpression
687
-  * @return 0 or 1  and sets *type to the resulting type
688
-  * (RV_INT, RV_STR or RV_NONE if it can be found only at runtime)
689
-  */
678
+/**
679
+ * @brief Returns 1 if expression is valid (type-wise)
680
+ * @param type filled with the type of the expression (RV_INT, RV_STR or
681
+ *                RV_NONE if it's dynamic)
682
+ * @param rve  checked expression
683
+ * @param bad_rve set on failure to the subexpression for which the 
684
+ * type check failed
685
+ * @param bad_t set on failure to the type of the bad subexpression
686
+ * @param exp_t set on failure to the expected type for the bad
687
+ * subexpression
688
+ * @return 0 or 1 and sets *type to the resulting type
689
+ * (RV_INT, RV_STR or RV_NONE if it can be found only at runtime)
690
+ */
690 691
 int rve_check_type(enum rval_type* type, struct rval_expr* rve,
691 692
 					struct rval_expr** bad_rve, 
692 693
 					enum rval_type* bad_t,
... ...
@@ -1274,18 +1274,22 @@ error:
1274 1274
 
1275 1275
 
1276 1276
 
1277
-/** convert a rvalue to another rvalue, of a specific type.
1277
+/**
1278
+ * @brief Convert a rvalue to another rvalue, of a specific type
1278 1279
  *
1280
+ * Convert a rvalue to another rvalue, of a specific type.
1279 1281
  * The result is read-only in most cases (can be a reference
1280 1282
  * to another rvalue, can be checked by using rv_chg_in_place()) and
1281 1283
  * _must_ be rval_destroy()'ed.
1282 1284
  *
1285
+ * @param h run action context
1286
+ * @param msg SIP mesasge
1283 1287
  * @param type - type to convert to
1284 1288
  * @param v - rvalue to convert
1285 1289
  * @param c - rval_cache (cached v value if known/filled by another
1286 1290
  *            function), can be 0 (unknown/not needed)
1287 1291
  * @return pointer to a rvalue (reference to an existing one or a new
1288
- *   one, @see rv_chg_in_place() and the above comment) or 0 on error.
1292
+ * one, @see rv_chg_in_place() and the above comment), or 0 on error.
1289 1293
  */
1290 1294
 struct rvalue* rval_convert(struct run_act_ctx* h, struct sip_msg* msg,
1291 1295
 							enum rval_type type, struct rvalue* v,
... ...
@@ -1761,9 +1765,17 @@ error:
1761 1761
 
1762 1762
 
1763 1763
 
1764
-/** integer operation on rval evaluated as string.
1765
- * Can use cached rvalues (c1 & c2).
1766
- * @param res - will be set to the result
1764
+/**
1765
+ * @brief Integer operation on rval evaluated as string
1766
+ * 
1767
+ * Integer operation on rval evaluated as string, can use cached
1768
+ * rvalues (c1 & c2).
1769
+ * @param h run action context
1770
+ * @param msg SIP message
1771
+ * @param res will be set to the result
1772
+ * @param op rvalue expression operation
1773
+ * @param l rvalue
1774
+ * @param c1 rvalue cache
1767 1775
  * @return 0 success, -1 on error
1768 1776
  */
1769 1777
 inline static int rval_int_strop1(struct run_act_ctx* h,
... ...
@@ -1791,14 +1803,18 @@ error:
1791 1791
 
1792 1792
 
1793 1793
 
1794
-/** checks if rv is defined.
1795
- * @param res - set to the result 1 - defined, 0 not defined
1794
+/**
1795
+ * @brief Checks if rv is defined
1796
+ * @param h run action context
1797
+ * @param msg SIP message
1798
+ * @param res set to the result 1 is defined, 0 not defined
1799
+ * @param rv rvalue
1800
+ * @param cache rvalue cache
1796 1801
  * @return 0 on success, -1 on error
1797
- * Can use cached rvalues (cache).
1798
- * Note: a rv can be undefined if it's an undefined avp or pvar or select or
1799
- * if it's NONE
1800
- * Note2: an error in the avp, pvar or select search is equivalent to 
1801
- *  undefined (and it's not reported)
1802
+ * @note Can use cached rvalues (cache). A rv can be undefined if it's
1803
+ * an undefined avp or pvar or select or if it's NONE
1804
+ * @note An error in the avp, pvar or select search is equivalent to
1805
+ * undefined (and it's not reported)
1802 1806
  */
1803 1807
 inline static int rv_defined(struct run_act_ctx* h,
1804 1808
 						 struct sip_msg* msg, int* res,
... ...
@@ -1857,9 +1873,13 @@ inline static int rv_defined(struct run_act_ctx* h,
1857 1857
 }
1858 1858
 
1859 1859
 
1860
-/** defined (integer) operation on rve.
1860
+/**
1861
+ * @brief Defined (integer) operation on rve
1862
+ * @param h run action context
1863
+ * @param msg SIP message
1861 1864
  * @param res - set to  1 defined, 0 not defined
1862
- * @return - 0 on success, -1 on error
1865
+ * @param rve rvalue expression
1866
+ * @return 0 on success, -1 on error
1863 1867
  */
1864 1868
 inline static int int_rve_defined(struct run_act_ctx* h,
1865 1869
 						 struct sip_msg* msg, int* res,
... ...
@@ -2129,22 +2149,22 @@ int rval_expr_eval_int( struct run_act_ctx* h, struct sip_msg* msg,
2129 2129
 
2130 2130
 
2131 2131
 
2132
-/** evals a rval expr. into an int or another rv(str).
2133
- * WARNING: rv result (rv_res) must be rval_destroy()'ed if non-null
2132
+/**
2133
+ * @brief Evals a rval expression into an int or another rv(str)
2134
+ * @warning rv result (rv_res) must be rval_destroy()'ed if non-null
2134 2135
  * (it might be a reference to another rval). The result can be
2135 2136
  * modified only if rv_chg_in_place() returns true.
2136
- * @param res_rv - pointer to rvalue result, if non-null it means the 
2137
- *                 expression evaluated to a non-int (str), which will be
2138
- *                 stored here.
2139
- * @param res_i  - pointer to int result, if res_rv==0 and the function
2140
- *                 returns success => the result is an int which will be 
2141
- *                 stored here.
2142
- * @param rve    - expression that will be evaluated.
2143
- * @param cache  - write-only value cache, it might be filled if non-null and
2144
- *                 empty (rval_cache_init()). If non-null, it _must_ be 
2145
- *                 rval_cache_clean()'ed when done. 
2146
- *
2147
- * @result  0 on success, -1 on error,  sets *res_rv or *res_i.
2137
+ * @param h run action context
2138
+ * @param msg SIP message
2139
+ * @param res_rv pointer to rvalue result, if non-null it means the 
2140
+ * expression evaluated to a non-int (str), which will be stored here.
2141
+ * @param res_i pointer to int result, if res_rv==0 and the function
2142
+ * returns success => the result is an int which will be stored here.
2143
+ * @param rve expression that will be evaluated.
2144
+ * @param cache write-only value cache, it might be filled if non-null and
2145
+ * empty (rval_cache_init()). If non-null, it _must_ be rval_cache_clean()'ed
2146
+ * when done. 
2147
+ * @return 0 on success, -1 on error, sets *res_rv or *res_i.
2148 2148
  */
2149 2149
 int rval_expr_eval_rvint(			   struct run_act_ctx* h,
2150 2150
 									   struct sip_msg* msg,
... ...
@@ -2281,10 +2301,14 @@ error:
2281 2281
 
2282 2282
 
2283 2283
 
2284
-/** evals a rval expr..
2285
- * WARNING: result must be rval_destroy()'ed if non-null (it might be
2284
+/**
2285
+ * @brief Evals a rval expression
2286
+ * @warning result must be rval_destroy()'ed if non-null (it might be
2286 2287
  * a reference to another rval). The result can be modified only
2287 2288
  * if rv_chg_in_place() returns true.
2289
+ * @param h run action context
2290
+ * @param msg SIP message
2291
+ * @param rve rvalue expression
2288 2292
  * @return rvalue on success, 0 on error
2289 2293
  */
2290 2294
 struct rvalue* rval_expr_eval(struct run_act_ctx* h, struct sip_msg* msg,
... ...
@@ -2556,10 +2580,12 @@ struct rval_expr* mk_rval_expr_v(enum rval_type rv_type, void* val,
2556 2556
 
2557 2557
 
2558 2558
 
2559
-/** create a unary op. rval_expr..
2559
+/**
2560
+ * @brief Create a unary op. rval_expr
2560 2561
  * ret= op rve1
2561 2562
  * @param op   - rval expr. unary operator
2562 2563
  * @param rve1 - rval expr. on which the operator will act.
2564
+ * @param pos configuration position
2563 2565
  * @return new pkg_malloc'ed rval_expr or 0 on error.
2564 2566
  */
2565 2567
 struct rval_expr* mk_rval_expr1(enum rval_expr_op op, struct rval_expr* rve1,
... ...
@@ -2594,11 +2620,13 @@ struct rval_expr* mk_rval_expr1(enum rval_expr_op op, struct rval_expr* rve1,
2594 2594
 
2595 2595
 
2596 2596
 
2597
-/** create a rval_expr. from 2 other rval exprs, using op.
2597
+/**
2598
+ * @brief Create a rval_expr. from 2 other rval exprs, using op
2598 2599
  * ret = rve1 op rve2
2599 2600
  * @param op   - rval expr. operator
2600 2601
  * @param rve1 - rval expr. on which the operator will act.
2601 2602
  * @param rve2 - rval expr. on which the operator will act.
2603
+ * @param pos configuration position
2602 2604
  * @return new pkg_malloc'ed rval_expr or 0 on error.
2603 2605
  */
2604 2606
 struct rval_expr* mk_rval_expr2(enum rval_expr_op op, struct rval_expr* rve1,
... ...
@@ -2862,15 +2890,17 @@ static int fix_rval(struct rvalue* rv)
2862 2862
 
2863 2863
 
2864 2864
 
2865
-/** helper function: replace a rve (in-place) with a constant rval_val.
2866
- * WARNING: since it replaces in-place, one should make sure that if
2865
+/**
2866
+ * @brief Helper function: replace a rve (in-place) with a constant rval_val
2867
+ * @warning since it replaces in-place, one should make sure that if
2867 2868
  * rve is in fact a rval (rve->op==RVE_RVAL_OP), no reference is kept
2868 2869
  * to the rval!
2869
- * @param rve - expression to be replaced (in-place)
2870
- * @param v   - pointer to a rval_val union containing the replacement
2871
- *              value.
2872
- * @param flags - value flags (how it was alloc'ed, e.g.: RV_CNT_ALLOCED_F)
2873
- * @return 0 on success, -1 on error */
2870
+ * @param rve expression to be replaced (in-place)
2871
+ * @param type rvalue type
2872
+ * @param v pointer to a rval_val union containing the replacement value.
2873
+ * @param flags value flags (how it was alloc'ed, e.g.: RV_CNT_ALLOCED_F)
2874
+ * @return 0 on success, -1 on error
2875
+ */
2874 2876
 static int rve_replace_with_val(struct rval_expr* rve, enum rval_type type,
2875 2877
 								union rval_val* v, int flags)
2876 2878
 {
... ...
@@ -16,7 +16,9 @@
16 16
  
17 17
 /**
18 18
  * @file 
19
- * @brief rvalue expressions
19
+ * @brief SIP-router core :: rvalue expressions
20
+ * @ingroup core
21
+ * Module: \ref core
20 22
  */
21 23
  
22 24
 /* 
... ...
@@ -48,45 +50,45 @@ enum rval_type{
48 48
 };
49 49
 
50 50
 enum rval_expr_op{
51
-	RVE_NONE_OP,  /* uninit / empty */
52
-	RVE_RVAL_OP,  /* special op, means that the expr. is in fact a rval */
53
-	RVE_UMINUS_OP, /* one member expression, returns -(val) */
54
-	RVE_BOOL_OP,  /* one member evaluate as bool. : (val!=0)*/
55
-	RVE_LNOT_OP,  /* one member evaluate as bool. : (!val)*/
56
-	RVE_BNOT_OP,  /* one member evaluate as binary : (~ val)*/
57
-	RVE_MUL_OP,   /* 2 members, returns left * right */
58
-	RVE_DIV_OP,   /* 2 members, returns left / right */
59
-	RVE_MOD_OP,   /* 2 members, returns left % right */
60
-	RVE_MINUS_OP, /* 2 members, returns left - right */
61
-	RVE_BAND_OP,  /* 2 members, returns left | right */
62
-	RVE_BOR_OP,   /* 2 members, returns left & right */
63
-	RVE_BXOR_OP,   /* 2 members, returns left XOR right */
64
-	RVE_BLSHIFT_OP,   /* 2 members, returns left << right */
65
-	RVE_BRSHIFT_OP,   /* 2 members, returns left >> right */
66
-	RVE_LAND_OP,  /* 2 members, returns left && right */
67
-	RVE_LOR_OP,   /* 2 members, returns left || right */
68
-	RVE_GT_OP,    /*  2 members, returns left > right */
69
-	RVE_GTE_OP,   /*  2 members, returns left >= right */
70
-	RVE_LT_OP,    /*  2 members, returns left  < right */
71
-	RVE_LTE_OP,   /*  2 members, returns left <= right */
72
-	RVE_IEQ_OP, /*  2 members, int == version, returns left == right */
73
-	RVE_IDIFF_OP,/* 2 members, int != version, returns left != right */
74
-	RVE_IPLUS_OP, /* 2 members, integer +, returns int(a)+int(b) */
51
+	RVE_NONE_OP,  /**< uninit / empty */
52
+	RVE_RVAL_OP,  /**< special op, means that the expr. is in fact a rval */
53
+	RVE_UMINUS_OP, /**< one member expression, returns -(val) */
54
+	RVE_BOOL_OP,  /**< one member evaluate as bool. : (val!=0)*/
55
+	RVE_LNOT_OP,  /**< one member evaluate as bool. : (!val)*/
56
+	RVE_BNOT_OP,  /**< one member evaluate as binary : (~ val)*/
57
+	RVE_MUL_OP,   /**< 2 members, returns left * right */
58
+	RVE_DIV_OP,   /**< 2 members, returns left / right */
59
+	RVE_MOD_OP,   /**< 2 members, returns left % right */
60
+	RVE_MINUS_OP, /**< 2 members, returns left - right */
61
+	RVE_BAND_OP,  /**< 2 members, returns left | right */
62
+	RVE_BOR_OP,   /**< 2 members, returns left & right */
63
+	RVE_BXOR_OP,   /**< 2 members, returns left XOR right */
64
+	RVE_BLSHIFT_OP, /**< 2 members, returns left << right */
65
+	RVE_BRSHIFT_OP, /**< 2 members, returns left >> right */
66
+	RVE_LAND_OP,  /**< 2 members, returns left && right */
67
+	RVE_LOR_OP,   /**< 2 members, returns left || right */
68
+	RVE_GT_OP,    /**<  2 members, returns left > right */
69
+	RVE_GTE_OP,   /**<  2 members, returns left >= right */
70
+	RVE_LT_OP,    /**<  2 members, returns left  < right */
71
+	RVE_LTE_OP,   /**<  2 members, returns left <= right */
72
+	RVE_IEQ_OP,   /**<  2 members, int == version, returns left == right */
73
+	RVE_IDIFF_OP, /**< 2 members, int != version, returns left != right */
74
+	RVE_IPLUS_OP, /**< 2 members, integer +, returns int(a)+int(b) */
75 75
 	/* common int & str */
76
-	RVE_PLUS_OP,  /* generic plus (int or str) returns left + right */
77
-	RVE_EQ_OP,    /*  2 members, returns left == right  (int)*/
78
-	RVE_DIFF_OP,  /*  2 members, returns left != right  (int)*/
76
+	RVE_PLUS_OP,  /**< generic plus (int or str) returns left + right */
77
+	RVE_EQ_OP,    /**<  2 members, returns left == right  (int)*/
78
+	RVE_DIFF_OP,  /**<  2 members, returns left != right  (int)*/
79 79
 	/* str only */
80
-	RVE_CONCAT_OP,/* 2 members, string concat, returns left . right (str)*/
81
-	RVE_STRLEN_OP, /* one member, string length:, returns strlen(val) (int)*/
82
-	RVE_STREMPTY_OP, /* one member, returns val=="" (bool) */
83
-	RVE_STREQ_OP,  /* 2 members, string == , returns left == right (bool)*/
84
-	RVE_STRDIFF_OP,/* 2 members, string != , returns left != right (bool)*/
85
-	RVE_MATCH_OP,  /* 2 members, string ~),  returns left matches re(right) */
80
+	RVE_CONCAT_OP, /**< 2 members, string concat, returns left . right (str)*/
81
+	RVE_STRLEN_OP, /**< one member, string length:, returns strlen(val) (int)*/
82
+	RVE_STREMPTY_OP, /**< one member, returns val=="" (bool) */
83
+	RVE_STREQ_OP,  /**< 2 members, string == , returns left == right (bool)*/
84
+	RVE_STRDIFF_OP,/**< 2 members, string != , returns left != right (bool)*/
85
+	RVE_MATCH_OP,  /**< 2 members, string ~),  returns left matches re(right) */
86 86
 	/* avp, pvars a.s.o */
87
-	RVE_DEFINED_OP, /* one member, returns is_defined(val) (bool) */
88
-	RVE_INT_OP,   /* one member, returns (int)val  (int) */
89
-	RVE_STR_OP    /* one member, returns (str)val  (str) */
87
+	RVE_DEFINED_OP, /**< one member, returns is_defined(val) (bool) */
88
+	RVE_INT_OP,   /**< one member, returns (int)val  (int) */
89
+	RVE_STR_OP    /**< one member, returns (str)val  (str) */
90 90
 };
91 91
 
92 92
 
... ...
@@ -119,12 +121,11 @@ struct rvalue{
119 119
 
120 120
 
121 121
 /* rvalue flags */
122
-#define RV_CNT_ALLOCED_F  1  /* free contents  (pkg mem allocated) */
123
-#define RV_RV_ALLOCED_F   2  /* free rv itself (pkg_free(rv)) */
122
+#define RV_CNT_ALLOCED_F  1  /**< free contents  (pkg mem allocated) */
123
+#define RV_RV_ALLOCED_F   2  /**< free rv itself (pkg_free(rv)) */
124 124
 #define RV_ALL_ALLOCED_F  (RV_CNT_ALLOCED|RV_RV_ALLOCED)
125
-#define RV_RE_F  4 /* string is a RE with a valid v->re member */
126
-#define RV_RE_ALLOCED_F 8 /* v->re.regex must be freed */
127
-
125
+#define RV_RE_F  4 /**< string is a RE with a valid v->re member */
126
+#define RV_RE_ALLOCED_F 8 /**< v->re.regex must be freed */
128 127
 
129 128
 struct rval_expr{
130 129
 	enum rval_expr_op op;
... ...
@@ -167,6 +168,15 @@ struct rval_cache{
167 167
 /** allocates a new rval (should be freed by rval_destroy()). */
168 168
 struct rvalue* rval_new_empty(int extra_size);
169 169
 struct rvalue* rval_new_str(str* s, int extra_size);
170
+
171
+/**
172
+ * @brief create a new pk_malloc'ed rvalue from a rval_val union
173
+ * @param t rvalue type
174
+ * @param v rvalue value
175
+ * @param extra_size extra space to allocate
176
+ * (so that future string operation can reuse the space)
177
+ * @return new rv or 0 on error
178
+ */
170 179
 struct rvalue* rval_new(enum rval_type t, union rval_val* v, int extra_size);
171 180
 
172 181
 /** inits a rvalue structure- */
... ...
@@ -186,7 +196,23 @@ void rval_clean(struct rvalue* rv);
186 186
 void rval_cache_clean(struct rval_cache* rvc);
187 187
 
188 188
 
189
-/** convert a rvalue to another type.  */
189
+/**
190
+ * @brief Convert a rvalue to another rvalue, of a specific type
191
+ *
192
+ * Convert a rvalue to another rvalue, of a specific type.
193
+ * The result is read-only in most cases (can be a reference
194
+ * to another rvalue, can be checked by using rv_chg_in_place()) and
195
+ * _must_ be rval_destroy()'ed.
196
+ *
197
+ * @param h run action context
198
+ * @param msg SIP mesasge
199
+ * @param type - type to convert to
200
+ * @param v - rvalue to convert
201
+ * @param c - rval_cache (cached v value if known/filled by another
202
+ *            function), can be 0 (unknown/not needed)
203
+ * @return pointer to a rvalue (reference to an existing one or a new
204
+ * one, @see rv_chg_in_place() and the above comment), or 0 on error.
205
+ */
190 206
 struct rvalue* rval_convert(struct run_act_ctx* h, struct sip_msg* msg, 
191 207
 							enum rval_type type, struct rvalue* v,
192 208
 							struct rval_cache* c);
... ...
@@ -207,10 +233,37 @@ int rval_get_tmp_str(struct run_act_ctx* h, struct sip_msg* msg,
207 207
 /** evals an integer expr  to an int. */
208 208
 int rval_expr_eval_int( struct run_act_ctx* h, struct sip_msg* msg,
209 209
 						int* res, struct rval_expr* rve);
210
-/** evals a rval expr.. */
210
+
211
+/**
212
+ * @brief Evals a rval expression
213
+ * @warning result must be rval_destroy()'ed if non-null (it might be
214
+ * a reference to another rval). The result can be modified only
215
+ * if rv_chg_in_place() returns true.
216
+ * @param h run action context
217
+ * @param msg SIP message
218
+ * @param rve rvalue expression
219
+ * @return rvalue on success, 0 on error
220
+ */
211 221
 struct rvalue* rval_expr_eval(struct run_act_ctx* h, struct sip_msg* msg,
212 222
 								struct rval_expr* rve);
213
-/** evals an integer expr  to an int or rvalue. */
223
+
224
+/**
225
+ * @brief Evals a rval expression into an int or another rv(str)
226
+ * @warning rv result (rv_res) must be rval_destroy()'ed if non-null
227
+ * (it might be a reference to another rval). The result can be
228
+ * modified only if rv_chg_in_place() returns true.
229
+ * @param h run action context
230
+ * @param msg SIP message
231
+ * @param res_rv pointer to rvalue result, if non-null it means the 
232
+ * expression evaluated to a non-int (str), which will be stored here.
233
+ * @param res_i pointer to int result, if res_rv==0 and the function
234
+ * returns success => the result is an int which will be stored here.
235
+ * @param rve expression that will be evaluated.
236
+ * @param cache write-only value cache, it might be filled if non-null and
237
+ * empty (rval_cache_init()). If non-null, it _must_ be rval_cache_clean()'ed
238
+ * when done. 
239
+ * @return 0 on success, -1 on error, sets *res_rv or *res_i.
240
+ */
214 241
 int rval_expr_eval_rvint( struct run_act_ctx* h, struct sip_msg* msg,
215 242
 						 struct rvalue** rv_res, int* i_res,
216 243
 						 struct rval_expr* rve, struct rval_cache* cache);
... ...
@@ -222,7 +275,20 @@ enum rval_type rve_guess_type(struct rval_expr* rve);
222 222
 int rve_is_constant(struct rval_expr* rve);
223 223
 /** returns true if the expression can have side-effect */
224 224
 int rve_has_side_effects(struct rval_expr* rve);
225
-/** returns 1 if expression is valid (type-wise).*/
225
+
226
+/**
227
+ * @brief Returns 1 if expression is valid (type-wise)
228
+ * @param type filled with the type of the expression (RV_INT, RV_STR or
229
+ *                RV_NONE if it's dynamic)
230
+ * @param rve  checked expression
231
+ * @param bad_rve set on failure to the subexpression for which the 
232
+ * type check failed
233
+ * @param bad_t set on failure to the type of the bad subexpression
234
+ * @param exp_t set on failure to the expected type for the bad
235
+ * subexpression
236
+ * @return 0 or 1 and sets *type to the resulting type
237
+ * (RV_INT, RV_STR or RV_NONE if it can be found only at runtime)
238
+ */
226 239
 int rve_check_type(enum rval_type* type, struct rval_expr* rve,
227 240
 					struct rval_expr** bad_rve, enum rval_type* bad_type,
228 241
 					enum rval_type* exp_type);
... ...
@@ -233,10 +299,27 @@ char* rval_type_name(enum rval_type type);
233 233
   */
234 234
 struct rval_expr* mk_rval_expr_v(enum rval_type rv_type, void* val,
235 235
 									struct cfg_pos* pos);
236
-/** create a unary op. rval_expr.. */
236
+
237
+/**
238
+ * @brief Create a unary op. rval_expr
239
+ * ret= op rve1
240
+ * @param op   - rval expr. unary operator
241
+ * @param rve1 - rval expr. on which the operator will act.
242
+ * @param pos configuration position
243
+ * @return new pkg_malloc'ed rval_expr or 0 on error.
244
+ */
237 245
 struct rval_expr* mk_rval_expr1(enum rval_expr_op op, struct rval_expr* rve1,
238 246
 									struct cfg_pos* pos);
239
-/** create a rval_expr. from 2 other rval exprs, using op. */
247
+
248
+/**
249
+ * @brief Create a rval_expr. from 2 other rval exprs, using op
250
+ * ret = rve1 op rve2
251
+ * @param op   - rval expr. operator
252
+ * @param rve1 - rval expr. on which the operator will act.
253
+ * @param rve2 - rval expr. on which the operator will act.
254
+ * @param pos configuration position
255
+ * @return new pkg_malloc'ed rval_expr or 0 on error.
256
+ */
240 257
 struct rval_expr* mk_rval_expr2(enum rval_expr_op op, struct rval_expr* rve1,
241 258
 													  struct rval_expr* rve2,
242 259
 													  struct cfg_pos* pos);