summaryrefslogtreecommitdiff
path: root/src/ipcpd/shim-udp
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-10-21 20:13:41 +0200
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-10-22 13:27:02 +0200
commit3cafbf3cfe5c58a6988dbfc4c29148ebb804f5c2 (patch)
tree881da180b8d801c38ba0fbad2fc9f387a70ec016 /src/ipcpd/shim-udp
parentd5a52f3951fff7ee272bd0d4cd95cd122d07fa64 (diff)
downloadouroboros-3cafbf3cfe5c58a6988dbfc4c29148ebb804f5c2.tar.gz
ouroboros-3cafbf3cfe5c58a6988dbfc4c29148ebb804f5c2.zip
build: Compile with strict conversion
This has the code checked with -Wcast-qual and -Wconversion flags. These flags were removed because SWIG generated code fails.
Diffstat (limited to 'src/ipcpd/shim-udp')
-rw-r--r--src/ipcpd/shim-udp/main.c27
-rw-r--r--src/ipcpd/shim-udp/shim_udp_messages.proto4
2 files changed, 17 insertions, 14 deletions
diff --git a/src/ipcpd/shim-udp/main.c b/src/ipcpd/shim-udp/main.c
index f97a6bc1..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);
}
}
@@ -1109,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;
};