Browse code

select: comments for parse_select()

Andrei Pelinescu-Onciul authored on 27/11/2008 00:25:42
Showing 1 changed files
... ...
@@ -60,11 +60,30 @@ static select_table_t *select_list = &select_core_table;
60 60
  */
61 61
 int select_level = 0;
62 62
 
63
-/*
63
+/** parse a select identifier (internal version)
64 64
  * Parse select string into select structure s
65
- * moves pointer p to the first unused char
65
+ * moves pointer p to the first unused char.
66
+ *
67
+ * The select identifier must be of the form:
68
+ *   [@] <sel_id> [ '.' <sel_id> ...]
69
+ *   
70
+ * Where 
71
+ *       <sel_id> = <id> |
72
+ *                  <id> '[' <idx> ']'
73
+ *       <id> = [a-zA-Z0-9_]+
74
+ *       <idx> = <number> | <string>
75
+ *       <string> = '"' <ascii> '"' | 
76
+ *                  '\"' <ascii> '\"'
77
+ *
78
+ * Examples:
79
+ *     @to.tag
80
+ *     @hf_value["contact"]
81
+ *     @msg.header["SER-Server-ID"]
82
+ *     @eval.pop[-1]
83
+ *     contact.uri.params.maddr
84
+ *     cfg_get.rtp_proxy.enabled 
66 85
  *
67
- * Returns -1 error
86
+ * @return -1 error
68 87
  *			  p points to the first unconsumed char
69 88
  *          0 success
70 89
  *			  p points to the first unconsumed char
... ...
@@ -148,6 +167,35 @@ error:
148 148
 	return -1;
149 149
 }
150 150
 
151
+
152
+/** parse a select identifier.
153
+ * Parse select string into select structure s and
154
+ * moves pointer p to the first unused char.
155
+ * 
156
+ * The select identifier must be of the form:
157
+ *   [@] <sel_id> [ '.' <sel_id> ...]
158
+ *   
159
+ * Where 
160
+ *       <sel_id> = <id> |
161
+ *                  <id> '[' <idx> ']'
162
+ *       <id> = [a-zA-Z0-9_]+
163
+ *       <idx> = <number>  | '-' <number> | <string>
164
+ *       <string> = '"' <ascii> '"' | 
165
+ *                  '\"' <ascii> '\"'
166
+ *
167
+ * Examples:
168
+ *     @to.tag
169
+ *     @hf_value["contact"]
170
+ *     @msg.header["SER-Server-ID"]
171
+ *     @eval.pop[-1]
172
+ *     contact.uri.params.maddr
173
+ *     cfg_get.rtp_proxy.enabled 
174
+  *
175
+  * @param p - double string (asciiz) pointer, *p is moved to the first char
176
+  *            after the select identifier
177
+  * @param s - the result will be stored here
178
+  * @return  < 0 on error, 0 on success
179
+  */
151 180
 int parse_select (char** p, select_t** s)
152 181
 {
153 182
 	select_t* sel;