diff options
author | Harald Welte <laforge@gnumonks.org> | 2011-10-07 18:45:54 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2011-10-07 18:45:54 +0200 |
commit | 3a4c67b4bf0067c4949a60bc750d01e0576c5e08 (patch) | |
tree | 9d92dc39d341fc0be78a7d389175a66ddf78712e /sgsnemu/cmdline.c | |
parent | 41af5691ef08fb70e2c65aba03c8b9e6c20983a6 (diff) |
optionally do not send recovery with sgsnemu
According to 3GPP TS 29.060 recovery is optional, add command line option --norecovery to remove this field in sgsnemu
Signed-off-by: Yann BONNAMY <yann_bonnamy@yahoo.fr>
Signed-off-by: Harald Welte <laforge@gnumonks.org>
Diffstat (limited to 'sgsnemu/cmdline.c')
-rw-r--r-- | sgsnemu/cmdline.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/sgsnemu/cmdline.c b/sgsnemu/cmdline.c index 7bd1849..1c4c041 100644 --- a/sgsnemu/cmdline.c +++ b/sgsnemu/cmdline.c @@ -66,6 +66,7 @@ const char *gengetopt_args_info_help[] = { " --pingsize=INT Number of ping data bytes (default=`56')", " --pingcount=INT Number of ping req to send (default=`0')", " --pingquiet Do not print ping packet info (default=off)", + " --norecovery Do not send recovery (default=off)", 0 }; @@ -148,6 +149,7 @@ void clear_given (struct gengetopt_args_info *args_info) args_info->pingsize_given = 0 ; args_info->pingcount_given = 0 ; args_info->pingquiet_given = 0 ; + args_info->norecovery_given = 0 ; } static @@ -225,6 +227,7 @@ void clear_args (struct gengetopt_args_info *args_info) args_info->pingcount_arg = 0; args_info->pingcount_orig = NULL; args_info->pingquiet_flag = 0; + args_info->norecovery_flag = 0; } @@ -262,6 +265,7 @@ void init_args_info(struct gengetopt_args_info *args_info) args_info->pingsize_help = gengetopt_args_info_help[28] ; args_info->pingcount_help = gengetopt_args_info_help[29] ; args_info->pingquiet_help = gengetopt_args_info_help[30] ; + args_info->norecovery_help = gengetopt_args_info_help[31] ; } @@ -708,6 +712,9 @@ cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_ if (args_info->pingquiet_given) { fprintf(outfile, "%s\n", "pingquiet"); } + if (args_info->norecovery_given) { + fprintf(outfile, "%s\n", "norecovery"); + } fclose (outfile); @@ -830,6 +837,7 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf { "pingsize", 1, NULL, 0 }, { "pingcount", 1, NULL, 0 }, { "pingquiet", 0, NULL, 0 }, + { "norecovery", 0, NULL, 0 }, { NULL, 0, NULL, 0 } }; @@ -1529,6 +1537,20 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf args_info->pingquiet_given = 1; args_info->pingquiet_flag = !(args_info->pingquiet_flag); } + /* Do not send recovery. */ + else if (strcmp (long_options[option_index].name, "norecovery") == 0) + { + if (local_args_info.norecovery_given) + { + fprintf (stderr, "%s: `--norecovery' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); + goto failure; + } + if (args_info->norecovery_given && ! override) + continue; + local_args_info.norecovery_given = 1; + args_info->norecovery_given = 1; + args_info->norecovery_flag = !(args_info->norecovery_flag); + } break; case '?': /* Invalid option. */ |