[Listener] Rename variable couple -> request

This commit is contained in:
Matteo Cypriani 2011-03-18 15:16:55 +01:00
parent 91cba33dcd
commit d4e9d9c97b
1 changed files with 33 additions and 33 deletions

View File

@ -551,7 +551,7 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header,
uint16_t rtap_bytes ; // Received data size uint16_t rtap_bytes ; // Received data size
uint32_t rtap_presentflags ; uint32_t rtap_presentflags ;
uint_fast16_t rtap_position ; uint_fast16_t rtap_position ;
owl_captured_request couple ; // Message to send to the aggregator owl_captured_request request ; // Message to send to the aggregator
ssize_t nsent ; // sendto return value ssize_t nsent ; // sendto return value
owl_bool check[15] ; // Present flags owl_bool check[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
@ -571,7 +571,7 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header,
owl_bool uses_autocalibration_request_port = FALSE ; owl_bool uses_autocalibration_request_port = FALSE ;
int i ; // Iterator int i ; // Iterator
memset(couple.mobile_ip_addr_bytes, 0, 4) ; // Blank the IP memset(request.mobile_ip_addr_bytes, 0, 4) ; // Blank the IP
/* Common treatements */ /* Common treatements */
@ -614,7 +614,7 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header,
packet_ip_header = (struct iphdr *) packet_ip_header = (struct iphdr *)
&packet[rtap_bytes + ieee80211_header_size + LLC_HEADER_SIZE] ; &packet[rtap_bytes + ieee80211_header_size + LLC_HEADER_SIZE] ;
// Get the source IP: // Get the source IP:
memcpy(couple.mobile_ip_addr_bytes, &packet_ip_header->saddr, 4) ; memcpy(request.mobile_ip_addr_bytes, &packet_ip_header->saddr, 4) ;
if (GET_MODE() != MODE_PASSIVE) // If mode is active or mixed if (GET_MODE() != MODE_PASSIVE) // If mode is active or mixed
{ {
@ -656,23 +656,23 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header,
#endif // DEBUG #endif // DEBUG
// Source MAC address is 10 bytes after the 802.11 packet type: // Source MAC address is 10 bytes after the 802.11 packet type:
memcpy(couple.mobile_mac_addr_bytes, &packet[rtap_bytes+10], 6) ; memcpy(request.mobile_mac_addr_bytes, &packet[rtap_bytes+10], 6) ;
// Drop the packet if it comes from the AP itself: // Drop the packet if it comes from the AP itself:
if (owl_mac_equals(my_mac_bytes, couple.mobile_mac_addr_bytes)) if (owl_mac_equals(my_mac_bytes, request.mobile_mac_addr_bytes))
return ; return ;
memcpy(couple.ap_mac_addr_bytes, my_mac_bytes, 6) ; // Copy AP MAC memcpy(request.ap_mac_addr_bytes, my_mac_bytes, 6) ; // Copy AP MAC
// Capture time is in the pcap header (net-endian): // Capture time is in the pcap header (net-endian):
couple.start_time = owl_timeval_to_timestamp(header->ts) ; request.start_time = owl_timeval_to_timestamp(header->ts) ;
// Transmission time on the mobile is unknown (unless the packet is // Transmission time on the mobile is unknown (unless the packet is
// an explicit request): // an explicit request):
memset(&couple.request_time, 0, sizeof(owl_timestamp)) ; memset(&request.request_time, 0, sizeof(owl_timestamp)) ;
// Blank position data: // Blank position data:
couple.direction = 0 ; request.direction = 0 ;
couple.x_position = 0 ; request.x_position = 0 ;
couple.y_position = 0 ; request.y_position = 0 ;
couple.z_position = 0 ; request.z_position = 0 ;
/* Active mode */ /* Active mode */
if (is_explicit_packet if (is_explicit_packet
@ -693,18 +693,18 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header,
case PACKET_TYPE_CALIBRATION : case PACKET_TYPE_CALIBRATION :
if (GET_VERBOSE()) if (GET_VERBOSE())
printf("\nExplicit calibration packet received.\n") ; printf("\nExplicit calibration packet received.\n") ;
couple.direction = request.direction =
packet[rtap_bytes + ieee80211_header_size + LLC_HEADER_SIZE packet[rtap_bytes + ieee80211_header_size + LLC_HEADER_SIZE
+ sizeof(struct iphdr) + sizeof(struct udphdr) + 9]; + sizeof(struct iphdr) + sizeof(struct udphdr) + 9];
memcpy(&couple.x_position, memcpy(&request.x_position,
&packet[rtap_bytes + ieee80211_header_size &packet[rtap_bytes + ieee80211_header_size
+ LLC_HEADER_SIZE + sizeof(struct iphdr) + LLC_HEADER_SIZE + sizeof(struct iphdr)
+ sizeof(struct udphdr) + 10], sizeof(float)) ; + sizeof(struct udphdr) + 10], sizeof(float)) ;
memcpy(&couple.y_position, memcpy(&request.y_position,
&packet[rtap_bytes + ieee80211_header_size &packet[rtap_bytes + ieee80211_header_size
+ LLC_HEADER_SIZE + sizeof(struct iphdr) + LLC_HEADER_SIZE + sizeof(struct iphdr)
+ sizeof(struct udphdr) + 14], sizeof(float)) ; + sizeof(struct udphdr) + 14], sizeof(float)) ;
memcpy(&couple.z_position, memcpy(&request.z_position,
&packet[rtap_bytes + ieee80211_header_size &packet[rtap_bytes + ieee80211_header_size
+ LLC_HEADER_SIZE + sizeof(struct iphdr) + LLC_HEADER_SIZE + sizeof(struct iphdr)
+ sizeof(struct udphdr) + 18], sizeof(float)) ; + sizeof(struct udphdr) + 18], sizeof(float)) ;
@ -739,7 +739,7 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header,
else else
// Copy the timestamp "as is" (i.e. without changing endianess) // Copy the timestamp "as is" (i.e. without changing endianess)
// because it will return to the network soon: // because it will return to the network soon:
memcpy(&couple.request_time, memcpy(&request.request_time,
&packet[rtap_bytes + ieee80211_header_size + &packet[rtap_bytes + ieee80211_header_size +
LLC_HEADER_SIZE + sizeof(struct iphdr) + LLC_HEADER_SIZE + sizeof(struct iphdr) +
sizeof(struct udphdr) + 1], sizeof(struct udphdr) + 1],
@ -797,12 +797,12 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header,
rtap_position += RTAP_L_FHSS ; rtap_position += RTAP_L_FHSS ;
break ; break ;
case RTAP_ANTENNASIGNALDBM: case RTAP_ANTENNASIGNALDBM:
memcpy(&(couple.antenna_signal_dbm), memcpy(&(request.antenna_signal_dbm),
&packet[rtap_position], RTAP_L_ANTENNASIGNALDBM) ; &packet[rtap_position], RTAP_L_ANTENNASIGNALDBM) ;
check[RTAP_ANTENNASIGNALDBM] = TRUE; check[RTAP_ANTENNASIGNALDBM] = TRUE;
if (GET_VERBOSE()) if (GET_VERBOSE())
printf("Antenna signal: %d dBm\n", printf("Antenna signal: %d dBm\n",
couple.antenna_signal_dbm - 0x100); request.antenna_signal_dbm - 0x100);
rtap_position += RTAP_L_ANTENNASIGNALDBM ; rtap_position += RTAP_L_ANTENNASIGNALDBM ;
break ; break ;
case RTAP_ANTENNANOISEDBM: case RTAP_ANTENNANOISEDBM:
@ -850,17 +850,17 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header,
if (GET_DISPLAY_CAPTURED()) if (GET_DISPLAY_CAPTURED())
{ {
char *ap_mac_str = char *ap_mac_str =
owl_mac_bytes_to_string(couple.ap_mac_addr_bytes) ; owl_mac_bytes_to_string(request.ap_mac_addr_bytes) ;
char *mobile_mac_str = char *mobile_mac_str =
owl_mac_bytes_to_string(couple.mobile_mac_addr_bytes) ; owl_mac_bytes_to_string(request.mobile_mac_addr_bytes) ;
char char
request_time_str[OWL_TIMESTAMP_STR_LEN], request_time_str[OWL_TIMESTAMP_STR_LEN],
start_time_str[OWL_TIMESTAMP_STR_LEN] ; start_time_str[OWL_TIMESTAMP_STR_LEN] ;
owl_timestamp_to_string(request_time_str, owl_timestamp_to_string(request_time_str,
owl_ntoh_timestamp(couple.request_time)) ; owl_ntoh_timestamp(request.request_time)) ;
owl_timestamp_to_string(start_time_str, owl_timestamp_to_string(start_time_str,
owl_ntoh_timestamp(couple.start_time)) ; owl_ntoh_timestamp(request.start_time)) ;
printf("*** Couple to send ***\n" printf("*** Request to send ***\n"
"\tMAC AP: %s\n" "\tMAC AP: %s\n"
"\tMobile MAC: %s\n" "\tMobile MAC: %s\n"
"\tSequence number (request time): %s\n" "\tSequence number (request time): %s\n"
@ -875,24 +875,24 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header,
mobile_mac_str, mobile_mac_str,
request_time_str, request_time_str,
start_time_str, start_time_str,
couple.antenna_signal_dbm - 0x100, request.antenna_signal_dbm - 0x100,
couple.x_position, request.x_position,
couple.y_position, request.y_position,
couple.z_position, request.z_position,
couple.direction request.direction
) ; ) ;
free(ap_mac_str) ; free(ap_mac_str) ;
free(mobile_mac_str) ; free(mobile_mac_str) ;
} }
/* Send couple to the aggregator */ /* Send the request to the aggregator */
nsent = nsent =
sendto(aggregation_sockfd, (void *) &couple, sizeof(couple), 0, sendto(aggregation_sockfd, &request, sizeof(request), 0,
(struct sockaddr *) &aggregation_server, (struct sockaddr *) &aggregation_server,
(socklen_t) sizeof(aggregation_server)) ; (socklen_t) sizeof(aggregation_server)) ;
if (nsent != (ssize_t) sizeof(couple)) if (nsent != (ssize_t) sizeof(request))
{ {
perror("Error sending couple to the aggregation server") ; perror("Error sending request to the aggregation server") ;
return ; return ;
} }
} }