26 lines
1.2 KiB
C
26 lines
1.2 KiB
C
|
|
#include "cli.h"
|
|
#include <getopt.h>
|
|
|
|
typedef struct s_option_descriptor
|
|
{
|
|
int short_opt;
|
|
const char *long_opt;
|
|
int has_arg;
|
|
t_option_handler handler;
|
|
const char *description;
|
|
} t_option_descriptor;
|
|
|
|
const t_option_descriptor g_options[] = {
|
|
{'h', "help", no_argument, cli_handle_help, "Display this help and exit"},
|
|
{'V', "version", no_argument, cli_handle_version, "Display version information and exit"},
|
|
{'v', "verbose", no_argument, cli_handle_verbose, "Verbose output"},
|
|
{'q', "quiet", no_argument, cli_handle_quiet, "Quiet mode (only show summary)"},
|
|
{'c', "count", required_argument, cli_handle_count, "Stop after sending N packets"},
|
|
{'i', "interval", required_argument, cli_handle_interval, "Wait N seconds between packets"},
|
|
{'t', "ttl", required_argument, cli_handle_ttl, "Set Time To Live"},
|
|
{'s', "size", required_argument, cli_handle_size, "Packet size in bytes"},
|
|
{'W', "timeout", required_argument, cli_handle_timeout, "Timeout for replies in seconds"},
|
|
{'f', "flood", no_argument, cli_handle_flood, "Flood mode"},
|
|
{0, NULL, 0, NULL, NULL}
|
|
};
|