#include <rte_string_fns.h>
#include "app.h"
+#include "version.h"
#include "parser.h"
/**
* Default config values
**/
+uint32_t rest_support = 1;
static struct app_params app_params_default = {
.config_file = "./config/ip_pipeline.cfg",
};
static const char app_usage[] =
- "Usage: %s [-f CONFIG_FILE] [-s SCRIPT_FILE] [-p PORT_MASK] "
- "[-l LOG_LEVEL] [--preproc PREPROCESSOR] [--preproc-args ARGS]\n"
+ "Usage: %s [--version] [-f CONFIG_FILE] [-s SCRIPT_FILE] [-p PORT_MASK] "
+ "[-l LOG_LEVEL] [--disable-hw-csum] [--preproc PREPROCESSOR] [--preproc-args ARGS]\n"
"\n"
"Arguments:\n"
"\t-f CONFIG_FILE: Default config file is %s\n"
"config file when not provided)\n"
"\t-s SCRIPT_FILE: No CLI script file is run when not specified\n"
"\t-l LOG_LEVEL: 0 = NONE, 1 = HIGH PRIO (default), 2 = LOW PRIO\n"
+ "\t--version application version\n"
"\t--disable-hw-csum Disable TCP/UDP HW checksum\n"
"\t--preproc PREPROCESSOR: Configuration file pre-processor\n"
"\t--preproc-args ARGS: Arguments to be passed to pre-processor\n"
"Parse error in section \"%s\"", section_name); \
} while (0)
+uint32_t is_rest_support(void)
+{
+ return rest_support;
+}
+
int
parser_read_arg_bool(const char *p)
{
{
const char *optname;
int opt, option_index;
- int f_present, s_present, p_present, l_present;
+ int f_present, s_present, p_present, l_present, v_present;
int preproc_present, preproc_params_present, disable_csum_present;
int hwlb_present;
int flow_dir_present;
{ "preproc-args", 1, 0, 0 },
{ "hwlb", 1, 0, 0 },
{ "flow_dir", 0, 0, 0 },
+ { "version", 0, 0, 0 },
{ NULL, 0, 0, 0 }
};
f_present = 0;
s_present = 0;
p_present = 0;
+ v_present = 0;
l_present = 0;
disable_csum_present = 0;
preproc_present = 0;
flow_dir_present = 0;
- while ((opt = getopt_long(argc, argv, "f:s:p:l:", lgopts,
+ while ((opt = getopt_long(argc, argv, "f:v:s:p:l:", lgopts,
&option_index)) != EOF)
switch (opt) {
case 'f':
"more than once\n");
f_present = 1;
+ /* REST API not needed as user has supplied the config file */
+ rest_support = 0;
+
if (!strlen(optarg))
rte_panic("Error: Config file name is null\n");
if (app->config_file == NULL)
rte_panic("Error: Memory allocation failure\n");
+
break;
case 's':
case 0:
optname = lgopts[option_index].name;
+ if (strcmp(optname, "version") == 0) {
+ if (v_present)
+ rte_panic("Error: VERSION is provided "
+ "more than once\n");
+ v_present = 1;
+ printf("Version: %s\n", VERSION_STR);
+ exit(0);
+ }
+
if (strcmp(optname, "hwlb") == 0) {
if (hwlb_present)
rte_panic("Error: hwlb argument "