summaryrefslogtreecommitdiff
path: root/trafgen_parser.y
diff options
context:
space:
mode:
Diffstat (limited to 'trafgen_parser.y')
-rw-r--r--trafgen_parser.y25
1 files changed, 25 insertions, 0 deletions
diff --git a/trafgen_parser.y b/trafgen_parser.y
index 88daf7a..1718f3d 100644
--- a/trafgen_parser.y
+++ b/trafgen_parser.y
@@ -34,6 +34,8 @@
extern FILE *yyin;
extern int yylex(void);
+extern void yy_scan_string(char *);
+extern void yylex_destroy();
extern void yyerror(const char *);
extern int yylineno;
extern char *yytext;
@@ -641,6 +643,29 @@ err:
die();
}
+void compile_packets_str(char *str, bool verbose, unsigned int cpu)
+{
+ int ret = 1;
+
+ our_cpu = cpu;
+ realloc_packet();
+
+ yy_scan_string(str);
+ if (yyparse() != 0)
+ goto err;
+
+ finalize_packet();
+ if (our_cpu == 0 && verbose)
+ dump_conf();
+
+ ret = 0;
+err:
+ yylex_destroy();
+
+ if (ret)
+ die();
+}
+
void yyerror(const char *err)
{
fprintf(stderr, "Syntax error at line %d, char '%s': %s\n", yylineno, yytext, err);