From a315150a16c02f3cb694e639d5aba555fce4b4c3 Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Tue, 5 Jul 2016 15:43:13 +0200 Subject: lib: Provide first implementation of revised CDAP This commit introduces a first version of the revised CDAP specification. CACEP (for authentication purposes) has been separated from CDAP. Application developers may use CDAP if they find it useful. Within Ouroboros CDAP will be used to perform operations on the RIB of an IPCP. --- src/ipcpd/ipcp-data.h | 2 +- src/ipcpd/ipcp.c | 8 ++++---- src/ipcpd/ipcp.h | 2 ++ src/ipcpd/local/main.c | 2 +- src/ipcpd/shim-udp/main.c | 6 +++--- 5 files changed, 11 insertions(+), 9 deletions(-) (limited to 'src/ipcpd') diff --git a/src/ipcpd/ipcp-data.h b/src/ipcpd/ipcp-data.h index ce20730b..1e183dca 100644 --- a/src/ipcpd/ipcp-data.h +++ b/src/ipcpd/ipcp-data.h @@ -24,7 +24,7 @@ #ifndef IPCPD_IPCP_DATA_H #define IPCPD_IPCP_DATA_H -#include +#include #include #include #include diff --git a/src/ipcpd/ipcp.c b/src/ipcpd/ipcp.c index 4acbffa2..579203c2 100644 --- a/src/ipcpd/ipcp.c +++ b/src/ipcpd/ipcp.c @@ -236,14 +236,14 @@ void * ipcp_main_loop(void * o) ipcp_msg__free_unpacked(msg, NULL); - buffer.size = ipcp_msg__get_packed_size(&ret_msg); - if (buffer.size == 0) { + buffer.len = ipcp_msg__get_packed_size(&ret_msg); + if (buffer.len == 0) { LOG_ERR("Failed to send reply message"); close(lsockfd); continue; } - buffer.data = malloc(buffer.size); + buffer.data = malloc(buffer.len); if (buffer.data == NULL) { close(lsockfd); continue; @@ -251,7 +251,7 @@ void * ipcp_main_loop(void * o) ipcp_msg__pack(&ret_msg, buffer.data); - if (write(lsockfd, buffer.data, buffer.size) == -1) { + if (write(lsockfd, buffer.data, buffer.len) == -1) { free(buffer.data); close(lsockfd); continue; diff --git a/src/ipcpd/ipcp.h b/src/ipcpd/ipcp.h index 1e9e9763..27c3cf8e 100644 --- a/src/ipcpd/ipcp.h +++ b/src/ipcpd/ipcp.h @@ -24,6 +24,8 @@ #define IPCPD_IPCP_H #include +#include + #include #include "ipcp-ops.h" diff --git a/src/ipcpd/local/main.c b/src/ipcpd/local/main.c index 837cbf8c..4802a161 100644 --- a/src/ipcpd/local/main.c +++ b/src/ipcpd/local/main.c @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #define OUROBOROS_PREFIX "ipcpd/local" diff --git a/src/ipcpd/shim-udp/main.c b/src/ipcpd/shim-udp/main.c index 68d393af..c22947fa 100644 --- a/src/ipcpd/shim-udp/main.c +++ b/src/ipcpd/shim-udp/main.c @@ -340,8 +340,8 @@ static int send_shim_udp_msg(shim_udp_msg_t * msg, r_saddr.sin_addr.s_addr = dst_ip_addr; r_saddr.sin_port = LISTEN_PORT; - buf.size = shim_udp_msg__get_packed_size(msg); - if (buf.size == 0) { + buf.len = shim_udp_msg__get_packed_size(msg); + if (buf.len == 0) { return -1; } @@ -354,7 +354,7 @@ static int send_shim_udp_msg(shim_udp_msg_t * msg, if (sendto(shim_data(_ipcp)->s_fd, buf.data, - buf.size, + buf.len, 0, (struct sockaddr *) &r_saddr, sizeof(r_saddr)) == -1) { -- cgit v1.2.3