From 722b769e4d519f2428ee893a78cafa999151bb1c Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Thu, 17 Mar 2016 14:37:49 +0100 Subject: lib: Add communication with IPCP daemon This adds the messages required for the IRMd to communicate with an IPC Process through the library. --- include/ouroboros/sockets.h | 50 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 12 deletions(-) (limited to 'include') diff --git a/include/ouroboros/sockets.h b/include/ouroboros/sockets.h index 871e3c36..426e1006 100644 --- a/include/ouroboros/sockets.h +++ b/include/ouroboros/sockets.h @@ -23,12 +23,17 @@ #ifndef OUROBOROS_SOCKETS_H #define OUROBOROS_SOCKETS_H -#include "common.h" -#include "rina_name.h" +#include +#include + +#include #define IRM_SOCK_PATH "/tmp/irm_sock" #define IRM_MSG_BUF_SIZE 256 +#define IPCP_SOCK_PATH_PREFIX "/tmp/ipcp_sock" +#define IPCP_MSG_BUFS_SIZE IRM_MSG_BUF_SIZE + enum irm_msg_code { IRM_CREATE_IPCP, IRM_DESTROY_IPCP, @@ -39,21 +44,42 @@ enum irm_msg_code { }; struct irm_msg { - enum irm_msg_code code; - rina_name_t * name; - char * ipcp_type; + enum irm_msg_code code; + rina_name_t * name; + char * ipcp_type; + struct dif_config * conf; + char * dif_name; + char ** difs; + size_t difs_size; +}; + +enum ipcp_msg_code { + IPCP_BOOTSTRAP, + IPCP_ENROLL, + IPCP_REG, + IPCP_UNREG +}; + +struct ipcp_msg { + enum ipcp_msg_code code; struct dif_config * conf; - char * dif_name; - char ** difs; - size_t difs_size; + char * dif_name; + rina_name_t * member; + char ** difs; + size_t difs_size; }; -int client_socket_open(char * file_name); -int server_socket_open(char * file_name); +/* Returns the full socket path of an IPCP */ +char * ipcp_sock_path(pid_t pid); + +int client_socket_open(char * file_name); +int server_socket_open(char * file_name); /* Caller has to free the buffer */ -buffer_t * serialize_irm_msg(struct irm_msg * msg); +buffer_t * serialize_irm_msg(struct irm_msg * msg); +buffer_t * serialize_ipcp_msg(struct ipcp_msg * msg); /* Caller has to free all the allocated fields in the message */ -struct irm_msg * deserialize_irm_msg(buffer_t * data); +struct irm_msg * deserialize_irm_msg(buffer_t * data); +struct ipcp_msg * deserialize_ipcp_msg(buffer_t * data); #endif -- cgit v1.2.3