- READ_NEXT(goto badeof);
- READ_BLANK(goto badeof);
- READ_STRING("filter parameter value", value, value_len, goto badeof);
- READ_BLANK(goto badeof);
- /* TODO: Insert parameter in the filter.
- */
+ READ_NEXT;
+ READ_BLANK;
+ READ_STRING("filter parameter value", value, value_len, false);
+ READ_BLANK;
+ if (strcmp(key, "type") == 0) {
+ if (!filter_set_type(&filter, value, value_len)) {
+ READ_ERROR("unknow filter type (%s) for filter %s",
+ value, filter.name);
+ }
+ } else if (key_len > 3 && strncmp(key, "on_", 3) == 0) {
+ if (!filter_add_hook(&filter, key + 3, key_len - 3,
+ value, value_len)) {
+ READ_ERROR("hook %s not supported by filter %s",
+ key + 3, filter.name);
+ }
+ } else {
+ /* filter_add_param failure mean unknown type or unsupported type.
+ * this are non-fatal errors.
+ */
+ (void)filter_add_param(&filter, key, key_len, value, value_len);
+ }