Introducing CONSUME_ALL flag: all the subsequent parameters are
authorMiklos Tirpak <miklos@iptel.org>
Fri, 11 Jan 2008 16:30:30 +0000 (16:30 +0000)
committerMiklos Tirpak <miklos@iptel.org>
Fri, 11 Jan 2008 16:30:30 +0000 (16:30 +0000)
accepted without resolving or checking them
Can be used to implement selects with more than one parameter

select.c
select.h

index bf4cb8f..06da933 100644 (file)
--- a/select.c
+++ b/select.c
@@ -299,6 +299,17 @@ int resolve_select(select_t* s)
                }
 
                f = t->table[table_idx].new_f;
+
+               if (t->table[table_idx].flags & CONSUME_ALL) {
+                       /* sanity checks */
+                       if (t->table[table_idx].flags & NESTED)
+                               WARN("resolve_select: CONSUME_ALL should not be set "
+                                       "together with NESTED flag!\n");
+                       if ((t->table[table_idx].flags & FIXUP_CALL) == 0)
+                               WARN("resolve_select: FIXUP_CALL should be defined "
+                                       "if CONSUME_ALL flag is set!\n");
+                       break;
+               }
        }
 
        if (t->table[table_idx].flags & SEL_PARAM_EXPECTED) {
index b2bc297..23f4fa7 100644 (file)
--- a/select.h
+++ b/select.h
  */
 #define CONSUME_NEXT_INT 1<<11
 
+/* accept all the following parameters
+ * without checking them
+ */
+#define CONSUME_ALL    1<<12
+
 /* next parameter is optional (use with CONSUME_NEXT_STR or CONSUME_NEXT_INT
  * resolution is accepted even if there is no other parameter
  * or the parameter is of wrong type
  */
-#define OPTIONAL         1<<12
+#define OPTIONAL         1<<13
 
 /* left function is noted to be called
  * rigth function continues in resolution
  * the only one parameter passed between nested calls
  * is the result str*
  */
-#define NESTED         1<<13
+#define NESTED         1<<14
 
 /* "fixup call" would be done, when the structure is resolved to this node
  * which means call with res and msg NULL
  *
  * if the fixup call return value <0, the select resolution will fail
  */
-#define FIXUP_CALL     1<<14
+#define FIXUP_CALL     1<<15
 
 /*
  * Selector call parameter