[Aggregator] Write all messages to stderr
Since the aggregated requests can be written to stdout, we must not use it for other messages. Therefore, we now use stderr for all messages.
This commit is contained in:
parent
c87c2e2e93
commit
ddd4e16b70
|
@ -121,7 +121,7 @@ int main(int argc, char **argv)
|
|||
free_ap_list() ;
|
||||
cfg_free(cfg) ; // Clean configuration
|
||||
|
||||
printf("%s: end.\n", program_name) ;
|
||||
fprintf(stderr, "%s: end.\n", program_name) ;
|
||||
return ret ;
|
||||
}
|
||||
|
||||
|
@ -419,7 +419,8 @@ int read_loop(int sockfd)
|
|||
owl_timestamp_to_string(request_time_str,
|
||||
request.request_time) ;
|
||||
owl_timestamp_to_string(start_time_str, request.start_time) ;
|
||||
printf("\n"
|
||||
fprintf(stderr,
|
||||
"\n"
|
||||
"*** Request received from AP ***\n"
|
||||
"\tAP MAC: %s\n"
|
||||
"\tMobile MAC: %s\n"
|
||||
|
@ -533,13 +534,13 @@ void* monitor_requests(void *NULL_value)
|
|||
// If the timeout is reached
|
||||
if (sub > aggregate_timeout)
|
||||
{
|
||||
printf("* Timeout reached.") ;
|
||||
fprintf(stderr, "* Timeout reached.") ;
|
||||
#ifdef DEBUG
|
||||
printf(" sub=%"PRIuFAST32" >"
|
||||
fprintf(stderr, " sub=%"PRIuFAST32" >"
|
||||
" aggregate_timeout=%"PRIuFAST32"\n",
|
||||
sub, aggregate_timeout) ;
|
||||
#else // DEBUG
|
||||
putchar('\n') ;
|
||||
putc('\n', stderr) ;
|
||||
#endif // DEBUG
|
||||
|
||||
// Print mobile MAC address to the output file
|
||||
|
@ -619,13 +620,13 @@ void* monitor_requests(void *NULL_value)
|
|||
{
|
||||
request_list *request_tmp = request_ptr ;
|
||||
|
||||
printf("* Keep timeout reached.") ;
|
||||
fprintf(stderr, "* Keep timeout reached.") ;
|
||||
#ifdef DEBUG
|
||||
printf(" sub=%"PRIuFAST32" >"
|
||||
fprintf(stderr, " sub=%"PRIuFAST32" >"
|
||||
" keep_timeout=%"PRIuFAST32"\n",
|
||||
sub, keep_timeout) ;
|
||||
#else // DEBUG
|
||||
putchar('\n') ;
|
||||
putc('\n', stderr) ;
|
||||
#endif // DEBUG
|
||||
|
||||
request_ptr = request_ptr->next ;
|
||||
|
@ -681,7 +682,7 @@ void got_request(owl_captured_request request)
|
|||
tmp_request = requests ;
|
||||
if (requests == NULL) // If the request list does not exist,
|
||||
{
|
||||
printf("Creating request list.\n") ;
|
||||
fprintf(stderr, "Creating request list.\n") ;
|
||||
tmp_request = malloc(sizeof(request_list)) ; // create it.
|
||||
memcpy(tmp_request->mobile_mac_addr_bytes,
|
||||
request.mobile_mac_addr_bytes, 6) ;
|
||||
|
@ -738,7 +739,7 @@ void got_request(owl_captured_request request)
|
|||
|
||||
if (tmp_request == NULL) // The request does not exist in the list
|
||||
{
|
||||
printf("Create new request.\n") ;
|
||||
fprintf(stderr, "Create new request.\n") ;
|
||||
tmp_request = malloc(sizeof(request_list)) ; // create it
|
||||
memcpy(tmp_request->mobile_mac_addr_bytes,
|
||||
request.mobile_mac_addr_bytes, 6) ;
|
||||
|
@ -765,12 +766,12 @@ void got_request(owl_captured_request request)
|
|||
{
|
||||
if (tmp_request->info == NULL)
|
||||
{ // We already sent to the server data for this request
|
||||
printf("Request already treated.\n") ;
|
||||
fprintf(stderr, "Request already treated.\n") ;
|
||||
free(tmp_info) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Add information to the request.\n") ;
|
||||
fprintf(stderr, "Add information to the request.\n") ;
|
||||
tmp_info->next = tmp_request->info ; // Add data
|
||||
tmp_request->info = tmp_info ;
|
||||
}
|
||||
|
@ -1136,7 +1137,7 @@ void print_request_list()
|
|||
|
||||
if (requests == NULL) // Empty list
|
||||
{
|
||||
printf("No request.\n") ;
|
||||
fprintf(stderr, "No request.\n") ;
|
||||
return ;
|
||||
}
|
||||
|
||||
|
@ -1150,7 +1151,8 @@ void print_request_list()
|
|||
request_ptr->request_time) ;
|
||||
owl_timestamp_to_string(start_time_str,
|
||||
request_ptr->start_time) ;
|
||||
printf("Mobile MAC: %s\n"
|
||||
fprintf(stderr,
|
||||
"Mobile MAC: %s\n"
|
||||
"Sequence number: %s\n"
|
||||
"Reception timestamp: %s\n"
|
||||
"\n",
|
||||
|
@ -1164,11 +1166,11 @@ void print_request_list()
|
|||
while (info_ptr != NULL)
|
||||
{
|
||||
print_request_info(info_ptr) ;
|
||||
putchar('\n') ;
|
||||
putc('\n', stderr) ;
|
||||
info_ptr = info_ptr->next ;
|
||||
}
|
||||
|
||||
printf("\n\n") ;
|
||||
fprintf(stderr, "\n\n") ;
|
||||
|
||||
request_ptr = request_ptr->next ;
|
||||
}
|
||||
|
@ -1186,7 +1188,8 @@ void print_request_info(request_info_list *info)
|
|||
return ;
|
||||
|
||||
ap_mac_str = owl_mac_bytes_to_string(info->ap_mac_addr_bytes) ;
|
||||
printf("\tAP MAC: %s\n"
|
||||
fprintf(stderr,
|
||||
"\tAP MAC: %s\n"
|
||||
"\tSignal strength: %d dBm\n",
|
||||
ap_mac_str,
|
||||
info->antenna_signal_dbm - 0x100
|
||||
|
|
Loading…
Reference in New Issue