diff options
author | Sander Vrijders <[email protected]> | 2016-02-25 19:14:26 +0100 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2016-02-25 19:14:26 +0100 |
commit | 63633c57b1e2573890fa627dd63f7c79ee5777b8 (patch) | |
tree | 003bcaee3d5e0e15a951a8a2fb5da63db2f1079d /src/lib/irm.c | |
parent | 3c21e9192fc64bd8c27501e524953b564afa50e4 (diff) | |
download | ouroboros-63633c57b1e2573890fa627dd63f7c79ee5777b8.tar.gz ouroboros-63633c57b1e2573890fa627dd63f7c79ee5777b8.zip |
lib, irmd, tools: Support to create IPCPs
Provides the initial support to create IPCPs via a command-line
tool. It extends the socket layer with a message that is sent over a
socket to the irmd when the irm_create_ipcp library function is called
from a program.
Diffstat (limited to 'src/lib/irm.c')
-rw-r--r-- | src/lib/irm.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/lib/irm.c b/src/lib/irm.c index da229d3e..1af8ed2c 100644 --- a/src/lib/irm.c +++ b/src/lib/irm.c @@ -31,7 +31,8 @@ int irm_create_ipcp(rina_name_t name, char * ipcp_type) { int sockfd; - struct irm_msg_sock msg; + struct irm_msg msg; + buffer_t * buf; if (!ipcp_type) return -1; @@ -41,10 +42,15 @@ int irm_create_ipcp(rina_name_t name, return -1; msg.code = IRM_CREATE_IPCP; - msg.irm_msg.create_ipcp.name = name; - msg.irm_msg.create_ipcp.ipcp_type = ipcp_type; + msg.msgs.create_ipcp.name = &name; + msg.msgs.create_ipcp.ipcp_type = ipcp_type; + + buf = serialize_irm_msg(&msg); + if (!buf) + return -1; + + write(sockfd, buf->data, buf->size); - write(sockfd, &msg, sizeof(msg)); close(sockfd); return 0; |