[Client] Check the direction
This commit is contained in:
parent
15f4436628
commit
7c6d09d859
3
TODO
3
TODO
|
@ -45,9 +45,6 @@
|
||||||
|
|
||||||
* Client
|
* Client
|
||||||
|
|
||||||
- Check the direction
|
|
||||||
The direction provided by the user should be one of the four
|
|
||||||
possible values.
|
|
||||||
- Allow to use a string for the direction
|
- Allow to use a string for the direction
|
||||||
Could be nice, but probably useless.
|
Could be nice, but probably useless.
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,8 @@ typedef enum {FALSE, TRUE} owl_bool ;
|
||||||
|
|
||||||
/* Direction type */
|
/* Direction type */
|
||||||
enum {NORTH = 1, EAST, SOUTH, WEST} ;
|
enum {NORTH = 1, EAST, SOUTH, WEST} ;
|
||||||
|
#define OWL_DIRECTION_MIN 1
|
||||||
|
#define OWL_DIRECTION_MAX 4
|
||||||
typedef uint8_t owl_direction ;
|
typedef uint8_t owl_direction ;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -227,6 +227,16 @@ void check_configuration()
|
||||||
options.nb_pkt = DEFAULT_NBPKT_NORMAL ;
|
options.nb_pkt = DEFAULT_NBPKT_NORMAL ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Calibration request but bad direction
|
||||||
|
if (is_calibration_request)
|
||||||
|
if (options.direction < OWL_DIRECTION_MIN ||
|
||||||
|
options.direction > OWL_DIRECTION_MAX)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Error! « %"PRIu8" » is not a valid"
|
||||||
|
" direction.\n", options.direction) ;
|
||||||
|
exit(ERR_BAD_USAGE) ;
|
||||||
|
}
|
||||||
|
|
||||||
// Check port numbers
|
// Check port numbers
|
||||||
if (options.dest_port < 1 || options.dest_port > 65535)
|
if (options.dest_port < 1 || options.dest_port > 65535)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue