[Aggregator] Send the mobile's IP to Positioner
For now the positioning server only displays the mobile's IP address (in verbose mode) and updates it in the stored Mobile.
This commit is contained in:
parent
94b9cf281f
commit
b60d0d380f
|
@ -90,6 +90,7 @@ typedef struct _owl_request
|
|||
uint8_t type ; // Type of the request
|
||||
uint16_t nb_packets ; // Number of packets sent for this request
|
||||
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 ; // Timestamp on the mobile
|
||||
uint16_t nb_info ; // Number of owl_request_info
|
||||
/* Calibration data */
|
||||
|
|
|
@ -54,8 +54,7 @@ typedef struct _request_list
|
|||
uint16_t nb_packets ;
|
||||
|
||||
/* Request identifier */
|
||||
// Mobile MAC address (in bytes):
|
||||
uint8_t mobile_mac_addr_bytes[ETHER_ADDR_LEN] ;
|
||||
uint8_t mobile_mac_addr_bytes[ETHER_ADDR_LEN] ; // Mobile MAC address
|
||||
owl_timestamp request_time ; // Request time on the mobile
|
||||
|
||||
/* Calibration data */
|
||||
|
@ -65,6 +64,7 @@ typedef struct _request_list
|
|||
owl_direction direction ; // Request orientation
|
||||
|
||||
/* Other data */
|
||||
uint8_t mobile_ip_addr_bytes[4] ; // Mobile IP address
|
||||
// Arrival time of the first packet of the request on the aggregator:
|
||||
owl_timestamp start_time ;
|
||||
request_info_list *info ; // Data for this request
|
||||
|
|
|
@ -671,6 +671,8 @@ void* monitor_requests(void *NULL_value)
|
|||
memcpy(request.mobile_mac_addr_bytes,
|
||||
request_ptr->mobile_mac_addr_bytes,
|
||||
ETHER_ADDR_LEN) ;
|
||||
memcpy(request.mobile_ip_addr_bytes,
|
||||
request_ptr->mobile_ip_addr_bytes, 4) ;
|
||||
request.request_time = request_ptr->request_time ;
|
||||
owl_hton_timestamp(&request.request_time) ;
|
||||
request.x_position =
|
||||
|
@ -803,6 +805,8 @@ void got_request(owl_captured_request request)
|
|||
tmp_request->nb_packets = request.nb_packets ;
|
||||
memcpy(tmp_request->mobile_mac_addr_bytes,
|
||||
request.mobile_mac_addr_bytes, ETHER_ADDR_LEN) ;
|
||||
memcpy(tmp_request->mobile_ip_addr_bytes,
|
||||
request.mobile_ip_addr_bytes, 4) ;
|
||||
// Explicit packet:
|
||||
if (request.type != OWL_REQUEST_IMPLICIT)
|
||||
// Transmission time on the mobile:
|
||||
|
@ -864,6 +868,8 @@ void got_request(owl_captured_request request)
|
|||
tmp_request->nb_packets = request.nb_packets ;
|
||||
memcpy(tmp_request->mobile_mac_addr_bytes,
|
||||
request.mobile_mac_addr_bytes, ETHER_ADDR_LEN) ;
|
||||
memcpy(tmp_request->mobile_ip_addr_bytes,
|
||||
request.mobile_ip_addr_bytes, 4) ;
|
||||
// Explicit packet:
|
||||
if (request.type != OWL_REQUEST_IMPLICIT)
|
||||
// Transmission time on the mobile:
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include <iostream>
|
||||
#include <cstdio> // For perror()
|
||||
#include <arpa/inet.h> // For inet_ntop()
|
||||
#include <boost/tr1/unordered_map.hpp>
|
||||
|
||||
using namespace std ;
|
||||
|
@ -116,6 +117,13 @@ bool InputUDPSocket::fill_current_request()
|
|||
owl_mac_bytes_to_string(request.mobile_mac_addr_bytes)) ;
|
||||
PosUtil::to_upper(mac_mobile) ;
|
||||
|
||||
// Mobile IP
|
||||
char ip_mobile_str[INET_ADDRSTRLEN] ;
|
||||
inet_ntop(AF_INET, &request.mobile_ip_addr_bytes,
|
||||
ip_mobile_str, INET_ADDRSTRLEN) ;
|
||||
string ip_mobile(ip_mobile_str) ;
|
||||
PosUtil::to_upper(ip_mobile) ;
|
||||
|
||||
// Display request's info
|
||||
if (Configuration::is_configured("verbose"))
|
||||
cout
|
||||
|
@ -123,6 +131,7 @@ bool InputUDPSocket::fill_current_request()
|
|||
<< "\n\tType: " << static_cast<uint_fast16_t>(request.type)
|
||||
<< "\n\tNumber of packets: " << request.nb_packets
|
||||
<< "\n\tMobile MAC: " << mac_mobile
|
||||
<< "\n\tMobile IP: " << ip_mobile
|
||||
<< "\n\tRequest timestamp: " << Timestamp(request.request_time)
|
||||
<< "\n\tPosition X: " << request.x_position
|
||||
<< "\n\tPosition Y: " << request.y_position
|
||||
|
@ -143,6 +152,9 @@ bool InputUDPSocket::fill_current_request()
|
|||
}
|
||||
|
||||
const Mobile &mobile = Stock::find_create_mobile(mac_mobile) ;
|
||||
// Update the mobile's IP address:
|
||||
const_cast<Mobile&>(mobile).set_ip_addr(ip_mobile) ;
|
||||
|
||||
current_request->set_mobile(&mobile) ;
|
||||
|
||||
// Request type
|
||||
|
|
Loading…
Reference in New Issue