[Listener] Fix compilation without USE_PTHREAD
This commit is contained in:
parent
35e787064b
commit
3ac53e7b76
|
@ -66,7 +66,9 @@ void initialise_configuration(int argc, char **argv) ;
|
||||||
void parse_config_file(int argc, char **argv) ;
|
void parse_config_file(int argc, char **argv) ;
|
||||||
void parse_command_line(int argc, char **argv) ;
|
void parse_command_line(int argc, char **argv) ;
|
||||||
void parse_main_options(int argc, char **argv) ;
|
void parse_main_options(int argc, char **argv) ;
|
||||||
|
#ifdef USE_PTHREAD
|
||||||
void parse_calibration_data(int argc, char **argv) ;
|
void parse_calibration_data(int argc, char **argv) ;
|
||||||
|
#endif // USE_PTHREAD
|
||||||
void check_configuration(void) ;
|
void check_configuration(void) ;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void print_configuration(void) ;
|
void print_configuration(void) ;
|
||||||
|
|
|
@ -176,6 +176,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
/* Wait for the threads to terminate */
|
/* Wait for the threads to terminate */
|
||||||
|
|
||||||
|
#ifdef USE_PTHREAD
|
||||||
if (GET_KEEP_MONITOR())
|
if (GET_KEEP_MONITOR())
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Waiting for the keep mode monitor thread... ") ;
|
fprintf(stderr, "Waiting for the keep mode monitor thread... ") ;
|
||||||
|
@ -219,6 +220,10 @@ int main(int argc, char *argv[])
|
||||||
else
|
else
|
||||||
fprintf(stderr, "OK.\n") ;
|
fprintf(stderr, "OK.\n") ;
|
||||||
}
|
}
|
||||||
|
#else // USE_PTHREAD
|
||||||
|
// Just to avoid a warning when compiling without threads' support:
|
||||||
|
goto exit ;
|
||||||
|
#endif // USE_PTHREAD
|
||||||
|
|
||||||
/* Last cleaning tasks */
|
/* Last cleaning tasks */
|
||||||
exit:
|
exit:
|
||||||
|
@ -372,7 +377,9 @@ void parse_config_file(int argc, char **argv)
|
||||||
void parse_command_line(int argc, char **argv)
|
void parse_command_line(int argc, char **argv)
|
||||||
{
|
{
|
||||||
parse_main_options(argc, argv) ;
|
parse_main_options(argc, argv) ;
|
||||||
|
#ifdef USE_PTHREAD
|
||||||
parse_calibration_data(argc, argv) ;
|
parse_calibration_data(argc, argv) ;
|
||||||
|
#endif // USE_PTHREAD
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -410,7 +417,9 @@ void parse_main_options(int argc, char **argv)
|
||||||
SET_AGGREGATION_IP(optarg) ;
|
SET_AGGREGATION_IP(optarg) ;
|
||||||
break ;
|
break ;
|
||||||
case 'D' :
|
case 'D' :
|
||||||
|
#ifdef USE_PTHREAD
|
||||||
SET_AUTOCALIBRATION_IP(optarg) ;
|
SET_AUTOCALIBRATION_IP(optarg) ;
|
||||||
|
#endif // USE_PTHREAD
|
||||||
break ;
|
break ;
|
||||||
case 'f' : // Config file
|
case 'f' : // Config file
|
||||||
break ; // (already parsed)
|
break ; // (already parsed)
|
||||||
|
@ -481,6 +490,7 @@ void parse_main_options(int argc, char **argv)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef USE_PTHREAD
|
||||||
void parse_calibration_data(int argc, char **argv)
|
void parse_calibration_data(int argc, char **argv)
|
||||||
{
|
{
|
||||||
/* Parse remaining arguments (possible calibration data) */
|
/* Parse remaining arguments (possible calibration data) */
|
||||||
|
@ -501,6 +511,7 @@ void parse_calibration_data(int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif // USE_PTHREAD
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -837,12 +848,14 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header,
|
||||||
LLC_HEADER_SIZE + sizeof(struct iphdr)] ;
|
LLC_HEADER_SIZE + sizeof(struct iphdr)] ;
|
||||||
dest_port = ntohs(packet_udp_header->dest) ;
|
dest_port = ntohs(packet_udp_header->dest) ;
|
||||||
|
|
||||||
|
#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 = TRUE ;
|
||||||
|
else
|
||||||
else if (dest_port != (uint_fast16_t) GET_LISTENING_PORT())
|
#endif // USE_PTHREAD
|
||||||
goto not_explicit_packet ;
|
if (dest_port != (uint_fast16_t) GET_LISTENING_PORT())
|
||||||
|
goto not_explicit_packet ;
|
||||||
}
|
}
|
||||||
|
|
||||||
goto process_packet ;
|
goto process_packet ;
|
||||||
|
|
Loading…
Reference in New Issue