From 72abee4fc44e5e5092e215d5afee556e6e59347c Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Thu, 24 Mar 2016 15:46:05 +0100 Subject: lib: Adds IRMd messages for the dev.h API calls This adds several messages for the dev.h API calls to communicate with the IRM daemon. The deserializing of these messages is still missing and the irmd hasn't been updated with them either. --- src/lib/irm.c | 41 ++++++----------------------------------- 1 file changed, 6 insertions(+), 35 deletions(-) (limited to 'src/lib/irm.c') diff --git a/src/lib/irm.c b/src/lib/irm.c index e4804074..9fd13d52 100644 --- a/src/lib/irm.c +++ b/src/lib/irm.c @@ -28,35 +28,6 @@ #include #include -static int send_irm_msg(struct irm_msg * msg) -{ - int sockfd; - buffer_t * buf; - - sockfd = client_socket_open(IRM_SOCK_PATH); - if (sockfd < 0) - return -1; - - buf = serialize_irm_msg(msg); - if (buf == NULL) { - close(sockfd); - return -1; - } - - if (write(sockfd, buf->data, buf->size) == -1) { - free(buf->data); - free(buf); - close(sockfd); - return -1; - } - - free(buf->data); - free(buf); - - close(sockfd); - return 0; -} - int irm_create_ipcp(rina_name_t name, char * ipcp_type) { @@ -74,7 +45,7 @@ int irm_create_ipcp(rina_name_t name, msg.name = &name; msg.ipcp_type = ipcp_type; - if (send_irm_msg(&msg)) { + if (send_irmd_msg(&msg)) { LOG_ERR("Failed to send message to daemon"); return -1; } @@ -94,7 +65,7 @@ int irm_destroy_ipcp(rina_name_t name) msg.code = IRM_DESTROY_IPCP; msg.name = &name; - if (send_irm_msg(&msg)) { + if (send_irmd_msg(&msg)) { LOG_ERR("Failed to send message to daemon"); return -1; } @@ -116,7 +87,7 @@ int irm_bootstrap_ipcp(rina_name_t name, msg.name = &name; msg.conf = &conf; - if (send_irm_msg(&msg)) { + if (send_irmd_msg(&msg)) { LOG_ERR("Failed to send message to daemon"); return -1; } @@ -138,7 +109,7 @@ int irm_enroll_ipcp(rina_name_t name, msg.name = &name; msg.dif_name = dif_name; - if (send_irm_msg(&msg)) { + if (send_irmd_msg(&msg)) { LOG_ERR("Failed to send message to daemon"); return -1; } @@ -162,7 +133,7 @@ int irm_reg_ipcp(rina_name_t name, msg.difs = difs; msg.difs_size = difs_size; - if (send_irm_msg(&msg)) { + if (send_irmd_msg(&msg)) { LOG_ERR("Failed to send message to daemon"); return -1; } @@ -186,7 +157,7 @@ int irm_unreg_ipcp(rina_name_t name, msg.difs = difs; msg.difs_size = difs_size; - if (send_irm_msg(&msg)) { + if (send_irmd_msg(&msg)) { LOG_ERR("Failed to send message to daemon"); return -1; } -- cgit v1.2.3