[Listener] Fix compilation without USE_PTHREAD

This commit is contained in:
Matteo Cypriani 2011-06-24 15:38:07 +02:00
parent 35e787064b
commit 3ac53e7b76
2 changed files with 18 additions and 3 deletions

View File

@ -66,7 +66,9 @@ void initialise_configuration(int argc, char **argv) ;
void parse_config_file(int argc, char **argv) ;
void parse_command_line(int argc, char **argv) ;
void parse_main_options(int argc, char **argv) ;
#ifdef USE_PTHREAD
void parse_calibration_data(int argc, char **argv) ;
#endif // USE_PTHREAD
void check_configuration(void) ;
#ifdef DEBUG
void print_configuration(void) ;

View File

@ -176,6 +176,7 @@ int main(int argc, char *argv[])
/* Wait for the threads to terminate */
#ifdef USE_PTHREAD
if (GET_KEEP_MONITOR())
{
fprintf(stderr, "Waiting for the keep mode monitor thread... ") ;
@ -219,6 +220,10 @@ int main(int argc, char *argv[])
else
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 */
exit:
@ -372,7 +377,9 @@ void parse_config_file(int argc, char **argv)
void parse_command_line(int argc, char **argv)
{
parse_main_options(argc, argv) ;
#ifdef USE_PTHREAD
parse_calibration_data(argc, argv) ;
#endif // USE_PTHREAD
}
@ -410,7 +417,9 @@ void parse_main_options(int argc, char **argv)
SET_AGGREGATION_IP(optarg) ;
break ;
case 'D' :
#ifdef USE_PTHREAD
SET_AUTOCALIBRATION_IP(optarg) ;
#endif // USE_PTHREAD
break ;
case 'f' : // Config file
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)
{
/* 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)] ;
dest_port = ntohs(packet_udp_header->dest) ;
#ifdef USE_PTHREAD
if (GET_AUTOCALIBRATION() && dest_port ==
(uint_fast16_t) GET_AUTOCALIBRATION_REQUEST_PORT())
uses_autocalibration_request_port = TRUE ;
else if (dest_port != (uint_fast16_t) GET_LISTENING_PORT())
goto not_explicit_packet ;
else
#endif // USE_PTHREAD
if (dest_port != (uint_fast16_t) GET_LISTENING_PORT())
goto not_explicit_packet ;
}
goto process_packet ;