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 167
 	return -1;
149 168
 }
150 169
 
170
+
171
+/** parse a select identifier.
172
+ * Parse select string into select structure s and
173
+ * moves pointer p to the first unused char.
174
+ * 
175
+ * The select identifier must be of the form:
176
+ *   [@] <sel_id> [ '.' <sel_id> ...]
177
+ *   
178
+ * Where 
179
+ *       <sel_id> = <id> |
180
+ *                  <id> '[' <idx> ']'
181
+ *       <id> = [a-zA-Z0-9_]+
182
+ *       <idx> = <number>  | '-' <number> | <string>
183
+ *       <string> = '"' <ascii> '"' | 
184
+ *                  '\"' <ascii> '\"'
185
+ *
186
+ * Examples:
187
+ *     @to.tag
188
+ *     @hf_value["contact"]
189
+ *     @msg.header["SER-Server-ID"]
190
+ *     @eval.pop[-1]
191
+ *     contact.uri.params.maddr
192
+ *     cfg_get.rtp_proxy.enabled 
193
+  *
194
+  * @param p - double string (asciiz) pointer, *p is moved to the first char
195
+  *            after the select identifier
196
+  * @param s - the result will be stored here
197
+  * @return  < 0 on error, 0 on success
198
+  */
151 199
 int parse_select (char** p, select_t** s)
152 200
 {
153 201
 	select_t* sel;