[lib] .h all is prefixed with OWL_ or owl_
All the types, defines, etc. are now prefixed with "OWL_" or "owl_". TRUE and FALSE become owl_true and owl_false.
This commit is contained in:
parent
1d6016a3ce
commit
442c5a4601
|
@ -25,12 +25,12 @@ int main(void)
|
||||||
sigaction(SIGTERM, &action, NULL) ;
|
sigaction(SIGTERM, &action, NULL) ;
|
||||||
|
|
||||||
/* Open the socket */
|
/* Open the socket */
|
||||||
sockfd = owl_create_udp_listening_socket(MOBILE_DEFAULT_PORT) ;
|
sockfd = owl_create_udp_listening_socket(OWL_DEFAULT_RESULT_PORT) ;
|
||||||
if (sockfd < 0)
|
if (sockfd < 0)
|
||||||
return 1 ;
|
return 1 ;
|
||||||
|
|
||||||
/* Read loop */
|
/* Read loop */
|
||||||
owl_run = TRUE ;
|
owl_run = owl_true ;
|
||||||
while (owl_run)
|
while (owl_run)
|
||||||
{
|
{
|
||||||
if (! (result = owl_receive_position(sockfd)))
|
if (! (result = owl_receive_position(sockfd)))
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
owl_bool owl_run = TRUE ;
|
owl_bool owl_run = owl_true ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ void owl_mac_bytes_to_string_r(const uint8_t *const mac_binary,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Compares two MAC addresses.
|
* Compares two MAC addresses.
|
||||||
* Returns TRUE if they are identical, FALSE otherwise.
|
* Returns owl_true if they are identical, owl_false otherwise.
|
||||||
*/
|
*/
|
||||||
owl_bool owl_mac_equals(const uint8_t *const mac1,
|
owl_bool owl_mac_equals(const uint8_t *const mac1,
|
||||||
const uint8_t *const mac2)
|
const uint8_t *const mac2)
|
||||||
|
@ -65,8 +65,8 @@ owl_bool owl_mac_equals(const uint8_t *const mac1,
|
||||||
int i ;
|
int i ;
|
||||||
for (i = 0 ; i < ETHER_ADDR_LEN ; ++i)
|
for (i = 0 ; i < ETHER_ADDR_LEN ; ++i)
|
||||||
if(mac1[i] != mac2[i])
|
if(mac1[i] != mac2[i])
|
||||||
return FALSE ;
|
return owl_false ;
|
||||||
return TRUE ;
|
return owl_true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -383,10 +383,10 @@ void owl_sigint_handler(const int num)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error! The SIGINT handler was called but the"
|
fprintf(stderr, "Error! The SIGINT handler was called but the"
|
||||||
" signal is not SIGINT.\n") ;
|
" signal is not SIGINT.\n") ;
|
||||||
exit(ERR_BAD_SIGNAL) ;
|
exit(OWL_ERR_BAD_SIGNAL) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
owl_run = FALSE ;
|
owl_run = owl_false ;
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
fprintf(stderr, "\nSignal received: end.\n");
|
fprintf(stderr, "\nSignal received: end.\n");
|
||||||
|
@ -404,7 +404,7 @@ void owl_sigterm_handler(const int num)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error! The SIGTERM handler was called but the"
|
fprintf(stderr, "Error! The SIGTERM handler was called but the"
|
||||||
" signal is not SIGTERM.\n") ;
|
" signal is not SIGTERM.\n") ;
|
||||||
exit(ERR_BAD_SIGNAL) ;
|
exit(OWL_ERR_BAD_SIGNAL) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
owl_sigint_handler(SIGINT) ;
|
owl_sigint_handler(SIGINT) ;
|
||||||
|
|
|
@ -20,27 +20,27 @@ extern "C" {
|
||||||
|
|
||||||
|
|
||||||
// Port on which the positioning request is sent by the mobile:
|
// Port on which the positioning request is sent by the mobile:
|
||||||
#define LOC_REQUEST_DEFAULT_PORT 9900
|
#define OWL_DEFAULT_REQUEST_PORT 9900
|
||||||
// Port on which listeners and aggregator communicate:
|
// Port on which listeners and aggregator communicate:
|
||||||
#define AGGREGATE_DEFAULT_PORT 9901
|
#define OWL_DEFAULT_LISTENER_PORT 9901
|
||||||
// Port on which aggregator and positioning server communicate:
|
// Port on which aggregator and positioning server communicate:
|
||||||
#define POSITIONER_DEFAULT_PORT 9902
|
#define OWL_DEFAULT_AGGREGATION_PORT 9902
|
||||||
// Port on which autocalibration requests are sent by the listeners:
|
// Port on which autocalibration requests are sent by the listeners:
|
||||||
#define DEFAULT_AUTOCALIBRATION_REQUEST_PORT 9903
|
#define OWL_DEFAULT_AUTOCALIBRATION_REQUEST_PORT 9903
|
||||||
// Port on which the aggregator listens for hello messages from the
|
// Port on which the aggregator listens for hello messages from the
|
||||||
// listeners, and the listeners listen for orders from the aggregator:
|
// listeners, and the listeners listen for orders from the aggregator:
|
||||||
#define DEFAULT_AUTOCALIBRATION_PORT 9904
|
#define OWL_DEFAULT_AUTOCALIBRATION_PORT 9904
|
||||||
// Port on which the mobile listens for its position:
|
// Port on which the mobile listens for its position:
|
||||||
#define MOBILE_DEFAULT_PORT 9910
|
#define OWL_DEFAULT_RESULT_PORT 9910
|
||||||
|
|
||||||
|
|
||||||
/* Boolean type */
|
/* Boolean type */
|
||||||
typedef enum {FALSE, TRUE} owl_bool ;
|
typedef enum {owl_false, owl_true} owl_bool ;
|
||||||
#define OWL_BOOL_TO_STRING(B) ((B) ? "true" : "false")
|
#define OWL_BOOL_TO_STRING(B) ((B) ? "true" : "false")
|
||||||
|
|
||||||
|
|
||||||
/* Direction type */
|
/* Direction type */
|
||||||
enum {NORTH = 1, EAST, SOUTH, WEST} ;
|
enum {owl_north = 1, owl_east, owl_south, owl_west} ;
|
||||||
#define OWL_DIRECTION_MIN 1
|
#define OWL_DIRECTION_MIN 1
|
||||||
#define OWL_DIRECTION_MAX 4
|
#define OWL_DIRECTION_MAX 4
|
||||||
typedef uint8_t owl_direction ;
|
typedef uint8_t owl_direction ;
|
||||||
|
@ -172,7 +172,7 @@ extern owl_bool owl_run ;
|
||||||
|
|
||||||
|
|
||||||
/* Function error codes */
|
/* Function error codes */
|
||||||
#define ERR_BAD_SIGNAL 111
|
#define OWL_ERR_BAD_SIGNAL 111
|
||||||
|
|
||||||
|
|
||||||
/* Function headers */
|
/* Function headers */
|
||||||
|
|
|
@ -98,7 +98,7 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
owl_run = TRUE ;
|
owl_run = owl_true ;
|
||||||
ret = read_loop(sockfd) ;
|
ret = read_loop(sockfd) ;
|
||||||
|
|
||||||
/* Wait for the threads to terminate */
|
/* Wait for the threads to terminate */
|
||||||
|
@ -178,10 +178,10 @@ void parse_config_file(int argc, char **argv)
|
||||||
CFG_INT("verbose", 0, CFGF_NONE),
|
CFG_INT("verbose", 0, CFGF_NONE),
|
||||||
|
|
||||||
// Aggregation listening port
|
// Aggregation listening port
|
||||||
CFG_INT("listening_port", AGGREGATE_DEFAULT_PORT, CFGF_NONE),
|
CFG_INT("listening_port", OWL_DEFAULT_LISTENER_PORT, CFGF_NONE),
|
||||||
|
|
||||||
// Port and IP address of the localisation server:
|
// Port and IP address of the localisation server:
|
||||||
CFG_INT("positioner_port", POSITIONER_DEFAULT_PORT, CFGF_NONE),
|
CFG_INT("positioner_port", OWL_DEFAULT_AGGREGATION_PORT, CFGF_NONE),
|
||||||
CFG_STR("positioner_ip", POSITIONER_DEFAULT_IP, CFGF_NONE),
|
CFG_STR("positioner_ip", POSITIONER_DEFAULT_IP, CFGF_NONE),
|
||||||
|
|
||||||
CFG_STR("output_file", "", CFGF_NONE),
|
CFG_STR("output_file", "", CFGF_NONE),
|
||||||
|
@ -196,7 +196,7 @@ void parse_config_file(int argc, char **argv)
|
||||||
// Autocalibration activated?
|
// Autocalibration activated?
|
||||||
CFG_BOOL("autocalibration", cfg_false, CFGF_NONE),
|
CFG_BOOL("autocalibration", cfg_false, CFGF_NONE),
|
||||||
// Port on which autocalibration data are exchanged:
|
// Port on which autocalibration data are exchanged:
|
||||||
CFG_INT("autocalibration_port", DEFAULT_AUTOCALIBRATION_PORT,
|
CFG_INT("autocalibration_port", OWL_DEFAULT_AUTOCALIBRATION_PORT,
|
||||||
CFGF_NONE),
|
CFGF_NONE),
|
||||||
// Time we keep APs in the list (in seconds):
|
// Time we keep APs in the list (in seconds):
|
||||||
CFG_INT("ap_keep_timeout", DEFAULT_AP_KEEP_TIMEOUT, CFGF_NONE),
|
CFG_INT("ap_keep_timeout", DEFAULT_AP_KEEP_TIMEOUT, CFGF_NONE),
|
||||||
|
@ -339,7 +339,7 @@ void check_configuration()
|
||||||
if (VERBOSE_WARNING)
|
if (VERBOSE_WARNING)
|
||||||
fprintf(stderr, "Warning! Bad listening_port:"
|
fprintf(stderr, "Warning! Bad listening_port:"
|
||||||
" failing back to the default value.\n") ;
|
" failing back to the default value.\n") ;
|
||||||
cfg_setint(cfg, "listening_port", AGGREGATE_DEFAULT_PORT) ;
|
cfg_setint(cfg, "listening_port", OWL_DEFAULT_LISTENER_PORT) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// positioner_port //
|
// positioner_port //
|
||||||
|
@ -349,7 +349,7 @@ void check_configuration()
|
||||||
if (VERBOSE_WARNING)
|
if (VERBOSE_WARNING)
|
||||||
fprintf(stderr, "Warning! Bad positioner_port:"
|
fprintf(stderr, "Warning! Bad positioner_port:"
|
||||||
" failing back to the default value.\n") ;
|
" failing back to the default value.\n") ;
|
||||||
cfg_setint(cfg, "positioner_port", POSITIONER_DEFAULT_PORT) ;
|
cfg_setint(cfg, "positioner_port", OWL_DEFAULT_AGGREGATION_PORT) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// positioner_ip //
|
// positioner_ip //
|
||||||
|
@ -1329,12 +1329,12 @@ void print_usage()
|
||||||
program_name,
|
program_name,
|
||||||
DEFAULT_CONFIG_FILE,
|
DEFAULT_CONFIG_FILE,
|
||||||
POSITIONER_DEFAULT_IP,
|
POSITIONER_DEFAULT_IP,
|
||||||
POSITIONER_DEFAULT_PORT,
|
OWL_DEFAULT_AGGREGATION_PORT,
|
||||||
AGGREGATE_DEFAULT_PORT,
|
OWL_DEFAULT_LISTENER_PORT,
|
||||||
DEFAULT_AGGREGATE_TIMEOUT,
|
DEFAULT_AGGREGATE_TIMEOUT,
|
||||||
DEFAULT_KEEP_TIMEOUT,
|
DEFAULT_KEEP_TIMEOUT,
|
||||||
DEFAULT_CHECK_INTERVAL,
|
DEFAULT_CHECK_INTERVAL,
|
||||||
DEFAULT_AUTOCALIBRATION_PORT,
|
OWL_DEFAULT_AUTOCALIBRATION_PORT,
|
||||||
DEFAULT_AP_KEEP_TIMEOUT,
|
DEFAULT_AP_KEEP_TIMEOUT,
|
||||||
DEFAULT_AP_CHECK_INTERVAL
|
DEFAULT_AP_CHECK_INTERVAL
|
||||||
) ;
|
) ;
|
||||||
|
|
|
@ -65,7 +65,7 @@ struct {
|
||||||
float z ;
|
float z ;
|
||||||
} options = {
|
} options = {
|
||||||
"",
|
"",
|
||||||
LOC_REQUEST_DEFAULT_PORT,
|
OWL_DEFAULT_REQUEST_PORT,
|
||||||
"",
|
"",
|
||||||
-1,
|
-1,
|
||||||
0,
|
0,
|
||||||
|
@ -76,9 +76,9 @@ struct {
|
||||||
|
|
||||||
char *program_name = NULL ;
|
char *program_name = NULL ;
|
||||||
|
|
||||||
// TRUE if the packet is a calibration request, FALSE if it is a simple
|
// owl_true if the packet is a calibration request, owl_false if it is
|
||||||
// positioning request:
|
// a simple positioning request:
|
||||||
owl_bool is_calibration_request = FALSE ;
|
owl_bool is_calibration_request = owl_false ;
|
||||||
|
|
||||||
int sockfd ; // Sending socket descriptor
|
int sockfd ; // Sending socket descriptor
|
||||||
struct sockaddr_in server ; // Server info
|
struct sockaddr_in server ; // Server info
|
||||||
|
@ -190,7 +190,7 @@ void parse_main_options(int argc, char **argv)
|
||||||
* is an option, we have -l without a port number */
|
* is an option, we have -l without a port number */
|
||||||
if (argv[optind] == NULL || argv[optind][0] == '-')
|
if (argv[optind] == NULL || argv[optind][0] == '-')
|
||||||
// Take the default value:
|
// Take the default value:
|
||||||
options.listening_port = MOBILE_DEFAULT_PORT ;
|
options.listening_port = OWL_DEFAULT_RESULT_PORT ;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Take the optind value:
|
// Take the optind value:
|
||||||
|
@ -242,7 +242,7 @@ void parse_calibration_data(int argc, char **argv)
|
||||||
{
|
{
|
||||||
if (argc - optind == 4)
|
if (argc - optind == 4)
|
||||||
{
|
{
|
||||||
is_calibration_request = TRUE ;
|
is_calibration_request = owl_true ;
|
||||||
options.direction = strtoul(argv[optind++], NULL, 0) ;
|
options.direction = strtoul(argv[optind++], NULL, 0) ;
|
||||||
options.x = strtod(argv[optind++], NULL) ;
|
options.x = strtod(argv[optind++], NULL) ;
|
||||||
options.y = strtod(argv[optind++], NULL) ;
|
options.y = strtod(argv[optind++], NULL) ;
|
||||||
|
@ -302,7 +302,7 @@ void check_configuration()
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "Warning! Bad dest_port:"
|
fprintf(stderr, "Warning! Bad dest_port:"
|
||||||
" failing back to default value.\n") ;
|
" failing back to default value.\n") ;
|
||||||
options.dest_port = LOC_REQUEST_DEFAULT_PORT ;
|
options.dest_port = OWL_DEFAULT_REQUEST_PORT ;
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
}
|
}
|
||||||
if (options.listening_port > 65535)
|
if (options.listening_port > 65535)
|
||||||
|
@ -500,13 +500,13 @@ void print_usage()
|
||||||
,
|
,
|
||||||
program_name,
|
program_name,
|
||||||
program_name,
|
program_name,
|
||||||
LOC_REQUEST_DEFAULT_PORT,
|
OWL_DEFAULT_REQUEST_PORT,
|
||||||
DEFAULT_DELAY_NORMAL,
|
DEFAULT_DELAY_NORMAL,
|
||||||
DEFAULT_DELAY_CALIB,
|
DEFAULT_DELAY_CALIB,
|
||||||
DEFAULT_NBPKT_NORMAL,
|
DEFAULT_NBPKT_NORMAL,
|
||||||
DEFAULT_NBPKT_CALIB,
|
DEFAULT_NBPKT_CALIB,
|
||||||
DEFAULT_FLOOD_DELAY,
|
DEFAULT_FLOOD_DELAY,
|
||||||
MOBILE_DEFAULT_PORT
|
OWL_DEFAULT_RESULT_PORT
|
||||||
) ;
|
) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -314,7 +314,7 @@ void print_version(void) ;
|
||||||
(options.aggregation_ip)
|
(options.aggregation_ip)
|
||||||
#ifdef USE_PTHREAD
|
#ifdef USE_PTHREAD
|
||||||
#define SET_KEEP_MONITOR() \
|
#define SET_KEEP_MONITOR() \
|
||||||
(options.keep_monitor = TRUE)
|
(options.keep_monitor = owl_true)
|
||||||
#define GET_KEEP_MONITOR() \
|
#define GET_KEEP_MONITOR() \
|
||||||
(options.keep_monitor)
|
(options.keep_monitor)
|
||||||
#endif // USE_PTHREAD
|
#endif // USE_PTHREAD
|
||||||
|
@ -337,7 +337,7 @@ void print_version(void) ;
|
||||||
|
|
||||||
#ifdef USE_PTHREAD
|
#ifdef USE_PTHREAD
|
||||||
#define SET_AUTOCALIBRATION() \
|
#define SET_AUTOCALIBRATION() \
|
||||||
(options.autocalibration = TRUE)
|
(options.autocalibration = owl_true)
|
||||||
#define GET_AUTOCALIBRATION() \
|
#define GET_AUTOCALIBRATION() \
|
||||||
(options.autocalibration)
|
(options.autocalibration)
|
||||||
#define SET_AUTOCALIBRATION_IP(IP) \
|
#define SET_AUTOCALIBRATION_IP(IP) \
|
||||||
|
@ -389,9 +389,9 @@ void print_version(void) ;
|
||||||
#define GET_VERBOSE() \
|
#define GET_VERBOSE() \
|
||||||
(options.verbose)
|
(options.verbose)
|
||||||
#define SET_DISPLAY_CAPTURED() \
|
#define SET_DISPLAY_CAPTURED() \
|
||||||
(options.display_captured = TRUE)
|
(options.display_captured = owl_true)
|
||||||
#define UNSET_DISPLAY_CAPTURED() \
|
#define UNSET_DISPLAY_CAPTURED() \
|
||||||
(options.display_captured = FALSE)
|
(options.display_captured = owl_false)
|
||||||
#define GET_DISPLAY_CAPTURED() \
|
#define GET_DISPLAY_CAPTURED() \
|
||||||
(options.display_captured)
|
(options.display_captured)
|
||||||
#endif // USE_CONFIG_FILE
|
#endif // USE_CONFIG_FILE
|
||||||
|
|
|
@ -45,8 +45,8 @@ struct sockaddr_in aggregation_server ;
|
||||||
#ifdef USE_PTHREAD
|
#ifdef USE_PTHREAD
|
||||||
int autocalibration_send_sockfd ;
|
int autocalibration_send_sockfd ;
|
||||||
struct sockaddr_in autocalibration_send_server ;
|
struct sockaddr_in autocalibration_send_server ;
|
||||||
// TRUE if the coordinates of the listener were provided by the user:
|
// owl_true if the coordinates of the listener were provided by the user:
|
||||||
owl_bool coordinates_provided = FALSE ;
|
owl_bool coordinates_provided = owl_false ;
|
||||||
#endif // USE_PTHREAD
|
#endif // USE_PTHREAD
|
||||||
|
|
||||||
#ifdef USE_CONFIG_FILE
|
#ifdef USE_CONFIG_FILE
|
||||||
|
@ -84,25 +84,25 @@ struct {
|
||||||
} options = { // Initalise default options:
|
} options = { // Initalise default options:
|
||||||
MODE_ACTIVE,
|
MODE_ACTIVE,
|
||||||
"127.0.0.1",
|
"127.0.0.1",
|
||||||
AGGREGATE_DEFAULT_PORT,
|
OWL_DEFAULT_LISTENER_PORT,
|
||||||
LOC_REQUEST_DEFAULT_PORT,
|
OWL_DEFAULT_REQUEST_PORT,
|
||||||
#ifdef USE_PTHREAD
|
#ifdef USE_PTHREAD
|
||||||
FALSE,
|
owl_false,
|
||||||
#endif // USE_PTHREAD
|
#endif // USE_PTHREAD
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
#ifdef USE_PTHREAD
|
#ifdef USE_PTHREAD
|
||||||
FALSE,
|
owl_false,
|
||||||
"",
|
"",
|
||||||
DEFAULT_AUTOCALIBRATION_REQUEST_PORT,
|
OWL_DEFAULT_AUTOCALIBRATION_REQUEST_PORT,
|
||||||
DEFAULT_AUTOCALIBRATION_PORT,
|
OWL_DEFAULT_AUTOCALIBRATION_PORT,
|
||||||
DEFAULT_AUTOCALIBRATION_HELLO_DELAY,
|
DEFAULT_AUTOCALIBRATION_HELLO_DELAY,
|
||||||
DEFAULT_AUTOCALIBRATION_DELAY,
|
DEFAULT_AUTOCALIBRATION_DELAY,
|
||||||
DEFAULT_AUTOCALIBRATION_NBPKT,
|
DEFAULT_AUTOCALIBRATION_NBPKT,
|
||||||
0, 0, 0, 0,
|
0, 0, 0, 0,
|
||||||
#endif // USE_PTHREAD
|
#endif // USE_PTHREAD
|
||||||
0,
|
0,
|
||||||
FALSE
|
owl_false
|
||||||
} ;
|
} ;
|
||||||
#endif // USE_CONFIG_FILE
|
#endif // USE_CONFIG_FILE
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ int main(int argc, char *argv[])
|
||||||
program_name = argv[0] ;
|
program_name = argv[0] ;
|
||||||
initialise_configuration(argc, argv) ;
|
initialise_configuration(argc, argv) ;
|
||||||
|
|
||||||
owl_run = TRUE ;
|
owl_run = owl_true ;
|
||||||
|
|
||||||
/* Set up signal handlers */
|
/* Set up signal handlers */
|
||||||
action.sa_flags = 0 ;
|
action.sa_flags = 0 ;
|
||||||
|
@ -269,9 +269,9 @@ void parse_config_file(int argc, char **argv)
|
||||||
// IP address of the aggregator (default: loopback):
|
// IP address of the aggregator (default: loopback):
|
||||||
CFG_STR("aggregation_ip", "127.0.0.1", CFGF_NONE),
|
CFG_STR("aggregation_ip", "127.0.0.1", CFGF_NONE),
|
||||||
// Port on which the aggregator listens:
|
// Port on which the aggregator listens:
|
||||||
CFG_INT("aggregation_port", AGGREGATE_DEFAULT_PORT, CFGF_NONE),
|
CFG_INT("aggregation_port", OWL_DEFAULT_LISTENER_PORT, CFGF_NONE),
|
||||||
// Port on which mobiles send active requests:
|
// Port on which mobiles send active requests:
|
||||||
CFG_INT("listening_port", LOC_REQUEST_DEFAULT_PORT, CFGF_NONE),
|
CFG_INT("listening_port", OWL_DEFAULT_REQUEST_PORT, CFGF_NONE),
|
||||||
#ifdef USE_PTHREAD
|
#ifdef USE_PTHREAD
|
||||||
// Activate the active monitor mode keeping-up (read the code if
|
// Activate the active monitor mode keeping-up (read the code if
|
||||||
// you do not understand what I mean):
|
// you do not understand what I mean):
|
||||||
|
@ -290,9 +290,9 @@ void parse_config_file(int argc, char **argv)
|
||||||
CFG_STR("autocalibration_ip", "", CFGF_NONE),
|
CFG_STR("autocalibration_ip", "", CFGF_NONE),
|
||||||
// Port on which autocalibration requests are sent:
|
// Port on which autocalibration requests are sent:
|
||||||
CFG_INT("autocalibration_request_port",
|
CFG_INT("autocalibration_request_port",
|
||||||
DEFAULT_AUTOCALIBRATION_REQUEST_PORT, CFGF_NONE),
|
OWL_DEFAULT_AUTOCALIBRATION_REQUEST_PORT, CFGF_NONE),
|
||||||
// Port on which autocalibration data are exchanged:
|
// Port on which autocalibration data are exchanged:
|
||||||
CFG_INT("autocalibration_port", DEFAULT_AUTOCALIBRATION_PORT,
|
CFG_INT("autocalibration_port", OWL_DEFAULT_AUTOCALIBRATION_PORT,
|
||||||
CFGF_NONE),
|
CFGF_NONE),
|
||||||
// Delay between two hello messages:
|
// Delay between two hello messages:
|
||||||
CFG_INT("autocalibration_hello_delay",
|
CFG_INT("autocalibration_hello_delay",
|
||||||
|
@ -505,7 +505,7 @@ void parse_calibration_data(int argc, char **argv)
|
||||||
{
|
{
|
||||||
if (argc - optind == 4)
|
if (argc - optind == 4)
|
||||||
{
|
{
|
||||||
coordinates_provided = TRUE ;
|
coordinates_provided = owl_true ;
|
||||||
SET_MY_DIRECTION(strtoul(argv[optind++], NULL, 0)) ;
|
SET_MY_DIRECTION(strtoul(argv[optind++], NULL, 0)) ;
|
||||||
SET_MY_POSITION_X(strtod(argv[optind++], NULL)) ;
|
SET_MY_POSITION_X(strtod(argv[optind++], NULL)) ;
|
||||||
SET_MY_POSITION_Y(strtod(argv[optind++], NULL)) ;
|
SET_MY_POSITION_Y(strtod(argv[optind++], NULL)) ;
|
||||||
|
@ -559,14 +559,14 @@ void check_configuration()
|
||||||
if (VERBOSE_WARNING)
|
if (VERBOSE_WARNING)
|
||||||
fprintf(stderr, "Warning! Bad aggregation_port:"
|
fprintf(stderr, "Warning! Bad aggregation_port:"
|
||||||
" failing back to the default value.\n") ;
|
" failing back to the default value.\n") ;
|
||||||
SET_AGGREGATION_PORT(AGGREGATE_DEFAULT_PORT) ;
|
SET_AGGREGATION_PORT(OWL_DEFAULT_LISTENER_PORT) ;
|
||||||
}
|
}
|
||||||
if (GET_LISTENING_PORT() < 1 || GET_LISTENING_PORT() > 65535)
|
if (GET_LISTENING_PORT() < 1 || GET_LISTENING_PORT() > 65535)
|
||||||
{
|
{
|
||||||
if (VERBOSE_WARNING)
|
if (VERBOSE_WARNING)
|
||||||
fprintf(stderr, "Warning! Bad listening_port:"
|
fprintf(stderr, "Warning! Bad listening_port:"
|
||||||
" failing back to the default value.\n") ;
|
" failing back to the default value.\n") ;
|
||||||
SET_LISTENING_PORT(LOC_REQUEST_DEFAULT_PORT) ;
|
SET_LISTENING_PORT(OWL_DEFAULT_REQUEST_PORT) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Autocalibration stuff //
|
// Autocalibration stuff //
|
||||||
|
@ -599,7 +599,7 @@ void check_configuration()
|
||||||
if (VERBOSE_WARNING)
|
if (VERBOSE_WARNING)
|
||||||
fprintf(stderr, "Warning! Bad autocalibration_request_port:"
|
fprintf(stderr, "Warning! Bad autocalibration_request_port:"
|
||||||
" failing back to the default value.\n") ;
|
" failing back to the default value.\n") ;
|
||||||
SET_AUTOCALIBRATION_REQUEST_PORT(DEFAULT_AUTOCALIBRATION_REQUEST_PORT) ;
|
SET_AUTOCALIBRATION_REQUEST_PORT(OWL_DEFAULT_AUTOCALIBRATION_REQUEST_PORT) ;
|
||||||
}
|
}
|
||||||
if (GET_AUTOCALIBRATION_PORT() < 1 ||
|
if (GET_AUTOCALIBRATION_PORT() < 1 ||
|
||||||
GET_AUTOCALIBRATION_PORT() > 65535)
|
GET_AUTOCALIBRATION_PORT() > 65535)
|
||||||
|
@ -607,7 +607,7 @@ void check_configuration()
|
||||||
if (VERBOSE_WARNING)
|
if (VERBOSE_WARNING)
|
||||||
fprintf(stderr, "Warning! Bad autocalibration_port:"
|
fprintf(stderr, "Warning! Bad autocalibration_port:"
|
||||||
" failing back to the default value.\n") ;
|
" failing back to the default value.\n") ;
|
||||||
SET_AUTOCALIBRATION_PORT(DEFAULT_AUTOCALIBRATION_PORT) ;
|
SET_AUTOCALIBRATION_PORT(OWL_DEFAULT_AUTOCALIBRATION_PORT) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // USE_PTHREAD
|
#endif // USE_PTHREAD
|
||||||
|
@ -785,9 +785,10 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header,
|
||||||
// Pointer to the (possible) UDP header of the packet:
|
// Pointer to the (possible) UDP header of the packet:
|
||||||
struct udphdr *packet_udp_header = NULL ;
|
struct udphdr *packet_udp_header = NULL ;
|
||||||
// Localisation request type (request, calibration, autocalibration):
|
// Localisation request type (request, calibration, autocalibration):
|
||||||
owl_bool is_explicit_packet = TRUE ; // Is the packet an explicit request?
|
// Is the packet an explicit request?
|
||||||
|
owl_bool is_explicit_packet = owl_true ;
|
||||||
// Is the packet an autocalibration positioning request?
|
// Is the packet an autocalibration positioning request?
|
||||||
owl_bool uses_autocalibration_request_port = FALSE ;
|
owl_bool uses_autocalibration_request_port = owl_false ;
|
||||||
ssize_t nsent ; // sendto return value
|
ssize_t nsent ; // sendto return value
|
||||||
|
|
||||||
// Blank the request:
|
// Blank the request:
|
||||||
|
@ -853,7 +854,7 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header,
|
||||||
#ifdef USE_PTHREAD
|
#ifdef USE_PTHREAD
|
||||||
if (GET_AUTOCALIBRATION() && dest_port ==
|
if (GET_AUTOCALIBRATION() && dest_port ==
|
||||||
(uint_fast16_t) GET_AUTOCALIBRATION_REQUEST_PORT())
|
(uint_fast16_t) GET_AUTOCALIBRATION_REQUEST_PORT())
|
||||||
uses_autocalibration_request_port = TRUE ;
|
uses_autocalibration_request_port = owl_true ;
|
||||||
else
|
else
|
||||||
#endif // USE_PTHREAD
|
#endif // USE_PTHREAD
|
||||||
if (dest_port != (uint_fast16_t) GET_LISTENING_PORT())
|
if (dest_port != (uint_fast16_t) GET_LISTENING_PORT())
|
||||||
|
@ -865,7 +866,7 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header,
|
||||||
not_explicit_packet :
|
not_explicit_packet :
|
||||||
if (GET_MODE() == MODE_ACTIVE)
|
if (GET_MODE() == MODE_ACTIVE)
|
||||||
return ;
|
return ;
|
||||||
is_explicit_packet = FALSE ;
|
is_explicit_packet = owl_false ;
|
||||||
|
|
||||||
process_packet :
|
process_packet :
|
||||||
|
|
||||||
|
@ -936,7 +937,7 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header,
|
||||||
printf("\nStrange explicit packet received\n") ;
|
printf("\nStrange explicit packet received\n") ;
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Error! Unknown request type (%d).\n", request.type) ;
|
"Error! Unknown request type (%d).\n", request.type) ;
|
||||||
is_explicit_packet = FALSE ;
|
is_explicit_packet = owl_false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! is_explicit_packet)
|
if (! is_explicit_packet)
|
||||||
|
@ -1042,7 +1043,7 @@ void extract_calibration_data(const u_char *packet,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fills 'request' with the required data extracted from the Radiotap
|
* Fills 'request' with the required data extracted from the Radiotap
|
||||||
* header of 'packet'. The elements of 'rtap_fields' are set to TRUE
|
* header of 'packet'. The elements of 'rtap_fields' are set to owl_true
|
||||||
* when the corresponding Radiotap flag is found in the packet.
|
* when the corresponding Radiotap flag is found in the packet.
|
||||||
*/
|
*/
|
||||||
void extract_radiotap_data(const u_char *packet,
|
void extract_radiotap_data(const u_char *packet,
|
||||||
|
@ -1060,7 +1061,7 @@ void extract_radiotap_data(const u_char *packet,
|
||||||
rtap_presentflags = le32toh(rtap_presentflags) ;
|
rtap_presentflags = le32toh(rtap_presentflags) ;
|
||||||
|
|
||||||
for (i = 0 ; i < 15 ; ++i) // Initialise present flags structure
|
for (i = 0 ; i < 15 ; ++i) // Initialise present flags structure
|
||||||
rtap_fields[i] = FALSE ;
|
rtap_fields[i] = owl_false ;
|
||||||
rtap_position = 8 ; // Begining of the present flags determined fields
|
rtap_position = 8 ; // Begining of the present flags determined fields
|
||||||
|
|
||||||
// Test the first 15 bits of the flag field in order to check their
|
// Test the first 15 bits of the flag field in order to check their
|
||||||
|
@ -1072,15 +1073,15 @@ void extract_radiotap_data(const u_char *packet,
|
||||||
switch(i)
|
switch(i)
|
||||||
{
|
{
|
||||||
case RTAP_MACTS:
|
case RTAP_MACTS:
|
||||||
rtap_fields[RTAP_MACTS] = TRUE ;
|
rtap_fields[RTAP_MACTS] = owl_true ;
|
||||||
rtap_position += RTAP_L_MACTS ;
|
rtap_position += RTAP_L_MACTS ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_FLAGS:
|
case RTAP_FLAGS:
|
||||||
rtap_fields[RTAP_FLAGS] = TRUE;
|
rtap_fields[RTAP_FLAGS] = owl_true;
|
||||||
rtap_position += RTAP_L_FLAGS ;
|
rtap_position += RTAP_L_FLAGS ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_RATE:
|
case RTAP_RATE:
|
||||||
rtap_fields[RTAP_RATE] = TRUE;
|
rtap_fields[RTAP_RATE] = owl_true;
|
||||||
rtap_position += RTAP_L_RATE ;
|
rtap_position += RTAP_L_RATE ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_CHANNEL:
|
case RTAP_CHANNEL:
|
||||||
|
@ -1088,52 +1089,52 @@ void extract_radiotap_data(const u_char *packet,
|
||||||
rtap_position += RTAP_L_CHANNELTYPE ;
|
rtap_position += RTAP_L_CHANNELTYPE ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_FHSS:
|
case RTAP_FHSS:
|
||||||
rtap_fields[RTAP_FHSS] = TRUE;
|
rtap_fields[RTAP_FHSS] = owl_true;
|
||||||
rtap_position += RTAP_L_FHSS ;
|
rtap_position += RTAP_L_FHSS ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_ANTENNASIGNALDBM:
|
case RTAP_ANTENNASIGNALDBM:
|
||||||
memcpy(&request->antenna_signal_dbm,
|
memcpy(&request->antenna_signal_dbm,
|
||||||
&packet[rtap_position], RTAP_L_ANTENNASIGNALDBM) ;
|
&packet[rtap_position], RTAP_L_ANTENNASIGNALDBM) ;
|
||||||
rtap_fields[RTAP_ANTENNASIGNALDBM] = TRUE;
|
rtap_fields[RTAP_ANTENNASIGNALDBM] = owl_true;
|
||||||
if (VERBOSE_INFO)
|
if (VERBOSE_INFO)
|
||||||
printf("Antenna signal: %d dBm\n",
|
printf("Antenna signal: %d dBm\n",
|
||||||
request->antenna_signal_dbm - 0x100);
|
request->antenna_signal_dbm - 0x100);
|
||||||
rtap_position += RTAP_L_ANTENNASIGNALDBM ;
|
rtap_position += RTAP_L_ANTENNASIGNALDBM ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_ANTENNANOISEDBM:
|
case RTAP_ANTENNANOISEDBM:
|
||||||
rtap_fields[RTAP_ANTENNANOISEDBM] = TRUE;
|
rtap_fields[RTAP_ANTENNANOISEDBM] = owl_true;
|
||||||
rtap_position += RTAP_L_ANTENNANOISEDBM ;
|
rtap_position += RTAP_L_ANTENNANOISEDBM ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_LOCKQUALITY:
|
case RTAP_LOCKQUALITY:
|
||||||
rtap_fields[RTAP_LOCKQUALITY] = TRUE;
|
rtap_fields[RTAP_LOCKQUALITY] = owl_true;
|
||||||
rtap_position += RTAP_L_LOCKQUALITY ;
|
rtap_position += RTAP_L_LOCKQUALITY ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_TXATTENUATION:
|
case RTAP_TXATTENUATION:
|
||||||
rtap_fields[RTAP_TXATTENUATION] = TRUE;
|
rtap_fields[RTAP_TXATTENUATION] = owl_true;
|
||||||
rtap_position += RTAP_L_TXATTENUATION ;
|
rtap_position += RTAP_L_TXATTENUATION ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_TXATTENUATIONDB:
|
case RTAP_TXATTENUATIONDB:
|
||||||
rtap_fields[RTAP_TXATTENUATIONDB] = TRUE;
|
rtap_fields[RTAP_TXATTENUATIONDB] = owl_true;
|
||||||
rtap_position += RTAP_L_TXATTENUATIONDB ;
|
rtap_position += RTAP_L_TXATTENUATIONDB ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_TXATTENUATIONDBM:
|
case RTAP_TXATTENUATIONDBM:
|
||||||
rtap_fields[RTAP_TXATTENUATIONDBM] = TRUE;
|
rtap_fields[RTAP_TXATTENUATIONDBM] = owl_true;
|
||||||
rtap_position += RTAP_L_TXATTENUATIONDBM ;
|
rtap_position += RTAP_L_TXATTENUATIONDBM ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_ANTENNA:
|
case RTAP_ANTENNA:
|
||||||
rtap_fields[RTAP_ANTENNA] = TRUE;
|
rtap_fields[RTAP_ANTENNA] = owl_true;
|
||||||
rtap_position += RTAP_L_ANTENNA ;
|
rtap_position += RTAP_L_ANTENNA ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_ANTENNASIGNALDB:
|
case RTAP_ANTENNASIGNALDB:
|
||||||
rtap_fields[RTAP_ANTENNASIGNALDB] = TRUE;
|
rtap_fields[RTAP_ANTENNASIGNALDB] = owl_true;
|
||||||
rtap_position += RTAP_L_ANTENNASIGNALDB ;
|
rtap_position += RTAP_L_ANTENNASIGNALDB ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_ANTENNANOISEDB:
|
case RTAP_ANTENNANOISEDB:
|
||||||
rtap_fields[RTAP_ANTENNANOISEDB] = TRUE;
|
rtap_fields[RTAP_ANTENNANOISEDB] = owl_true;
|
||||||
rtap_position += RTAP_L_ANTENNANOISEDB ;
|
rtap_position += RTAP_L_ANTENNANOISEDB ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_FCS:
|
case RTAP_FCS:
|
||||||
rtap_fields[RTAP_FCS] = TRUE;
|
rtap_fields[RTAP_FCS] = owl_true;
|
||||||
rtap_position += RTAP_L_FCS ;
|
rtap_position += RTAP_L_FCS ;
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
|
@ -1458,10 +1459,10 @@ void print_usage()
|
||||||
program_name,
|
program_name,
|
||||||
program_name,
|
program_name,
|
||||||
DEFAULT_CONFIG_FILE,
|
DEFAULT_CONFIG_FILE,
|
||||||
LOC_REQUEST_DEFAULT_PORT,
|
OWL_DEFAULT_REQUEST_PORT,
|
||||||
AGGREGATE_DEFAULT_PORT,
|
OWL_DEFAULT_LISTENER_PORT,
|
||||||
DEFAULT_AUTOCALIBRATION_REQUEST_PORT,
|
OWL_DEFAULT_AUTOCALIBRATION_REQUEST_PORT,
|
||||||
DEFAULT_AUTOCALIBRATION_PORT,
|
OWL_DEFAULT_AUTOCALIBRATION_PORT,
|
||||||
DEFAULT_AUTOCALIBRATION_HELLO_DELAY,
|
DEFAULT_AUTOCALIBRATION_HELLO_DELAY,
|
||||||
DEFAULT_AUTOCALIBRATION_DELAY,
|
DEFAULT_AUTOCALIBRATION_DELAY,
|
||||||
DEFAULT_AUTOCALIBRATION_NBPKT
|
DEFAULT_AUTOCALIBRATION_NBPKT
|
||||||
|
|
|
@ -30,7 +30,7 @@ int main(int argc, char **argv)
|
||||||
sigaction(SIGTERM, &action, NULL) ;
|
sigaction(SIGTERM, &action, NULL) ;
|
||||||
|
|
||||||
/* Run! */
|
/* Run! */
|
||||||
owl_run = TRUE ;
|
owl_run = owl_true ;
|
||||||
Positioning positioning ;
|
Positioning positioning ;
|
||||||
|
|
||||||
/* Clean */
|
/* Clean */
|
||||||
|
|
|
@ -149,7 +149,7 @@ void UserInterface::fill_input_options()
|
||||||
("input.csv-file,C", po::value<string>(),
|
("input.csv-file,C", po::value<string>(),
|
||||||
"CSV file to use for input (when input.medium = CSV).")
|
"CSV file to use for input (when input.medium = CSV).")
|
||||||
("input.udp-port,p", po::value<int>()
|
("input.udp-port,p", po::value<int>()
|
||||||
->default_value(POSITIONER_DEFAULT_PORT),
|
->default_value(OWL_DEFAULT_AGGREGATION_PORT),
|
||||||
"Port on which the UDP socket listens (when input.medium = UDP).")
|
"Port on which the UDP socket listens (when input.medium = UDP).")
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ void UserInterface::fill_output_options()
|
||||||
("output.udp-host", po::value<string>(),
|
("output.udp-host", po::value<string>(),
|
||||||
"Host to which the UDP data is sent (when output.medium = UDP).")
|
"Host to which the UDP data is sent (when output.medium = UDP).")
|
||||||
("output.udp-port", po::value<int>()
|
("output.udp-port", po::value<int>()
|
||||||
->default_value(MOBILE_DEFAULT_PORT),
|
->default_value(OWL_DEFAULT_RESULT_PORT),
|
||||||
"Port on which the UDP data is sent (when output.medium = UDP).")
|
"Port on which the UDP data is sent (when output.medium = UDP).")
|
||||||
("output.tcpevaal-host", po::value<string>()
|
("output.tcpevaal-host", po::value<string>()
|
||||||
->default_value(DEFAULT_TCPEVAAL_HOST),
|
->default_value(DEFAULT_TCPEVAAL_HOST),
|
||||||
|
|
Loading…
Reference in New Issue