[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
uint32_t rtap_presentflags ;
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
owl_bool check[15] ; // Present flags
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 ;
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 */
@ -614,7 +614,7 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header,
packet_ip_header = (struct iphdr *)
&packet[rtap_bytes + ieee80211_header_size + LLC_HEADER_SIZE] ;
// 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
{
@ -656,23 +656,23 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header,
#endif // DEBUG
// 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:
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 ;
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):
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
// an explicit request):
memset(&couple.request_time, 0, sizeof(owl_timestamp)) ;
memset(&request.request_time, 0, sizeof(owl_timestamp)) ;
// Blank position data:
couple.direction = 0 ;
couple.x_position = 0 ;
couple.y_position = 0 ;
couple.z_position = 0 ;
request.direction = 0 ;
request.x_position = 0 ;
request.y_position = 0 ;
request.z_position = 0 ;
/* Active mode */
if (is_explicit_packet
@ -693,18 +693,18 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header,
case PACKET_TYPE_CALIBRATION :
if (GET_VERBOSE())
printf("\nExplicit calibration packet received.\n") ;
couple.direction =
request.direction =
packet[rtap_bytes + ieee80211_header_size + LLC_HEADER_SIZE
+ sizeof(struct iphdr) + sizeof(struct udphdr) + 9];
memcpy(&couple.x_position,
memcpy(&request.x_position,
&packet[rtap_bytes + ieee80211_header_size
+ LLC_HEADER_SIZE + sizeof(struct iphdr)
+ sizeof(struct udphdr) + 10], sizeof(float)) ;
memcpy(&couple.y_position,
memcpy(&request.y_position,
&packet[rtap_bytes + ieee80211_header_size
+ LLC_HEADER_SIZE + sizeof(struct iphdr)
+ sizeof(struct udphdr) + 14], sizeof(float)) ;
memcpy(&couple.z_position,
memcpy(&request.z_position,
&packet[rtap_bytes + ieee80211_header_size
+ LLC_HEADER_SIZE + sizeof(struct iphdr)
+ sizeof(struct udphdr) + 18], sizeof(float)) ;
@ -739,7 +739,7 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header,
else
// Copy the timestamp "as is" (i.e. without changing endianess)
// because it will return to the network soon:
memcpy(&couple.request_time,
memcpy(&request.request_time,
&packet[rtap_bytes + ieee80211_header_size +
LLC_HEADER_SIZE + sizeof(struct iphdr) +
sizeof(struct udphdr) + 1],
@ -797,12 +797,12 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header,
rtap_position += RTAP_L_FHSS ;
break ;
case RTAP_ANTENNASIGNALDBM:
memcpy(&(couple.antenna_signal_dbm),
memcpy(&(request.antenna_signal_dbm),
&packet[rtap_position], RTAP_L_ANTENNASIGNALDBM) ;
check[RTAP_ANTENNASIGNALDBM] = TRUE;
if (GET_VERBOSE())
printf("Antenna signal: %d dBm\n",
couple.antenna_signal_dbm - 0x100);
request.antenna_signal_dbm - 0x100);
rtap_position += RTAP_L_ANTENNASIGNALDBM ;
break ;
case RTAP_ANTENNANOISEDBM:
@ -850,17 +850,17 @@ void read_packet(u_char *args, const struct pcap_pkthdr *header,
if (GET_DISPLAY_CAPTURED())
{
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 =
owl_mac_bytes_to_string(couple.mobile_mac_addr_bytes) ;
owl_mac_bytes_to_string(request.mobile_mac_addr_bytes) ;
char
request_time_str[OWL_TIMESTAMP_STR_LEN],
start_time_str[OWL_TIMESTAMP_STR_LEN] ;
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_ntoh_timestamp(couple.start_time)) ;
printf("*** Couple to send ***\n"
owl_ntoh_timestamp(request.start_time)) ;
printf("*** Request to send ***\n"
"\tMAC AP: %s\n"
"\tMobile MAC: %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,
request_time_str,
start_time_str,
couple.antenna_signal_dbm - 0x100,
couple.x_position,
couple.y_position,
couple.z_position,
couple.direction
request.antenna_signal_dbm - 0x100,
request.x_position,
request.y_position,
request.z_position,
request.direction
) ;
free(ap_mac_str) ;
free(mobile_mac_str) ;
}
/* Send couple to the aggregator */
/* Send the request to the aggregator */
nsent =
sendto(aggregation_sockfd, (void *) &couple, sizeof(couple), 0,
sendto(aggregation_sockfd, &request, sizeof(request), 0,
(struct sockaddr *) &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 ;
}
}