diff options
author | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2016-10-22 11:33:20 +0000 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2016-10-22 11:33:20 +0000 |
commit | 727efbe0c5e61862a870c71a2857b28eece3d369 (patch) | |
tree | 881da180b8d801c38ba0fbad2fc9f387a70ec016 /src/ipcpd/shim-udp | |
parent | 482c44232d4deda3f89a7d85fbad99c1c64e80ec (diff) | |
parent | 3cafbf3cfe5c58a6988dbfc4c29148ebb804f5c2 (diff) | |
download | ouroboros-727efbe0c5e61862a870c71a2857b28eece3d369.tar.gz ouroboros-727efbe0c5e61862a870c71a2857b28eece3d369.zip |
Merged in dstaesse/ouroboros/be-extra (pull request #268)
build: Comply with -Wextra compiler flag
Diffstat (limited to 'src/ipcpd/shim-udp')
-rw-r--r-- | src/ipcpd/shim-udp/main.c | 31 | ||||
-rw-r--r-- | src/ipcpd/shim-udp/shim_udp_messages.proto | 4 |
2 files changed, 21 insertions, 14 deletions
diff --git a/src/ipcpd/shim-udp/main.c b/src/ipcpd/shim-udp/main.c index 050623e4..62e1b2d0 100644 --- a/src/ipcpd/shim-udp/main.c +++ b/src/ipcpd/shim-udp/main.c @@ -94,7 +94,7 @@ struct { pthread_mutex_t fd_set_lock; } udp_data; -static int udp_data_init() +static int udp_data_init(void) { int i; @@ -119,7 +119,7 @@ static int udp_data_init() return 0; } -static void udp_data_fini() +static void udp_data_fini(void) { flow_set_destroy(udp_data.np1_flows); @@ -192,7 +192,7 @@ static int send_shim_udp_msg(shim_udp_msg_t * msg, uint32_t dst_ip_addr) } static int ipcp_udp_port_alloc(uint32_t dst_ip_addr, - uint32_t src_udp_port, + uint16_t src_udp_port, char * dst_name, char * src_ae_name) { @@ -314,8 +314,8 @@ static int udp_port_to_fd(int udp_port) return -1; } -static int ipcp_udp_port_alloc_reply(int src_udp_port, - int dst_udp_port, +static int ipcp_udp_port_alloc_reply(uint16_t src_udp_port, + uint16_t dst_udp_port, int response) { int fd = -1; @@ -368,7 +368,7 @@ static int ipcp_udp_port_alloc_reply(int src_udp_port, return ret; } -static int ipcp_udp_flow_dealloc_req(int udp_port) +static int ipcp_udp_flow_dealloc_req(uint16_t udp_port) { int skfd = -1; int fd = -1; @@ -408,13 +408,15 @@ static int ipcp_udp_flow_dealloc_req(int udp_port) return 0; } -static void * ipcp_udp_listener() +static void * ipcp_udp_listener(void * o) { uint8_t buf[SHIM_UDP_MSG_SIZE]; - int n = 0; + ssize_t n = 0; struct sockaddr_in c_saddr; int sfd = udp_data.s_fd; + (void) o; + while (true) { shim_udp_msg_t * msg = NULL; @@ -464,9 +466,9 @@ static void * ipcp_udp_listener() return 0; } -static void * ipcp_udp_sdu_reader() +static void * ipcp_udp_sdu_reader(void * o) { - int n; + ssize_t n; int skfd; int fd; /* FIXME: avoid this copy */ @@ -476,6 +478,8 @@ static void * ipcp_udp_sdu_reader() int flags; struct timeval tv = {0, FD_UPDATE_TIMEOUT}; + (void) o; + while (true) { pthread_rwlock_rdlock(&ipcpi.state_lock); pthread_rwlock_rdlock(&udp_data.flows_lock); @@ -507,7 +511,6 @@ static void * ipcp_udp_sdu_reader() (unsigned *) &n)) <= 0) continue; - /* send the sdu to the correct fd */ flow_write(fd, buf, n); } } @@ -524,6 +527,8 @@ static void * ipcp_udp_sdu_loop(void * o) if (fq == NULL) return (void *) 1; + (void) o; + while (true) { int ret = flow_event_wait(udp_data.np1_flows, fq, &timeout); if (ret == -ETIMEDOUT) @@ -563,6 +568,8 @@ static void * ipcp_udp_sdu_loop(void * o) void ipcp_sig_handler(int sig, siginfo_t * info, void * c) { + (void) c; + switch(sig) { case SIGINT: case SIGTERM: @@ -1105,7 +1112,7 @@ static int ipcp_udp_flow_alloc_resp(int fd, int response) static int ipcp_udp_flow_dealloc(int fd) { int skfd = -1; - int remote_udp = -1; + uint16_t remote_udp; struct timespec t = {0, 10000}; struct sockaddr_in r_saddr; socklen_t r_saddr_len = sizeof(r_saddr); diff --git a/src/ipcpd/shim-udp/shim_udp_messages.proto b/src/ipcpd/shim-udp/shim_udp_messages.proto index e6bac908..bd9bd3aa 100644 --- a/src/ipcpd/shim-udp/shim_udp_messages.proto +++ b/src/ipcpd/shim-udp/shim_udp_messages.proto @@ -8,7 +8,7 @@ message shim_udp_msg { required shim_udp_msg_code code = 1; optional string dst_name = 2; optional string src_ae_name = 4; - required sint32 src_udp_port = 5; - optional sint32 dst_udp_port = 6; + required uint32 src_udp_port = 5; + optional uint32 dst_udp_port = 6; optional sint32 response = 7; }; |