45 lines
1.3 KiB
C
45 lines
1.3 KiB
C
#ifndef CLI_INTERNAL_ARG_HANDLER
|
|
#define CLI_INTERNAL_ARG_HANDLER
|
|
|
|
#include "ping/ft_ping.h"
|
|
|
|
typedef int (*t_option_handler)(const char *arg, t_ping_config *config);
|
|
|
|
typedef enum e_option_arg_type
|
|
{
|
|
OPT_ARG_NONE = 0,
|
|
OPT_ARG_INT,
|
|
OPT_ARG_UINT,
|
|
OPT_ARG_SECONDS,
|
|
OPT_ARG_BYTES,
|
|
OPT_ARG_TTL,
|
|
OPT_ARG_STRING
|
|
} t_option_arg_type;
|
|
|
|
typedef struct s_option_descriptor
|
|
{
|
|
char short_opt;
|
|
const char *long_opt;
|
|
int has_arg;
|
|
t_option_handler handler;
|
|
t_option_arg_type arg_type;
|
|
const char *description;
|
|
} t_option_descriptor;
|
|
|
|
extern const t_option_descriptor g_options[];
|
|
|
|
const char *cli_get_optstr(void);
|
|
|
|
int cli_handle_count(const char *arg, t_ping_config *config);
|
|
int cli_handle_flood(const char *arg, t_ping_config *config);
|
|
int cli_handle_help(const char *arg, t_ping_config *config);
|
|
int cli_handle_interval(const char *arg, t_ping_config *config);
|
|
int cli_handle_quiet(const char *arg, t_ping_config *config);
|
|
int cli_handle_size(const char *arg, t_ping_config *config);
|
|
int cli_handle_deadline(const char *arg, t_ping_config *config);
|
|
int cli_handle_timeout(const char *arg, t_ping_config *config);
|
|
int cli_handle_ttl(const char *arg, t_ping_config *config);
|
|
int cli_handle_version(const char *arg, t_ping_config *config);
|
|
int cli_handle_verbose(const char *arg, t_ping_config *config);
|
|
|
|
#endif
|