diff --git a/TODO b/TODO index 63feb4e..a8a7ab8 100644 --- a/TODO +++ b/TODO @@ -4,8 +4,6 @@ ° Valgrind / libconfuse bugs (Listener & Aggregator): . http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=639074 . http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=639115 -- Rename some fields in the structures - ° start_time -> rx_time, first_rx_time - Eliminate remaining exit() calls to avoid memory leaks on exit. - Use atexit() / on_exit() instead of goto to clean at exit? - Add option dump-configuration (displays the config & exits). diff --git a/libowlps/owlps.h b/libowlps/owlps.h index 410adfa..972a43d 100644 --- a/libowlps/owlps.h +++ b/libowlps/owlps.h @@ -63,8 +63,8 @@ typedef struct _owl_captured_request uint8_t ap_mac_addr_bytes[ETHER_ADDR_LEN] ; // MAC of the listener uint8_t mobile_mac_addr_bytes[ETHER_ADDR_LEN] ; // MAC of the mobile uint8_t mobile_ip_addr_bytes[4] ; // IP of the mobile - owl_timestamp request_time ; // Request ID (timestamp on the mobile) - owl_timestamp start_time ; // Timestamp of arrival on the listener + owl_timestamp request_time ; // Timestamp on the mobile + owl_timestamp capture_time ; // Timestamp of arrival on the listener uint8_t ss_dbm ; // Signal strength measured by the listener (dBm) /* Calibration data */ float x_position ; @@ -80,8 +80,8 @@ typedef struct _owl_request { uint8_t type ; // Type of the request uint8_t mobile_mac_addr_bytes[ETHER_ADDR_LEN] ; // MAC of the mobile - owl_timestamp request_time ; // Request ID (timestamp on the mobile) - uint16_t nb_info ; // Number of (listener MAC;signal strength) couples + owl_timestamp request_time ; // Timestamp on the mobile + uint16_t nb_info ; // Number of owl_request_info /* Calibration data */ float x_position ; float y_position ; diff --git a/owlps-aggregator/owlps-aggregatord.c b/owlps-aggregator/owlps-aggregatord.c index 0a203c0..c348447 100644 --- a/owlps-aggregator/owlps-aggregatord.c +++ b/owlps-aggregator/owlps-aggregatord.c @@ -469,7 +469,7 @@ int read_loop(int sockfd) // Endianess conversions: request.request_time = owl_ntoh_timestamp(request.request_time) ; - request.start_time = owl_ntoh_timestamp(request.start_time) ; + request.capture_time = owl_ntoh_timestamp(request.capture_time) ; request.x_position = owl_ntohf(request.x_position) ; request.y_position = owl_ntohf(request.y_position) ; request.z_position = owl_ntohf(request.z_position) ; @@ -478,14 +478,14 @@ int read_loop(int sockfd) { char request_time_str[OWL_TIMESTAMP_STRLEN], - start_time_str[OWL_TIMESTAMP_STRLEN], + capture_time_str[OWL_TIMESTAMP_STRLEN], ap_mac_addr_str[OWL_ETHER_ADDR_STRLEN], mobile_mac_addr_str[OWL_ETHER_ADDR_STRLEN], mobile_ip_str[INET_ADDRSTRLEN] ; owl_timestamp_to_string(request_time_str, request.request_time) ; - owl_timestamp_to_string(start_time_str, request.start_time) ; + owl_timestamp_to_string(capture_time_str, request.capture_time) ; owl_mac_bytes_to_string_r(request.ap_mac_addr_bytes, ap_mac_addr_str) ; owl_mac_bytes_to_string_r(request.mobile_mac_addr_bytes, @@ -513,7 +513,7 @@ int read_loop(int sockfd) mobile_mac_addr_str, mobile_ip_str, request_time_str, - start_time_str, + capture_time_str, request.ss_dbm - 0x100, request.x_position, request.y_position, @@ -769,7 +769,7 @@ void got_request(owl_captured_request request) // Implicit packet: else // Reception time on the AP: - tmp_request->request_time = request.start_time ; + tmp_request->request_time = request.capture_time ; // Save locale time on the aggregator (not the reception time // on the AP): tmp_request->start_time = start_time ; @@ -806,7 +806,7 @@ void got_request(owl_captured_request request) // TODO : define an option for the maximal difference time. if (owl_mac_equals(request.mobile_mac_addr_bytes, tmp_request->mobile_mac_addr_bytes) - && owl_time_elapsed_ms(request.start_time, + && owl_time_elapsed_ms(request.capture_time, tmp_request->request_time) <= 10) break ; // If the request exists, we stop on it tmp_request = tmp_request->next ; @@ -829,9 +829,9 @@ void got_request(owl_captured_request request) // Implicit packet: else // Reception time on the AP: - tmp_request->request_time = request.start_time ; - // Save locale time on the aggregator (not the reception time - // on the AP): + tmp_request->request_time = request.capture_time ; + // Save the local time on the aggregator (not the reception + // time on the AP): tmp_request->start_time = start_time ; tmp_request->x_position = request.x_position ; tmp_request->y_position = request.y_position ; diff --git a/owlps-listener/owlps-listenerd.c b/owlps-listener/owlps-listenerd.c index 4115ccc..7b2c7d4 100644 --- a/owlps-listener/owlps-listenerd.c +++ b/owlps-listener/owlps-listenerd.c @@ -926,7 +926,7 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header, // Copy AP MAC : memcpy(request.ap_mac_addr_bytes, my_mac_bytes, ETHER_ADDR_LEN) ; // Capture time is in the pcap header (host-endian): - request.start_time = + request.capture_time = owl_hton_timestamp(owl_timeval_to_timestamp(header->ts)) ; /* Active mode */ @@ -1020,15 +1020,15 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header, { char request_time_str[OWL_TIMESTAMP_STRLEN], - start_time_str[OWL_TIMESTAMP_STRLEN], + capture_time_str[OWL_TIMESTAMP_STRLEN], ap_mac_addr_str[OWL_ETHER_ADDR_STRLEN], mobile_mac_addr_str[OWL_ETHER_ADDR_STRLEN], mobile_ip_str[INET_ADDRSTRLEN] ; owl_timestamp_to_string(request_time_str, owl_ntoh_timestamp(request.request_time)) ; - owl_timestamp_to_string(start_time_str, - owl_ntoh_timestamp(request.start_time)) ; + owl_timestamp_to_string(capture_time_str, + owl_ntoh_timestamp(request.capture_time)) ; owl_mac_bytes_to_string_r(request.ap_mac_addr_bytes, ap_mac_addr_str) ; owl_mac_bytes_to_string_r(request.mobile_mac_addr_bytes, @@ -1054,7 +1054,7 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header, mobile_mac_addr_str, mobile_ip_str, request_time_str, - start_time_str, + capture_time_str, rtap_fields[RTAP_ANTENNASIGNALDBM] ? request.ss_dbm - 0x100 : 0, owl_ntohf(request.x_position),