diff options
author | Dimitri Staessens <dimitri.staessens@intec.ugent.be> | 2016-03-24 16:26:40 +0100 |
---|---|---|
committer | Dimitri Staessens <dimitri.staessens@intec.ugent.be> | 2016-03-24 16:26:40 +0100 |
commit | c32ccc39cfc793729890204c8d810eb7608f4474 (patch) | |
tree | e01b29ae0ff52d617c656b5d85babd472aaa4149 /src/lib/irm.c | |
parent | 683114204c81a4e989042ee5de12c4fc71fc910c (diff) | |
parent | 72abee4fc44e5e5092e215d5afee556e6e59347c (diff) | |
download | ouroboros-c32ccc39cfc793729890204c8d810eb7608f4474.tar.gz ouroboros-c32ccc39cfc793729890204c8d810eb7608f4474.zip |
Merged in sandervrijders/ouroboros/be-irm-msg (pull request #40)
lib: Adds IRMd messages for the dev.h API calls
Diffstat (limited to 'src/lib/irm.c')
-rw-r--r-- | src/lib/irm.c | 41 |
1 files changed, 6 insertions, 35 deletions
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 <ouroboros/sockets.h> #include <stdlib.h> -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; } |