[lib] Stop defining owl_bool (use stdbool.h)
We don't define our own boolean type in owlps.h any more: bool (from stdbool.h) is used instead.
This commit is contained in:
parent
94a567ca4b
commit
0614b52219
2
TODO.t2t
2
TODO.t2t
|
@ -91,8 +91,6 @@ Work to do in OwlPS
|
||||||
|
|
||||||
= libowlps =
|
= libowlps =
|
||||||
|
|
||||||
- Use stdbool.h instead of #define owl_bool.
|
|
||||||
|
|
||||||
- Currently unused functions:
|
- Currently unused functions:
|
||||||
- owl_timestamp_is_null()
|
- owl_timestamp_is_null()
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ int main(void)
|
||||||
return 1 ;
|
return 1 ;
|
||||||
|
|
||||||
/* Read loop */
|
/* Read loop */
|
||||||
owl_run = owl_true ;
|
owl_run = true ;
|
||||||
while (owl_run)
|
while (owl_run)
|
||||||
{
|
{
|
||||||
if (! (result = owl_receive_position(sockfd)))
|
if (! (result = owl_receive_position(sockfd)))
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
owl_bool owl_run = owl_true ;
|
bool owl_run = true ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -96,16 +96,16 @@ void owl_mac_bytes_to_string_r(const uint8_t *const mac_binary,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Compares two MAC addresses.
|
* Compares two MAC addresses.
|
||||||
* Returns owl_true if they are identical, owl_false otherwise.
|
* Returns true if they are identical, false otherwise.
|
||||||
*/
|
*/
|
||||||
owl_bool owl_mac_equals(const uint8_t *const mac1,
|
bool owl_mac_equals(const uint8_t *const mac1,
|
||||||
const uint8_t *const mac2)
|
const uint8_t *const mac2)
|
||||||
{
|
{
|
||||||
int i ;
|
int i ;
|
||||||
for (i = ETHER_ADDR_LEN - 1 ; i >= 0 ; --i)
|
for (i = ETHER_ADDR_LEN - 1 ; i >= 0 ; --i)
|
||||||
if(mac1[i] != mac2[i])
|
if(mac1[i] != mac2[i])
|
||||||
return owl_false ;
|
return false ;
|
||||||
return owl_true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ void owl_timeval_to_timestamp(const struct timeval *const src,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
owl_bool owl_timestamp_equals(const owl_timestamp *const d1,
|
bool owl_timestamp_equals(const owl_timestamp *const d1,
|
||||||
const owl_timestamp *const d2)
|
const owl_timestamp *const d2)
|
||||||
{
|
{
|
||||||
assert(d1) ;
|
assert(d1) ;
|
||||||
|
@ -272,7 +272,7 @@ owl_bool owl_timestamp_equals(const owl_timestamp *const d1,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
owl_bool owl_timestamp_is_null(const owl_timestamp *const d)
|
bool owl_timestamp_is_null(const owl_timestamp *const d)
|
||||||
{
|
{
|
||||||
assert(d) ;
|
assert(d) ;
|
||||||
return d->tv_sec == 0 && d->tv_nsec == 0 ;
|
return d->tv_sec == 0 && d->tv_nsec == 0 ;
|
||||||
|
@ -524,7 +524,7 @@ void owl_sigint_handler(const int num)
|
||||||
exit(OWL_ERR_BAD_SIGNAL) ;
|
exit(OWL_ERR_BAD_SIGNAL) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
owl_run = owl_false ;
|
owl_run = false ;
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
fprintf(stderr, "\nSignal received: end.\n");
|
fprintf(stderr, "\nSignal received: end.\n");
|
||||||
|
|
|
@ -51,7 +51,7 @@ extern "C" {
|
||||||
|
|
||||||
|
|
||||||
#include <stdint.h> // We'll use <cstdint> with C++ 0x
|
#include <stdint.h> // We'll use <cstdint> with C++ 0x
|
||||||
|
#include <stdbool.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
|
@ -75,11 +75,6 @@ extern "C" {
|
||||||
#define OWL_DEFAULT_RESULT_PORT 9910
|
#define OWL_DEFAULT_RESULT_PORT 9910
|
||||||
|
|
||||||
|
|
||||||
/* Boolean type */
|
|
||||||
typedef enum {owl_false, owl_true} owl_bool ;
|
|
||||||
#define OWL_BOOL_TO_STRING(B) ((B) ? "true" : "false")
|
|
||||||
|
|
||||||
|
|
||||||
/* Direction type */
|
/* Direction type */
|
||||||
enum {owl_north = 1, owl_east, owl_south, owl_west} ;
|
enum {owl_north = 1, owl_east, owl_south, owl_west} ;
|
||||||
#define OWL_DIRECTION_MIN 1
|
#define OWL_DIRECTION_MIN 1
|
||||||
|
@ -217,7 +212,7 @@ typedef struct _owl_autocalibration_order
|
||||||
|
|
||||||
/* Global variables */
|
/* Global variables */
|
||||||
// Used to handle end of loops:
|
// Used to handle end of loops:
|
||||||
extern owl_bool owl_run ;
|
extern bool owl_run ;
|
||||||
|
|
||||||
|
|
||||||
/* Error codes */
|
/* Error codes */
|
||||||
|
@ -247,12 +242,17 @@ extern owl_bool owl_run ;
|
||||||
#define OWL_ERR_IFACE_MODE_SET 132
|
#define OWL_ERR_IFACE_MODE_SET 132
|
||||||
|
|
||||||
|
|
||||||
|
/* Macros */
|
||||||
|
// Converts a bool to the corresponding string
|
||||||
|
#define OWL_BOOL_TO_STRING(B) ((B) ? "true" : "false")
|
||||||
|
|
||||||
|
|
||||||
/* Function headers */
|
/* Function headers */
|
||||||
// Misc
|
// Misc
|
||||||
const char* owl_mac_bytes_to_string(const uint8_t *const mac_binary) ;
|
const char* owl_mac_bytes_to_string(const uint8_t *const mac_binary) ;
|
||||||
void owl_mac_bytes_to_string_r(const uint8_t *const mac_binary,
|
void owl_mac_bytes_to_string_r(const uint8_t *const mac_binary,
|
||||||
char mac_str[OWL_ETHER_ADDR_STRLEN]) ;
|
char mac_str[OWL_ETHER_ADDR_STRLEN]) ;
|
||||||
owl_bool owl_mac_equals(const uint8_t *const mac1,
|
bool owl_mac_equals(const uint8_t *const mac1,
|
||||||
const uint8_t *const mac2) ;
|
const uint8_t *const mac2) ;
|
||||||
uint_fast8_t owl_frequency_to_channel(const uint_fast16_t channel) ;
|
uint_fast8_t owl_frequency_to_channel(const uint_fast16_t channel) ;
|
||||||
|
|
||||||
|
@ -263,9 +263,9 @@ void owl_timespec_to_timestamp(const struct timespec *const src,
|
||||||
owl_timestamp *const dst) ;
|
owl_timestamp *const dst) ;
|
||||||
void owl_timeval_to_timestamp(const struct timeval *const src,
|
void owl_timeval_to_timestamp(const struct timeval *const src,
|
||||||
owl_timestamp *const dst) ;
|
owl_timestamp *const dst) ;
|
||||||
owl_bool owl_timestamp_equals(const owl_timestamp *const d1,
|
bool owl_timestamp_equals(const owl_timestamp *const d1,
|
||||||
const owl_timestamp *const d2) ;
|
const owl_timestamp *const d2) ;
|
||||||
owl_bool owl_timestamp_is_null(const owl_timestamp *const d) ;
|
bool owl_timestamp_is_null(const owl_timestamp *const d) ;
|
||||||
uint64_t owl_timestamp_to_ms(const owl_timestamp *const d) ;
|
uint64_t owl_timestamp_to_ms(const owl_timestamp *const d) ;
|
||||||
void owl_timestamp_to_string(const owl_timestamp *const src,
|
void owl_timestamp_to_string(const owl_timestamp *const src,
|
||||||
char *const dst) ;
|
char *const dst) ;
|
||||||
|
|
|
@ -84,7 +84,7 @@ int main(int argc, char **argv)
|
||||||
uint_fast16_t listening_port ;
|
uint_fast16_t listening_port ;
|
||||||
int sockfd = -1 ; // UDP listening socket
|
int sockfd = -1 ; // UDP listening socket
|
||||||
|
|
||||||
owl_run = owl_true ;
|
owl_run = true ;
|
||||||
|
|
||||||
program_name = argv[0] ;
|
program_name = argv[0] ;
|
||||||
ret = initialise_configuration(argc, argv) ;
|
ret = initialise_configuration(argc, argv) ;
|
||||||
|
@ -298,18 +298,18 @@ int parse_config_file(int argc, char **argv)
|
||||||
if (! config_file)
|
if (! config_file)
|
||||||
{
|
{
|
||||||
perror("Cannot allocate memory") ;
|
perror("Cannot allocate memory") ;
|
||||||
owl_run = owl_false ;
|
owl_run = false ;
|
||||||
return errno ;
|
return errno ;
|
||||||
}
|
}
|
||||||
strcpy(config_file, optarg) ;
|
strcpy(config_file, optarg) ;
|
||||||
break ;
|
break ;
|
||||||
case 'h' :
|
case 'h' :
|
||||||
print_usage() ;
|
print_usage() ;
|
||||||
owl_run = owl_false ;
|
owl_run = false ;
|
||||||
return EXIT_SUCCESS ;
|
return EXIT_SUCCESS ;
|
||||||
case 'V' :
|
case 'V' :
|
||||||
print_version() ;
|
print_version() ;
|
||||||
owl_run = owl_false ;
|
owl_run = false ;
|
||||||
return EXIT_SUCCESS ;
|
return EXIT_SUCCESS ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -322,7 +322,7 @@ int parse_config_file(int argc, char **argv)
|
||||||
if (! config_file)
|
if (! config_file)
|
||||||
{
|
{
|
||||||
perror("Cannot allocate memory") ;
|
perror("Cannot allocate memory") ;
|
||||||
owl_run = owl_false ;
|
owl_run = false ;
|
||||||
return errno ;
|
return errno ;
|
||||||
}
|
}
|
||||||
strcpy(config_file, DEFAULT_CONFIG_FILE) ;
|
strcpy(config_file, DEFAULT_CONFIG_FILE) ;
|
||||||
|
@ -342,7 +342,7 @@ int parse_config_file(int argc, char **argv)
|
||||||
"Error! Parsing of configuration file \"%s\" failed!\n",
|
"Error! Parsing of configuration file \"%s\" failed!\n",
|
||||||
config_file) ;
|
config_file) ;
|
||||||
free(config_file) ;
|
free(config_file) ;
|
||||||
owl_run = owl_false ;
|
owl_run = false ;
|
||||||
return OWL_ERR_CONFIG_FILE ;
|
return OWL_ERR_CONFIG_FILE ;
|
||||||
}
|
}
|
||||||
free(config_file) ;
|
free(config_file) ;
|
||||||
|
@ -415,7 +415,7 @@ int parse_command_line(int argc, char **argv)
|
||||||
break ;
|
break ;
|
||||||
default :
|
default :
|
||||||
print_usage() ;
|
print_usage() ;
|
||||||
owl_run = owl_false ;
|
owl_run = false ;
|
||||||
return OWL_ERR_BAD_USAGE ;
|
return OWL_ERR_BAD_USAGE ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -431,7 +431,7 @@ int check_configuration()
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error! You must specify an output file.\n") ;
|
fprintf(stderr, "Error! You must specify an output file.\n") ;
|
||||||
print_usage() ;
|
print_usage() ;
|
||||||
owl_run = owl_false ;
|
owl_run = false ;
|
||||||
return OWL_ERR_BAD_USAGE ;
|
return OWL_ERR_BAD_USAGE ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -461,7 +461,7 @@ int check_configuration()
|
||||||
fprintf(stderr, "Error! You must specify the IP address of the"
|
fprintf(stderr, "Error! You must specify the IP address of the"
|
||||||
" localisation server.\n") ;
|
" localisation server.\n") ;
|
||||||
print_usage() ;
|
print_usage() ;
|
||||||
owl_run = owl_false ;
|
owl_run = false ;
|
||||||
return OWL_ERR_BAD_USAGE ;
|
return OWL_ERR_BAD_USAGE ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -836,7 +836,7 @@ void got_request(owl_captured_request request)
|
||||||
if (! tmp_info)
|
if (! tmp_info)
|
||||||
{
|
{
|
||||||
perror("Cannot allocate memory") ;
|
perror("Cannot allocate memory") ;
|
||||||
owl_run = owl_false ;
|
owl_run = false ;
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -860,7 +860,7 @@ void got_request(owl_captured_request request)
|
||||||
if (! tmp_request)
|
if (! tmp_request)
|
||||||
{
|
{
|
||||||
perror("Cannot allocate memory") ;
|
perror("Cannot allocate memory") ;
|
||||||
owl_run = owl_false ;
|
owl_run = false ;
|
||||||
goto end ;
|
goto end ;
|
||||||
}
|
}
|
||||||
tmp_request->type = request.type ;
|
tmp_request->type = request.type ;
|
||||||
|
@ -929,7 +929,7 @@ void got_request(owl_captured_request request)
|
||||||
if (! tmp_request)
|
if (! tmp_request)
|
||||||
{
|
{
|
||||||
perror("Cannot allocate memory") ;
|
perror("Cannot allocate memory") ;
|
||||||
owl_run = owl_false ;
|
owl_run = false ;
|
||||||
goto end ;
|
goto end ;
|
||||||
}
|
}
|
||||||
tmp_request->type = request.type ;
|
tmp_request->type = request.type ;
|
||||||
|
@ -1127,7 +1127,7 @@ ap_list* add_ap_front(uint8_t mac_addr_bytes[ETHER_ADDR_LEN])
|
||||||
if (! ap)
|
if (! ap)
|
||||||
{
|
{
|
||||||
perror("Cannot allocate memory") ;
|
perror("Cannot allocate memory") ;
|
||||||
owl_run = owl_false ;
|
owl_run = false ;
|
||||||
return NULL ;
|
return NULL ;
|
||||||
}
|
}
|
||||||
memcpy(ap->mac_addr_bytes, mac_addr_bytes, ETHER_ADDR_LEN) ;
|
memcpy(ap->mac_addr_bytes, mac_addr_bytes, ETHER_ADDR_LEN) ;
|
||||||
|
|
|
@ -100,7 +100,7 @@ void print_version(void) ;
|
||||||
|
|
||||||
/* Options */
|
/* Options */
|
||||||
struct {
|
struct {
|
||||||
owl_bool daemon ;
|
bool daemon ;
|
||||||
char dest_ip[INET_ADDRSTRLEN] ; // Destination IP of the packets
|
char dest_ip[INET_ADDRSTRLEN] ; // Destination IP of the packets
|
||||||
uint_fast16_t dest_port ;
|
uint_fast16_t dest_port ;
|
||||||
char iface[IFNAMSIZ + 1] ; // Source network interface
|
char iface[IFNAMSIZ + 1] ; // Source network interface
|
||||||
|
@ -116,7 +116,7 @@ struct {
|
||||||
float y ;
|
float y ;
|
||||||
float z ;
|
float z ;
|
||||||
} options = {
|
} options = {
|
||||||
owl_false, // daemon
|
false, // daemon
|
||||||
"", // dest_ip
|
"", // dest_ip
|
||||||
OWL_DEFAULT_REQUEST_PORT, // dest_port
|
OWL_DEFAULT_REQUEST_PORT, // dest_port
|
||||||
"", // iface
|
"", // iface
|
||||||
|
@ -131,9 +131,9 @@ struct {
|
||||||
|
|
||||||
char *program_name = NULL ;
|
char *program_name = NULL ;
|
||||||
|
|
||||||
// owl_true if the packet is a calibration request, owl_false if it is
|
// true if the packet is a calibration request, false if it is
|
||||||
// a simple positioning request:
|
// a simple positioning request:
|
||||||
owl_bool is_calibration_request = owl_false ;
|
bool is_calibration_request = false ;
|
||||||
|
|
||||||
int sockfd ; // Sending socket descriptor
|
int sockfd ; // Sending socket descriptor
|
||||||
struct sockaddr_in server ; // Server info
|
struct sockaddr_in server ; // Server info
|
||||||
|
@ -218,7 +218,7 @@ void parse_main_options(int argc, char **argv)
|
||||||
switch (opt)
|
switch (opt)
|
||||||
{
|
{
|
||||||
case 'D' :
|
case 'D' :
|
||||||
options.daemon = owl_true ;
|
options.daemon = true ;
|
||||||
break ;
|
break ;
|
||||||
case 'F' :
|
case 'F' :
|
||||||
/* Facultative getopt options do not handle separated values
|
/* Facultative getopt options do not handle separated values
|
||||||
|
@ -327,7 +327,7 @@ void parse_calibration_data(int argc, char **argv)
|
||||||
{
|
{
|
||||||
if (argc - optind == 4)
|
if (argc - optind == 4)
|
||||||
{
|
{
|
||||||
is_calibration_request = owl_true ;
|
is_calibration_request = 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) ;
|
||||||
|
@ -449,7 +449,7 @@ void check_configuration()
|
||||||
" the foreground if the flood mode is not activated"
|
" the foreground if the flood mode is not activated"
|
||||||
" Option -D ignored.\n") ;
|
" Option -D ignored.\n") ;
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
options.daemon = owl_false ;
|
options.daemon = false ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -234,7 +234,7 @@ void extract_packet_numbers(const u_char *pkt_data,
|
||||||
owl_captured_request *request) ;
|
owl_captured_request *request) ;
|
||||||
void extract_radiotap_data(const u_char *pkt_data,
|
void extract_radiotap_data(const u_char *pkt_data,
|
||||||
owl_captured_request *request,
|
owl_captured_request *request,
|
||||||
owl_bool rtap_fields[15]) ;
|
bool rtap_fields[15]) ;
|
||||||
uint_fast16_t nat_align(uint_fast16_t offset, uint_fast8_t field_len) ;
|
uint_fast16_t nat_align(uint_fast16_t offset, uint_fast8_t field_len) ;
|
||||||
void get_mac_addr(char *eth, uint8_t mac_bytes[ETHER_ADDR_LEN]) ;
|
void get_mac_addr(char *eth, uint8_t mac_bytes[ETHER_ADDR_LEN]) ;
|
||||||
void get_ip_addr(char *eth, char *ip_bytes) ;
|
void get_ip_addr(char *eth, char *ip_bytes) ;
|
||||||
|
@ -365,9 +365,9 @@ void print_version(void) ;
|
||||||
/* Home-made structure macros */
|
/* Home-made structure macros */
|
||||||
#else // USE_CONFIG_FILE
|
#else // USE_CONFIG_FILE
|
||||||
#define SET_DAEMON() \
|
#define SET_DAEMON() \
|
||||||
(options.daemon = owl_true)
|
(options.daemon = true)
|
||||||
#define UNSET_DAEMON() \
|
#define UNSET_DAEMON() \
|
||||||
(options.daemon = owl_false)
|
(options.daemon = false)
|
||||||
#define GET_DAEMON() \
|
#define GET_DAEMON() \
|
||||||
(options.daemon)
|
(options.daemon)
|
||||||
#define SET_MODE(MODE) \
|
#define SET_MODE(MODE) \
|
||||||
|
@ -380,9 +380,9 @@ void print_version(void) ;
|
||||||
(options.aggregation_ip)
|
(options.aggregation_ip)
|
||||||
#ifdef ENABLE_KEEP_MONITOR
|
#ifdef ENABLE_KEEP_MONITOR
|
||||||
#define SET_KEEP_MONITOR() \
|
#define SET_KEEP_MONITOR() \
|
||||||
(options.keep_monitor = owl_true)
|
(options.keep_monitor = true)
|
||||||
#define UNSET_KEEP_MONITOR() \
|
#define UNSET_KEEP_MONITOR() \
|
||||||
(options.keep_monitor = owl_false)
|
(options.keep_monitor = false)
|
||||||
#define GET_KEEP_MONITOR() \
|
#define GET_KEEP_MONITOR() \
|
||||||
(options.keep_monitor)
|
(options.keep_monitor)
|
||||||
#endif // ENABLE_KEEP_MONITOR
|
#endif // ENABLE_KEEP_MONITOR
|
||||||
|
@ -416,9 +416,9 @@ void print_version(void) ;
|
||||||
|
|
||||||
#ifdef USE_PTHREAD
|
#ifdef USE_PTHREAD
|
||||||
#define SET_AUTOCALIBRATION() \
|
#define SET_AUTOCALIBRATION() \
|
||||||
(options.autocalibration = owl_true)
|
(options.autocalibration = true)
|
||||||
#define UNSET_AUTOCALIBRATION() \
|
#define UNSET_AUTOCALIBRATION() \
|
||||||
(options.autocalibration = owl_false)
|
(options.autocalibration = false)
|
||||||
#define GET_AUTOCALIBRATION() \
|
#define GET_AUTOCALIBRATION() \
|
||||||
(options.autocalibration)
|
(options.autocalibration)
|
||||||
#define SET_AUTOCALIBRATION_IP(IP) \
|
#define SET_AUTOCALIBRATION_IP(IP) \
|
||||||
|
|
|
@ -88,8 +88,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 ;
|
||||||
// owl_true if the coordinates of the listener were provided by the user:
|
// true if the coordinates of the listener were provided by the user:
|
||||||
owl_bool coordinates_provided = owl_false ;
|
bool coordinates_provided = false ;
|
||||||
#endif // USE_PTHREAD
|
#endif // USE_PTHREAD
|
||||||
|
|
||||||
#ifdef USE_CONFIG_FILE
|
#ifdef USE_CONFIG_FILE
|
||||||
|
@ -100,19 +100,19 @@ cfg_t *cfg = NULL ; // Configuration structure
|
||||||
* options.
|
* options.
|
||||||
*/
|
*/
|
||||||
struct {
|
struct {
|
||||||
owl_bool daemon ;
|
bool daemon ;
|
||||||
char mode ;
|
char mode ;
|
||||||
char aggregation_ip[INET_ADDRSTRLEN] ;
|
char aggregation_ip[INET_ADDRSTRLEN] ;
|
||||||
uint_fast16_t aggregation_port ;
|
uint_fast16_t aggregation_port ;
|
||||||
uint_fast16_t listening_port ;
|
uint_fast16_t listening_port ;
|
||||||
#ifdef ENABLE_KEEP_MONITOR
|
#ifdef ENABLE_KEEP_MONITOR
|
||||||
owl_bool keep_monitor ;
|
bool keep_monitor ;
|
||||||
#endif // ENABLE_KEEP_MONITOR
|
#endif // ENABLE_KEEP_MONITOR
|
||||||
char rtap_iface[IFNAMSIZ + 1] ;
|
char rtap_iface[IFNAMSIZ + 1] ;
|
||||||
char *pcap_file ;
|
char *pcap_file ;
|
||||||
char wifi_iface[IFNAMSIZ + 1] ;
|
char wifi_iface[IFNAMSIZ + 1] ;
|
||||||
#ifdef USE_PTHREAD
|
#ifdef USE_PTHREAD
|
||||||
owl_bool autocalibration ;
|
bool autocalibration ;
|
||||||
char autocalibration_ip[INET_ADDRSTRLEN] ;
|
char autocalibration_ip[INET_ADDRSTRLEN] ;
|
||||||
uint_fast16_t autocalibration_request_port ;
|
uint_fast16_t autocalibration_request_port ;
|
||||||
uint_fast16_t autocalibration_order_port ;
|
uint_fast16_t autocalibration_order_port ;
|
||||||
|
@ -127,19 +127,19 @@ struct {
|
||||||
#endif // USE_PTHREAD
|
#endif // USE_PTHREAD
|
||||||
uint_fast8_t verbose ;
|
uint_fast8_t verbose ;
|
||||||
} options = { // Initalise default options:
|
} options = { // Initalise default options:
|
||||||
owl_false, // daemon
|
false, // daemon
|
||||||
MODE_ACTIVE, // mode
|
MODE_ACTIVE, // mode
|
||||||
"127.0.0.1", // aggregation_ip
|
"127.0.0.1", // aggregation_ip
|
||||||
OWL_DEFAULT_LISTENER_PORT, // aggregation_port
|
OWL_DEFAULT_LISTENER_PORT, // aggregation_port
|
||||||
OWL_DEFAULT_REQUEST_PORT, // listening_port
|
OWL_DEFAULT_REQUEST_PORT, // listening_port
|
||||||
#ifdef ENABLE_KEEP_MONITOR
|
#ifdef ENABLE_KEEP_MONITOR
|
||||||
owl_false, // keep_monitor
|
false, // keep_monitor
|
||||||
#endif // ENABLE_KEEP_MONITOR
|
#endif // ENABLE_KEEP_MONITOR
|
||||||
"", // rtap_iface
|
"", // rtap_iface
|
||||||
NULL, // pcap_file
|
NULL, // pcap_file
|
||||||
"", // wifi_iface
|
"", // wifi_iface
|
||||||
#ifdef USE_PTHREAD
|
#ifdef USE_PTHREAD
|
||||||
owl_false, // autocalibration
|
false, // autocalibration
|
||||||
"", // autocalibration_ip
|
"", // autocalibration_ip
|
||||||
0, // autocalibration_request_port
|
0, // autocalibration_request_port
|
||||||
OWL_DEFAULT_AUTOCALIBRATION_ORDER_PORT, // autocalibration_order_port
|
OWL_DEFAULT_AUTOCALIBRATION_ORDER_PORT, // autocalibration_order_port
|
||||||
|
@ -168,7 +168,7 @@ int main(int argc, char *argv[])
|
||||||
pthread_t keep_monitor_thread ;
|
pthread_t keep_monitor_thread ;
|
||||||
#endif // ENABLE_KEEP_MONITOR
|
#endif // ENABLE_KEEP_MONITOR
|
||||||
|
|
||||||
owl_run = owl_true ;
|
owl_run = true ;
|
||||||
|
|
||||||
program_name = argv[0] ;
|
program_name = argv[0] ;
|
||||||
ret = initialise_configuration(argc, argv) ;
|
ret = initialise_configuration(argc, argv) ;
|
||||||
|
@ -425,7 +425,7 @@ int parse_config_file(int argc, char **argv)
|
||||||
if (! config_file)
|
if (! config_file)
|
||||||
{
|
{
|
||||||
perror("Cannot allocate memory") ;
|
perror("Cannot allocate memory") ;
|
||||||
owl_run = owl_false ;
|
owl_run = false ;
|
||||||
return errno ;
|
return errno ;
|
||||||
}
|
}
|
||||||
strcpy(config_file, optarg) ;
|
strcpy(config_file, optarg) ;
|
||||||
|
@ -438,11 +438,11 @@ int parse_config_file(int argc, char **argv)
|
||||||
break ;
|
break ;
|
||||||
case 'h' :
|
case 'h' :
|
||||||
print_usage() ;
|
print_usage() ;
|
||||||
owl_run = owl_false ;
|
owl_run = false ;
|
||||||
return EXIT_SUCCESS ;
|
return EXIT_SUCCESS ;
|
||||||
case 'V' :
|
case 'V' :
|
||||||
print_version() ;
|
print_version() ;
|
||||||
owl_run = owl_false ;
|
owl_run = false ;
|
||||||
return EXIT_SUCCESS ;
|
return EXIT_SUCCESS ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -456,7 +456,7 @@ int parse_config_file(int argc, char **argv)
|
||||||
if (! config_file)
|
if (! config_file)
|
||||||
{
|
{
|
||||||
perror("Cannot allocate memory") ;
|
perror("Cannot allocate memory") ;
|
||||||
owl_run = owl_false ;
|
owl_run = false ;
|
||||||
return errno ;
|
return errno ;
|
||||||
}
|
}
|
||||||
strcpy(config_file, DEFAULT_CONFIG_FILE) ;
|
strcpy(config_file, DEFAULT_CONFIG_FILE) ;
|
||||||
|
@ -476,7 +476,7 @@ int parse_config_file(int argc, char **argv)
|
||||||
"Error! Parsing of configuration file \"%s\" failed!\n",
|
"Error! Parsing of configuration file \"%s\" failed!\n",
|
||||||
config_file) ;
|
config_file) ;
|
||||||
free(config_file) ;
|
free(config_file) ;
|
||||||
owl_run = owl_false ;
|
owl_run = false ;
|
||||||
return OWL_ERR_CONFIG_FILE ;
|
return OWL_ERR_CONFIG_FILE ;
|
||||||
}
|
}
|
||||||
free(config_file) ;
|
free(config_file) ;
|
||||||
|
@ -605,7 +605,7 @@ int parse_main_options(int argc, char **argv)
|
||||||
break ;
|
break ;
|
||||||
default :
|
default :
|
||||||
print_usage() ;
|
print_usage() ;
|
||||||
owl_run = owl_false ;
|
owl_run = false ;
|
||||||
return OWL_ERR_BAD_USAGE ;
|
return OWL_ERR_BAD_USAGE ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -623,7 +623,7 @@ int parse_calibration_data(int argc, char **argv)
|
||||||
{
|
{
|
||||||
if (argc - optind == 4)
|
if (argc - optind == 4)
|
||||||
{
|
{
|
||||||
coordinates_provided = owl_true ;
|
coordinates_provided = 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)) ;
|
||||||
|
@ -632,7 +632,7 @@ int parse_calibration_data(int argc, char **argv)
|
||||||
else // Bad number of arguments
|
else // Bad number of arguments
|
||||||
{
|
{
|
||||||
print_usage() ;
|
print_usage() ;
|
||||||
owl_run = owl_false ;
|
owl_run = false ;
|
||||||
return OWL_ERR_BAD_USAGE ;
|
return OWL_ERR_BAD_USAGE ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -655,7 +655,7 @@ int check_configuration()
|
||||||
default :
|
default :
|
||||||
fprintf(stderr, "Error! Unknown mode \"%c\".\n", (char) GET_MODE()) ;
|
fprintf(stderr, "Error! Unknown mode \"%c\".\n", (char) GET_MODE()) ;
|
||||||
print_usage() ;
|
print_usage() ;
|
||||||
owl_run = owl_false ;
|
owl_run = false ;
|
||||||
return OWL_ERR_BAD_USAGE ;
|
return OWL_ERR_BAD_USAGE ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -704,7 +704,7 @@ int check_configuration()
|
||||||
fprintf(stderr, "Error! You must specify either a radiotap"
|
fprintf(stderr, "Error! You must specify either a radiotap"
|
||||||
" interface or a pcap file to read packets from.\n") ;
|
" interface or a pcap file to read packets from.\n") ;
|
||||||
print_usage() ;
|
print_usage() ;
|
||||||
owl_run = owl_false ;
|
owl_run = false ;
|
||||||
return OWL_ERR_BAD_USAGE ;
|
return OWL_ERR_BAD_USAGE ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -953,7 +953,7 @@ int capture()
|
||||||
case 0: // timeout reached
|
case 0: // timeout reached
|
||||||
break ;
|
break ;
|
||||||
case -2: // no more packet to read from input file
|
case -2: // no more packet to read from input file
|
||||||
owl_run = owl_false ;
|
owl_run = false ;
|
||||||
break ;
|
break ;
|
||||||
case -1: // an error occured
|
case -1: // an error occured
|
||||||
pcap_perror(capture_handler, "Error during capture") ;
|
pcap_perror(capture_handler, "Error during capture") ;
|
||||||
|
@ -977,7 +977,7 @@ void read_packet(const struct pcap_pkthdr *pkt_header,
|
||||||
owl_captured_request request ; // Message to send to the aggregator
|
owl_captured_request request ; // Message to send to the aggregator
|
||||||
uint16_t rtap_bytes ; // Radiotap header size
|
uint16_t rtap_bytes ; // Radiotap header size
|
||||||
uint_fast16_t offset ; // Offset to read the packet
|
uint_fast16_t offset ; // Offset to read the packet
|
||||||
owl_bool rtap_fields[15] ; // Present flags
|
bool rtap_fields[15] ; // Present flags
|
||||||
uint8_t raw_packet_fc1 ; // First byte of the received frame's FC
|
uint8_t raw_packet_fc1 ; // First byte of the received frame's FC
|
||||||
uint8_t raw_packet_fc2 ; // Second byte of the received frame's FC
|
uint8_t raw_packet_fc2 ; // Second byte of the received frame's FC
|
||||||
// Size of the IEEE 802.11 header:
|
// Size of the IEEE 802.11 header:
|
||||||
|
@ -989,9 +989,9 @@ void read_packet(const struct pcap_pkthdr *pkt_header,
|
||||||
struct udphdr *packet_udp_header = NULL ;
|
struct udphdr *packet_udp_header = NULL ;
|
||||||
// Localisation request type (request, calibration, autocalibration):
|
// Localisation request type (request, calibration, autocalibration):
|
||||||
// Is the packet an explicit request?
|
// Is the packet an explicit request?
|
||||||
owl_bool is_explicit_packet = owl_true ;
|
bool is_explicit_packet = true ;
|
||||||
// Is the packet an autocalibration positioning request?
|
// Is the packet an autocalibration positioning request?
|
||||||
owl_bool uses_autocalibration_request_port = owl_false ;
|
bool uses_autocalibration_request_port = false ;
|
||||||
ssize_t nsent ; // sendto return value
|
ssize_t nsent ; // sendto return value
|
||||||
|
|
||||||
// Blank the request:
|
// Blank the request:
|
||||||
|
@ -1064,7 +1064,7 @@ void read_packet(const struct pcap_pkthdr *pkt_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 = owl_true ;
|
uses_autocalibration_request_port = 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())
|
||||||
|
@ -1076,7 +1076,7 @@ void read_packet(const struct pcap_pkthdr *pkt_header,
|
||||||
not_explicit_packet :
|
not_explicit_packet :
|
||||||
if (GET_MODE() == MODE_ACTIVE)
|
if (GET_MODE() == MODE_ACTIVE)
|
||||||
return ;
|
return ;
|
||||||
is_explicit_packet = owl_false ;
|
is_explicit_packet = false ;
|
||||||
|
|
||||||
process_packet :
|
process_packet :
|
||||||
|
|
||||||
|
@ -1281,11 +1281,11 @@ void extract_packet_numbers(const u_char *pkt_data,
|
||||||
/*
|
/*
|
||||||
* Fills 'request' with the required data extracted from the Radiotap
|
* Fills 'request' with the required data extracted from the Radiotap
|
||||||
* header of 'pkt_data'. The elements of 'rtap_fields' are set to
|
* header of 'pkt_data'. The elements of 'rtap_fields' are set to
|
||||||
* owl_true when the corresponding Radiotap flag is found in the packet.
|
* true when the corresponding Radiotap flag is found in the packet.
|
||||||
*/
|
*/
|
||||||
void extract_radiotap_data(const u_char *pkt_data,
|
void extract_radiotap_data(const u_char *pkt_data,
|
||||||
owl_captured_request *request,
|
owl_captured_request *request,
|
||||||
owl_bool rtap_fields[15])
|
bool rtap_fields[15])
|
||||||
{
|
{
|
||||||
uint32_t rtap_presentflags ;
|
uint32_t rtap_presentflags ;
|
||||||
uint_fast16_t rtap_position ;
|
uint_fast16_t rtap_position ;
|
||||||
|
@ -1298,7 +1298,7 @@ void extract_radiotap_data(const u_char *pkt_data,
|
||||||
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] = owl_false ;
|
rtap_fields[i] = 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
|
||||||
|
@ -1310,19 +1310,19 @@ void extract_radiotap_data(const u_char *pkt_data,
|
||||||
switch(i)
|
switch(i)
|
||||||
{
|
{
|
||||||
case RTAP_MACTS:
|
case RTAP_MACTS:
|
||||||
rtap_fields[RTAP_MACTS] = owl_true ;
|
rtap_fields[RTAP_MACTS] = true ;
|
||||||
rtap_position += SKIP_FIELD(rtap_position, RTAP_L_MACTS) ;
|
rtap_position += SKIP_FIELD(rtap_position, RTAP_L_MACTS) ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_FLAGS:
|
case RTAP_FLAGS:
|
||||||
rtap_fields[RTAP_FLAGS] = owl_true;
|
rtap_fields[RTAP_FLAGS] = true;
|
||||||
rtap_position += SKIP_FIELD(rtap_position, RTAP_L_FLAGS) ;
|
rtap_position += SKIP_FIELD(rtap_position, RTAP_L_FLAGS) ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_RATE:
|
case RTAP_RATE:
|
||||||
rtap_fields[RTAP_RATE] = owl_true;
|
rtap_fields[RTAP_RATE] = true;
|
||||||
rtap_position += SKIP_FIELD(rtap_position, RTAP_L_RATE) ;
|
rtap_position += SKIP_FIELD(rtap_position, RTAP_L_RATE) ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_CHANNEL:
|
case RTAP_CHANNEL:
|
||||||
rtap_fields[RTAP_CHANNEL] = owl_true ;
|
rtap_fields[RTAP_CHANNEL] = true ;
|
||||||
// The channel field is actually two fields that must be
|
// The channel field is actually two fields that must be
|
||||||
// aligned independently
|
// aligned independently
|
||||||
rtap_position += SKIP_FIELD(rtap_position, RTAP_L_CHANNEL) ;
|
rtap_position += SKIP_FIELD(rtap_position, RTAP_L_CHANNEL) ;
|
||||||
|
@ -1330,11 +1330,11 @@ void extract_radiotap_data(const u_char *pkt_data,
|
||||||
RTAP_L_CHANNELTYPE) ;
|
RTAP_L_CHANNELTYPE) ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_FHSS:
|
case RTAP_FHSS:
|
||||||
rtap_fields[RTAP_FHSS] = owl_true;
|
rtap_fields[RTAP_FHSS] = true;
|
||||||
rtap_position += SKIP_FIELD(rtap_position, RTAP_L_FHSS) ;
|
rtap_position += SKIP_FIELD(rtap_position, RTAP_L_FHSS) ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_ANTENNASIGNALDBM:
|
case RTAP_ANTENNASIGNALDBM:
|
||||||
rtap_fields[RTAP_ANTENNASIGNALDBM] = owl_true ;
|
rtap_fields[RTAP_ANTENNASIGNALDBM] = true ;
|
||||||
rtap_position += nat_align(rtap_position,
|
rtap_position += nat_align(rtap_position,
|
||||||
RTAP_L_ANTENNASIGNALDBM) ;
|
RTAP_L_ANTENNASIGNALDBM) ;
|
||||||
memcpy(&request->ss_dbm,
|
memcpy(&request->ss_dbm,
|
||||||
|
@ -1344,46 +1344,46 @@ void extract_radiotap_data(const u_char *pkt_data,
|
||||||
rtap_position += RTAP_L_ANTENNASIGNALDBM ;
|
rtap_position += RTAP_L_ANTENNASIGNALDBM ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_ANTENNANOISEDBM:
|
case RTAP_ANTENNANOISEDBM:
|
||||||
rtap_fields[RTAP_ANTENNANOISEDBM] = owl_true;
|
rtap_fields[RTAP_ANTENNANOISEDBM] = true;
|
||||||
rtap_position += SKIP_FIELD(rtap_position,
|
rtap_position += SKIP_FIELD(rtap_position,
|
||||||
RTAP_L_ANTENNANOISEDBM) ;
|
RTAP_L_ANTENNANOISEDBM) ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_LOCKQUALITY:
|
case RTAP_LOCKQUALITY:
|
||||||
rtap_fields[RTAP_LOCKQUALITY] = owl_true;
|
rtap_fields[RTAP_LOCKQUALITY] = true;
|
||||||
rtap_position += SKIP_FIELD(rtap_position,
|
rtap_position += SKIP_FIELD(rtap_position,
|
||||||
RTAP_L_LOCKQUALITY) ;
|
RTAP_L_LOCKQUALITY) ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_TXATTENUATION:
|
case RTAP_TXATTENUATION:
|
||||||
rtap_fields[RTAP_TXATTENUATION] = owl_true;
|
rtap_fields[RTAP_TXATTENUATION] = true;
|
||||||
rtap_position += SKIP_FIELD(rtap_position,
|
rtap_position += SKIP_FIELD(rtap_position,
|
||||||
RTAP_L_TXATTENUATION) ;
|
RTAP_L_TXATTENUATION) ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_TXATTENUATIONDB:
|
case RTAP_TXATTENUATIONDB:
|
||||||
rtap_fields[RTAP_TXATTENUATIONDB] = owl_true;
|
rtap_fields[RTAP_TXATTENUATIONDB] = true;
|
||||||
rtap_position += SKIP_FIELD(rtap_position,
|
rtap_position += SKIP_FIELD(rtap_position,
|
||||||
RTAP_L_TXATTENUATIONDB) ;
|
RTAP_L_TXATTENUATIONDB) ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_TXATTENUATIONDBM:
|
case RTAP_TXATTENUATIONDBM:
|
||||||
rtap_fields[RTAP_TXATTENUATIONDBM] = owl_true;
|
rtap_fields[RTAP_TXATTENUATIONDBM] = true;
|
||||||
rtap_position += SKIP_FIELD(rtap_position,
|
rtap_position += SKIP_FIELD(rtap_position,
|
||||||
RTAP_L_TXATTENUATIONDBM) ;
|
RTAP_L_TXATTENUATIONDBM) ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_ANTENNA:
|
case RTAP_ANTENNA:
|
||||||
rtap_fields[RTAP_ANTENNA] = owl_true;
|
rtap_fields[RTAP_ANTENNA] = true;
|
||||||
rtap_position += SKIP_FIELD(rtap_position, RTAP_L_ANTENNA) ;
|
rtap_position += SKIP_FIELD(rtap_position, RTAP_L_ANTENNA) ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_ANTENNASIGNALDB:
|
case RTAP_ANTENNASIGNALDB:
|
||||||
rtap_fields[RTAP_ANTENNASIGNALDB] = owl_true;
|
rtap_fields[RTAP_ANTENNASIGNALDB] = true;
|
||||||
rtap_position += SKIP_FIELD(rtap_position,
|
rtap_position += SKIP_FIELD(rtap_position,
|
||||||
RTAP_L_ANTENNASIGNALDB) ;
|
RTAP_L_ANTENNASIGNALDB) ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_ANTENNANOISEDB:
|
case RTAP_ANTENNANOISEDB:
|
||||||
rtap_fields[RTAP_ANTENNANOISEDB] = owl_true;
|
rtap_fields[RTAP_ANTENNANOISEDB] = true;
|
||||||
rtap_position += SKIP_FIELD(rtap_position,
|
rtap_position += SKIP_FIELD(rtap_position,
|
||||||
RTAP_L_ANTENNANOISEDB) ;
|
RTAP_L_ANTENNANOISEDB) ;
|
||||||
break ;
|
break ;
|
||||||
case RTAP_FCS:
|
case RTAP_FCS:
|
||||||
rtap_fields[RTAP_FCS] = owl_true;
|
rtap_fields[RTAP_FCS] = true;
|
||||||
rtap_position += SKIP_FIELD(rtap_position, RTAP_L_FCS) ;
|
rtap_position += SKIP_FIELD(rtap_position, RTAP_L_FCS) ;
|
||||||
break ;
|
break ;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -58,7 +58,7 @@ using namespace std ;
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
owl_run = owl_true ;
|
owl_run = true ;
|
||||||
|
|
||||||
/* Read options & configuration */
|
/* Read options & configuration */
|
||||||
delete new UserInterface(argc, argv) ;
|
delete new UserInterface(argc, argv) ;
|
||||||
|
|
|
@ -435,14 +435,14 @@ void UserInterface::print_information() const
|
||||||
"unknown version"
|
"unknown version"
|
||||||
#endif // OWLPS_VERSION
|
#endif // OWLPS_VERSION
|
||||||
<< ".\n" ;
|
<< ".\n" ;
|
||||||
owl_run = owl_false ; // Tell main() to exit
|
owl_run = false ; // Tell main() to exit
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print usage if requested
|
// Print usage if requested
|
||||||
if (Configuration::is_configured("help"))
|
if (Configuration::is_configured("help"))
|
||||||
{
|
{
|
||||||
cout << *cli_options ;
|
cout << *cli_options ;
|
||||||
owl_run = owl_false ; // Tell main() to exit
|
owl_run = false ; // Tell main() to exit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ int main(int argc, char *argv[])
|
||||||
pthread_t tcp_server_thread ;
|
pthread_t tcp_server_thread ;
|
||||||
|
|
||||||
program_name = argv[0] ;
|
program_name = argv[0] ;
|
||||||
owl_run = owl_true ;
|
owl_run = true ;
|
||||||
|
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
|
@ -228,7 +228,7 @@ void store_result(owl_result *new_result)
|
||||||
if (! results)
|
if (! results)
|
||||||
{
|
{
|
||||||
perror("Cannot allocate memory") ;
|
perror("Cannot allocate memory") ;
|
||||||
owl_run = owl_false ;
|
owl_run = false ;
|
||||||
goto end ;
|
goto end ;
|
||||||
}
|
}
|
||||||
++nb_results ;
|
++nb_results ;
|
||||||
|
@ -256,7 +256,7 @@ void store_result(owl_result *new_result)
|
||||||
if (! res)
|
if (! res)
|
||||||
{
|
{
|
||||||
perror("Cannot allocate memory") ;
|
perror("Cannot allocate memory") ;
|
||||||
owl_run = owl_false ;
|
owl_run = false ;
|
||||||
goto end ;
|
goto end ;
|
||||||
}
|
}
|
||||||
++nb_results ;
|
++nb_results ;
|
||||||
|
@ -329,7 +329,7 @@ void* tcp_server(void *NULL_value)
|
||||||
if (! answer_buflen)
|
if (! answer_buflen)
|
||||||
{
|
{
|
||||||
perror("Cannot allocate memory") ;
|
perror("Cannot allocate memory") ;
|
||||||
owl_run = owl_false ;
|
owl_run = false ;
|
||||||
return NULL ;
|
return NULL ;
|
||||||
}
|
}
|
||||||
strncpy(answer, ANSWER_HDR, ANSWER_HDR_STRLEN) ;
|
strncpy(answer, ANSWER_HDR, ANSWER_HDR_STRLEN) ;
|
||||||
|
|
Loading…
Reference in New Issue