[lib-client] Rename create_socket_to_aggregator()
This function had to be renamed, since it allows (and it is used) to open sockets to other hosts than the aggregator.
This commit is contained in:
parent
0045ba8a14
commit
686ab87a1c
7
TODO
7
TODO
|
@ -35,13 +35,6 @@
|
|||
is it?
|
||||
|
||||
|
||||
* libowlps-client
|
||||
|
||||
- Rename owlps_create_socket_to_aggregator()
|
||||
This function should be renamed, since it allows (and it is used)
|
||||
to open sockets to other hosts than the aggregator.
|
||||
|
||||
|
||||
* Client
|
||||
|
||||
- Check the direction
|
||||
|
|
|
@ -6,16 +6,15 @@
|
|||
|
||||
|
||||
/*
|
||||
* Opens an UDP socket to the aggregator (whose IP address is 'dest_ip'
|
||||
* and listening port is 'dest_port'). The server information is stored
|
||||
* Opens an UDP socket to the server whose IP address is 'dest_ip'
|
||||
* and which listens 'dest_port'. The server information is stored
|
||||
* into 'server'. The socket will send through the network interface
|
||||
* 'iface' if specified (if you want the interface to be selected,
|
||||
* automatically, this parameter should be NULL or an empty string).
|
||||
*/
|
||||
int owlclient_create_socket_to_aggregator(char *dest_ip,
|
||||
uint_fast16_t dest_port,
|
||||
struct sockaddr_in *server,
|
||||
char *iface)
|
||||
int owlclient_create_trx_socket(char *dest_ip, uint_fast16_t dest_port,
|
||||
struct sockaddr_in *server,
|
||||
char *iface)
|
||||
{
|
||||
struct sockaddr_in client ;
|
||||
|
||||
|
|
|
@ -14,10 +14,9 @@
|
|||
|
||||
|
||||
/* Function headers */
|
||||
int owlclient_create_socket_to_aggregator(char *dest_ip,
|
||||
uint_fast16_t dest_port,
|
||||
struct sockaddr_in *server,
|
||||
char *iface) ;
|
||||
int owlclient_create_trx_socket(char *dest_ip, uint_fast16_t dest_port,
|
||||
struct sockaddr_in *server,
|
||||
char *iface) ;
|
||||
void owlclient_use_iface(int sockfd, char *iface) ;
|
||||
void owlclient_send_request(int sockfd, struct sockaddr_in *server,
|
||||
void *packet, uint_fast16_t packet_size,
|
||||
|
|
|
@ -275,9 +275,8 @@ void print_configuration()
|
|||
void create_socket()
|
||||
{
|
||||
sockfd =
|
||||
owlclient_create_socket_to_aggregator(options.dest_ip,
|
||||
options.dest_port,
|
||||
&server, options.iface) ;
|
||||
owlclient_create_trx_socket(options.dest_ip, options.dest_port,
|
||||
&server, options.iface) ;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -492,9 +492,9 @@ int capture()
|
|||
|
||||
/* Open UDP socket to the aggregator */
|
||||
aggregation_sockfd =
|
||||
owlclient_create_socket_to_aggregator(GET_AGGREGATION_IP(),
|
||||
GET_AGGREGATION_PORT(),
|
||||
&aggregation_server, NULL) ;
|
||||
owlclient_create_trx_socket(GET_AGGREGATION_IP(),
|
||||
GET_AGGREGATION_PORT(),
|
||||
&aggregation_server, NULL) ;
|
||||
|
||||
while(run)
|
||||
// Capture one packet at time, and call read_packet() on it:
|
||||
|
@ -922,9 +922,9 @@ void autocalibrate_hello()
|
|||
fprintf(stderr, "Autocalibration Hello thread launched.\n") ;
|
||||
|
||||
send_sockfd =
|
||||
owlclient_create_socket_to_aggregator(GET_AGGREGATION_IP(),
|
||||
GET_AUTOCALIBRATION_PORT(),
|
||||
&serv, NULL) ;
|
||||
owlclient_create_trx_socket(GET_AGGREGATION_IP(),
|
||||
GET_AUTOCALIBRATION_PORT(),
|
||||
&serv, NULL) ;
|
||||
|
||||
memcpy(&message.ap_mac_addr_bytes, my_mac_bytes, 6) ;
|
||||
|
||||
|
@ -953,10 +953,10 @@ void autocalibrate()
|
|||
|
||||
// Socket to send autocalibration positioning requests
|
||||
autocalibration_send_sockfd =
|
||||
owlclient_create_socket_to_aggregator(GET_AUTOCALIBRATION_IP(),
|
||||
GET_AUTOCALIBRATION_REQUEST_PORT(),
|
||||
&autocalibration_send_server,
|
||||
GET_WIFI_IFACE()) ;
|
||||
owlclient_create_trx_socket(GET_AUTOCALIBRATION_IP(),
|
||||
GET_AUTOCALIBRATION_REQUEST_PORT(),
|
||||
&autocalibration_send_server,
|
||||
GET_WIFI_IFACE()) ;
|
||||
|
||||
// Socket to receive orders from the aggregator
|
||||
listen_sockfd =
|
||||
|
|
Loading…
Reference in New Issue