summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/ouroboros/ipcp-dev.h26
-rw-r--r--include/ouroboros/irm.h4
-rw-r--r--include/ouroboros/protobuf.h46
-rw-r--r--include/ouroboros/pthread.h2
-rw-r--r--include/ouroboros/serdes-irm.h79
-rw-r--r--include/ouroboros/sockets.h.in16
6 files changed, 130 insertions, 43 deletions
diff --git a/include/ouroboros/ipcp-dev.h b/include/ouroboros/ipcp-dev.h
index 5ee78905..378d724a 100644
--- a/include/ouroboros/ipcp-dev.h
+++ b/include/ouroboros/ipcp-dev.h
@@ -20,27 +20,25 @@
* Foundation, Inc., http://www.fsf.org/about/contact/.
*/
-#include <ouroboros/shm_rdrbuff.h>
-#include <ouroboros/qoscube.h>
-#include <ouroboros/ipcp.h>
-
#ifndef OUROBOROS_LIB_IPCP_DEV_H
#define OUROBOROS_LIB_IPCP_DEV_H
+#include <ouroboros/ipcp.h>
+#include <ouroboros/qoscube.h>
+#include <ouroboros/shm_rdrbuff.h>
+#include <ouroboros/utils.h>
+
int ipcp_create_r(const struct ipcp_info * info);
-int ipcp_flow_req_arr(const uint8_t * dst,
- size_t len,
+int ipcp_flow_req_arr(const buffer_t * dst,
qosspec_t qs,
time_t mpl,
- const void * data,
- size_t dlen);
-
-int ipcp_flow_alloc_reply(int fd,
- int response,
- time_t mpl,
- const void * data,
- size_t len);
+ const buffer_t * data);
+
+int ipcp_flow_alloc_reply(int fd,
+ int response,
+ time_t mpl,
+ const buffer_t * data);
int ipcp_flow_read(int fd,
struct shm_du_buff ** sdb);
diff --git a/include/ouroboros/irm.h b/include/ouroboros/irm.h
index b27343e8..0105f88e 100644
--- a/include/ouroboros/irm.h
+++ b/include/ouroboros/irm.h
@@ -30,10 +30,6 @@
#include <sys/types.h>
-/* Name binding options. */
-#define BIND_AUTO 0x01
-#define NAME_SIZE 255
-
struct ipcp_list_info {
pid_t pid;
enum ipcp_type type;
diff --git a/include/ouroboros/protobuf.h b/include/ouroboros/protobuf.h
index eb292721..9d38afb1 100644
--- a/include/ouroboros/protobuf.h
+++ b/include/ouroboros/protobuf.h
@@ -23,44 +23,56 @@
#ifndef OUROBOROS_LIB_PROTOBUF_H
#define OUROBOROS_LIB_PROTOBUF_H
+#include <ouroboros/flow.h>
#include <ouroboros/qos.h>
#include <ouroboros/ipcp.h>
#include <ouroboros/irm.h>
+#include <ouroboros/serdes-irm.h>
#include <ouroboros/serdes-oep.h>
#include "ipcp_config.pb-c.h"
typedef IpcpConfigMsg ipcp_config_msg_t;
-typedef LayerInfoMsg layer_info_msg_t;
-typedef DtConfigMsg dt_config_msg_t;
-typedef EthConfigMsg eth_config_msg_t;
-typedef UdpConfigMsg udp_config_msg_t;
-typedef UniConfigMsg uni_config_msg_t;
+typedef DtConfigMsg dt_config_msg_t;
+typedef EthConfigMsg eth_config_msg_t;
+typedef UdpConfigMsg udp_config_msg_t;
+typedef UniConfigMsg uni_config_msg_t;
#include "ipcp.pb-c.h"
-typedef IpcpMsg ipcp_msg_t;
+typedef IpcpMsg ipcp_msg_t;
#include "irm.pb-c.h"
-typedef IpcpInfoMsg ipcp_info_msg_t;
-typedef IpcpListMsg ipcp_list_msg_t;
-typedef NameInfoMsg name_info_msg_t;
+typedef IrmMsg irm_msg_t;
+typedef TimespecMsg timespec_msg_t;
+typedef IpcpInfoMsg ipcp_info_msg_t;
+typedef IpcpListMsg ipcp_list_msg_t;
-#include "qos.pb-c.h"
-typedef QosspecMsg qosspec_msg_t;
+#include "model.pb-c.h"
+typedef FlowInfoMsg flow_info_msg_t;
+typedef LayerInfoMsg layer_info_msg_t;
+typedef NameInfoMsg name_info_msg_t;
+typedef QosspecMsg qosspec_msg_t;
#include "enroll.pb-c.h"
-typedef EnrollReqMsg enroll_req_msg_t;
-typedef EnrollRespMsg enroll_resp_msg_t;
-typedef EnrollAckMsg enroll_ack_msg_t;
+typedef EnrollReqMsg enroll_req_msg_t;
+typedef EnrollRespMsg enroll_resp_msg_t;
+typedef EnrollAckMsg enroll_ack_msg_t;
/* IPCP configuration */
+timespec_msg_t * timespec_s_to_msg(const struct timespec * s);
+
+struct timespec timespec_msg_to_s(timespec_msg_t * msg);
+
+flow_info_msg_t * flow_info_s_to_msg(const struct flow_info * s);
+
+struct flow_info flow_info_msg_to_s(const flow_info_msg_t * msg);
layer_info_msg_t * layer_info_s_to_msg(const struct layer_info * s);
struct layer_info layer_info_msg_to_s(const layer_info_msg_t * msg);
-ipcp_info_msg_t * ipcp_info_s_to_msg(const struct ipcp_info * s);
+ipcp_info_msg_t * ipcp_info_s_to_msg(const struct ipcp_info * s);
-struct ipcp_info ipcp_info_msg_to_s(const ipcp_info_msg_t * msg);
+struct ipcp_info ipcp_info_msg_to_s(const ipcp_info_msg_t * msg);
dt_config_msg_t * dt_config_s_to_msg(const struct dt_config * s);
@@ -102,4 +114,4 @@ enroll_ack_msg_t * enroll_ack_s_to_msg(const struct enroll_ack * s);
struct enroll_ack enroll_ack_msg_to_s(const enroll_ack_msg_t * msg);
-#endif /* OUROBOROS_LIB_PROTOBUF_H */ \ No newline at end of file
+#endif /* OUROBOROS_LIB_PROTOBUF_H */
diff --git a/include/ouroboros/pthread.h b/include/ouroboros/pthread.h
index df9213c0..7044cb5e 100644
--- a/include/ouroboros/pthread.h
+++ b/include/ouroboros/pthread.h
@@ -35,11 +35,13 @@ static int __attribute__((unused)) __timedwait(pthread_cond_t * cond,
return pthread_cond_timedwait(cond, mtx, abstime);
}
+#if defined (_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L
/* various cleanup functions for pthread_cleanup_push */
static void __attribute__((unused)) __cleanup_rwlock_unlock(void * rwlock)
{
pthread_rwlock_unlock((pthread_rwlock_t *) rwlock);
}
+#endif
static void __attribute__((unused)) __cleanup_mutex_unlock(void * mutex)
{
diff --git a/include/ouroboros/serdes-irm.h b/include/ouroboros/serdes-irm.h
new file mode 100644
index 00000000..1d041541
--- /dev/null
+++ b/include/ouroboros/serdes-irm.h
@@ -0,0 +1,79 @@
+/*
+ * Ouroboros - Copyright (C) 2016 - 2024
+ *
+ * Ouroboros IRM Protocol - serialization/deserialization
+ *
+ * Dimitri Staessens <dimitri@ouroboros.rocks>
+ * Sander Vrijders <sander@ouroboros.rocks>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., http://www.fsf.org/about/contact/.
+ */
+
+#ifndef OUROBOROS_LIB_SERDES_IRM_H
+#define OUROBOROS_LIB_SERDES_IRM_H
+
+#include <ouroboros/flow.h>
+#include <ouroboros/ipcp.h>
+#include <ouroboros/time.h>
+#include <ouroboros/utils.h>
+
+#include <inttypes.h>
+
+int flow_alloc__irm_req_ser(buffer_t * buf,
+ const struct flow_info * flow,
+ const char * dst,
+ const struct timespec * timeo);
+
+int flow_join__irm_req_ser(buffer_t * buf,
+ const struct flow_info * flow,
+ const char * dst,
+ const struct timespec * timeo);
+
+int flow_accept__irm_req_ser(buffer_t * buf,
+ const struct flow_info * flow,
+ const struct timespec * timeo);
+
+int ipcp_flow_req_arr__irm_req_ser(buffer_t * buf,
+ const buffer_t * dst,
+ const struct flow_info * flow,
+ const buffer_t * data);
+
+int ipcp_flow_alloc_reply__irm_msg_ser(buffer_t * buf,
+ const struct flow_info * flow,
+ int response,
+ const buffer_t * data);
+
+/* response to alloc / join / accept / flow_req_arr */
+int flow__irm_result_des(buffer_t * buf,
+ struct flow_info * flow,
+ buffer_t * sk);
+
+int flow_dealloc__irm_req_ser(buffer_t * buf,
+ const struct flow_info * flow,
+ const struct timespec * timeo);
+
+int ipcp_flow_dealloc__irm_req_ser(buffer_t * buf,
+ const struct flow_info * info);
+
+int ipcp_create_r__irm_req_ser(buffer_t * buf,
+ const struct ipcp_info * ipcp);
+
+int proc_announce__irm_req_ser(buffer_t * buf,
+ const char * prog);
+
+int proc_exit__irm_req_ser(buffer_t * buf);
+
+int irm__irm_result_des(buffer_t * buf);
+
+#endif /* OUROBOROS_LIB_SERDES_IRM_H*/
diff --git a/include/ouroboros/sockets.h.in b/include/ouroboros/sockets.h.in
index cd198781..095674a9 100644
--- a/include/ouroboros/sockets.h.in
+++ b/include/ouroboros/sockets.h.in
@@ -23,18 +23,17 @@
#ifndef OUROBOROS_LIB_SOCKETS_H
#define OUROBOROS_LIB_SOCKETS_H
-#include <sys/types.h>
+#include <ouroboros/protobuf.h>
-#include "irm.pb-c.h"
-typedef IrmMsg irm_msg_t;
+#include <sys/types.h>
-#define SOCK_PATH "/var/run/ouroboros/"
-#define SOCK_PATH_SUFFIX ".sock"
+#define SOCK_PATH "/var/run/ouroboros/"
+#define SOCK_PATH_SUFFIX ".sock"
-#define IRM_SOCK_PATH SOCK_PATH "irm" SOCK_PATH_SUFFIX
+#define IRM_SOCK_PATH SOCK_PATH "irm" SOCK_PATH_SUFFIX
#define IPCP_SOCK_PATH_PREFIX SOCK_PATH "ipcp"
-#define SOCK_BUF_SIZE @SOCK_BUF_SIZE@
+#define SOCK_BUF_SIZE @SOCK_BUF_SIZE@
/* Returns the full socket path of an IPCP */
char * ipcp_sock_path(pid_t pid);
@@ -43,8 +42,9 @@ int server_socket_open(char * file_name);
int client_socket_open(char * file_name);
-irm_msg_t * send_recv_irm_msg(irm_msg_t * msg);
+int send_recv_msg(buffer_t * buf);
+irm_msg_t * send_recv_irm_msg(irm_msg_t * msg);
/* cleanup socket when cancelling thread */
void __cleanup_close_ptr(void * o);