summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@intec.ugent.be>2016-03-17 14:37:49 +0100
committerSander Vrijders <sander.vrijders@intec.ugent.be>2016-03-17 14:37:49 +0100
commit722b769e4d519f2428ee893a78cafa999151bb1c (patch)
treeed681973bedcb9039de26c0d83baa9d5d5f3a22e /include
parent7747528435d77ad055a5c3124a89717e42807b9a (diff)
downloadouroboros-722b769e4d519f2428ee893a78cafa999151bb1c.tar.gz
ouroboros-722b769e4d519f2428ee893a78cafa999151bb1c.zip
lib: Add communication with IPCP daemon
This adds the messages required for the IRMd to communicate with an IPC Process through the library.
Diffstat (limited to 'include')
-rw-r--r--include/ouroboros/sockets.h50
1 files changed, 38 insertions, 12 deletions
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 <ouroboros/common.h>
+#include <ouroboros/rina_name.h>
+
+#include <sys/types.h>
#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