diff options
author | Sander Vrijders <[email protected]> | 2016-03-24 15:46:05 +0100 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2016-03-24 15:46:05 +0100 |
commit | 72abee4fc44e5e5092e215d5afee556e6e59347c (patch) | |
tree | f0e6beea035fde78b7e02a8cb449cd550cd8c3de /src/lib/irm.c | |
parent | eb46e3ddc161c543ea268c54f0c6db40019d25c1 (diff) | |
download | ouroboros-72abee4fc44e5e5092e215d5afee556e6e59347c.tar.gz ouroboros-72abee4fc44e5e5092e215d5afee556e6e59347c.zip |
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.
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; } |