「🏗️」 wip: wtf is this
This commit is contained in:
@ -1,15 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
typedef struct {
|
||||
struct options{
|
||||
char *name;
|
||||
char opt;
|
||||
char *doc;
|
||||
uint8_t arg_nb;
|
||||
uint8_t grp;
|
||||
} options_t;
|
||||
};
|
||||
|
||||
static options_t options[] = {
|
||||
typedef enum {
|
||||
USAGE,
|
||||
HELP,
|
||||
VERSION,
|
||||
VERBOSE,
|
||||
COUNT,
|
||||
SIZE,
|
||||
TIMEOUT,
|
||||
LINGER,
|
||||
INTERVAL
|
||||
} options_nb_t;
|
||||
|
||||
static struct options options[] = {
|
||||
#define GRP 0 // AKA random useless sh*t
|
||||
{"usage", 'u', "give a short usage message", 0, GRP},
|
||||
{"help", '?', "give this help list", 0, GRP},
|
||||
@ -22,12 +34,12 @@ static options_t options[] = {
|
||||
{"count", 'c', "stop after sending NUMBER packets", 1, GRP},
|
||||
{"size", 's', "send NUMBER data octets", 1, GRP},
|
||||
{"timeout", 'w', "stop after N seconds", 1, GRP},
|
||||
{"ttl", 't', "specify N as time-to-live", 1, GRP},
|
||||
{"linger", 'W', "number of seconds to wait for response", 1, GRP},
|
||||
{"interval", 'i', "wait NUMBER seconds between sending each packet", 1, GRP}
|
||||
#undef GRP
|
||||
};
|
||||
|
||||
#define OPT_NB 9
|
||||
#define OPT_NB 10
|
||||
|
||||
#define FT_PING_V "0.1"
|
||||
|
||||
|
@ -1,20 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include "bits/types/struct_timeval.h"
|
||||
#include "help.h"
|
||||
#include "opt_parse.h"
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
extern char *exec_name;
|
||||
extern char *exec_name;
|
||||
extern int tx_count;
|
||||
extern int rx_count;
|
||||
extern char *address;
|
||||
extern double *times;
|
||||
|
||||
typedef struct {
|
||||
bool verbose;
|
||||
int count;
|
||||
int size;
|
||||
int timeout;
|
||||
int ttl;
|
||||
int interval;
|
||||
} ping_t;
|
||||
bool verbose;
|
||||
uint32_t count;
|
||||
uint16_t size;
|
||||
uint16_t timeout;
|
||||
uint16_t linger;
|
||||
uint16_t interval;
|
||||
} options_t;
|
||||
|
||||
#define DEFAULT_COUNT -1
|
||||
#define DEFAULT_VERBOSE false
|
||||
#define DEFAULT_SIZE 0
|
||||
#define DEFAULT_INTERVAL 0
|
||||
#define DEFAULT_TIMEOUT 0
|
||||
|
||||
#define DEFAULT_SIZE 64
|
||||
#define DEFAULT_INTERVAL 1
|
||||
#define DEFAULT_TIMEOUT -1
|
||||
#define DEFAULT_COUNT -1
|
||||
#define DEFAULT_LINGER 10
|
||||
|
||||
int send_ping(args_t *args);
|
||||
|
3
includes/utils.h
Normal file
3
includes/utils.h
Normal file
@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
void append_time(double time);
|
Reference in New Issue
Block a user