summaryrefslogtreecommitdiff
path: root/include/ouroboros
diff options
context:
space:
mode:
Diffstat (limited to 'include/ouroboros')
-rw-r--r--include/ouroboros/CMakeLists.txt18
-rw-r--r--include/ouroboros/cdap.h182
-rw-r--r--include/ouroboros/common.h16
-rw-r--r--include/ouroboros/ipcp.h2
-rw-r--r--include/ouroboros/shared.h38
-rw-r--r--include/ouroboros/shm_du_map.h4
6 files changed, 107 insertions, 153 deletions
diff --git a/include/ouroboros/CMakeLists.txt b/include/ouroboros/CMakeLists.txt
index 68c88a18..ee339294 100644
--- a/include/ouroboros/CMakeLists.txt
+++ b/include/ouroboros/CMakeLists.txt
@@ -3,14 +3,14 @@ configure_file(
"${CMAKE_CURRENT_BINARY_DIR}/config.h")
set(HEADER_FILES
- cdap.h
- dev.h
- errno.h
- flow.h
- irm.h
- irm_config.h
- nsm.h
- qos.h
-)
+ cdap.h
+ common.h
+ dev.h
+ errno.h
+ flow.h
+ irm.h
+ irm_config.h
+ nsm.h
+ qos.h)
install(FILES ${HEADER_FILES} DESTINATION usr/include/ouroboros)
diff --git a/include/ouroboros/cdap.h b/include/ouroboros/cdap.h
index 72788ad6..da669feb 100644
--- a/include/ouroboros/cdap.h
+++ b/include/ouroboros/cdap.h
@@ -4,6 +4,7 @@
* The Common Distributed Application Protocol
*
* Sander Vrijders <sander.vrijders@intec.ugent.be>
+ * Dimitri Staessens <dimitri.staessens@intec.ugent.be>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,148 +24,75 @@
#ifndef OUROBOROS_CDAP_H
#define OUROBOROS_CDAP_H
+#include <ouroboros/common.h>
+
#include <stdbool.h>
+#include <stdint.h>
+#include <unistd.h>
+
+#define F_SYNC 0x0001
struct cdap;
+/* Callback functions that work on the application's RIB */
struct cdap_ops {
- /* Sender related callbacks */
- int (* handle_connect_r)(int fd,
- int invoke_id,
- int result);
- int (* handle_release_r)(int fd,
- int invoke_id,
- int result);
- int (* handle_read_r)(int fd,
- int invoke_id,
- int result,
- char * reason,
- char * obj_val,
- bool complete);
- int (* handle_cancelread_r)(int fd,
- int invoke_id,
- int result);
- int (* handle_write_r)(int fd,
- int invoke_id,
- int result,
- char * reason,
- char * obj_val);
- int (* handle_create_r)(int fd,
- int invoke_id,
- int result);
- int (* handle_delete_r)(int fd,
- int invoke_id,
- int result);
- int (* handle_start_r)(int fd,
- int invoke_id,
- int result);
- int (* handle_stop_r)(int fd,
- int invoke_id,
- int result);
+ int (* cdap_reply)(struct cdap * instance,
+ int invoke_id,
+ int result,
+ buffer_t * val,
+ size_t len);
+
+ int (* cdap_read)(struct cdap * instance,
+ char * name);
+ int (* cdap_write)(struct cdap * instance,
+ char * name,
+ buffer_t * val,
+ size_t len,
+ uint32_t flags);
- /* Receiver related callbacks */
- int (* handle_connect)(int fd,
- int invoke_id,
- rina_name_t src,
- rina_name_t dst,
- char * auth_mech,
- char * auth_val);
- int (* handle_release)(int fd,
- int invoke_id);
- int (* handle_cancelread)(int fd,
- int invoke_id);
- int (* handle_write)(int fd,
- int invoke_id,
- char * obj_name,
- char * obj_val);
- int (* handle_create)(int fd,
- int invoke_id,
- char * obj_class,
- char * obj_name,
- char * obj_val);
- int (* handle_delete)(int fd,
- int invoke_id,
- char * obj_name);
- int (* handle_start)(int fd,
- int invoke_id,
- char * obj_name,
- char * obj_val);
- int (* handle_stop)(int fd,
- int invoke_id,
- char * obj_name,
- char * obj_val);
+ int (* cdap_create)(struct cdap * instance,
+ char * name,
+ buffer_t val);
+ int (* cdap_delete)(struct cdap * instance,
+ char * name,
+ buffer_t val);
+
+ int (* cdap_start)(struct cdap * instance,
+ char * name);
+ int (* cdap_stop)(struct cdap * instance,
+ char * name);
};
-struct cdap * cdap_create(struct cdap_ops ops,
- int fd);
+/* Assumes flow is blocking */
+struct cdap * cdap_create(struct cdap_ops * ops,
+ int fd);
int cdap_destroy(struct cdap * instance);
-/* Sender related functions */
-int cdap_send_connect(struct cdap * instance,
- int invoke_id,
- rina_name_t src,
- rina_name_t dst,
- char * auth_mech,
- char * auth_val);
-int cdap_send_release(struct cdap * instance,
- int invoke_id);
+/* Returns a positive invoke-id on success to be used in the callback */
int cdap_send_read(struct cdap * instance,
- int invoke_id,
- char * obj_name);
-int cdap_send_cancelread(struct cdap * instance,
- int invoke_id,
- char * obj_name);
+ char * name);
int cdap_send_write(struct cdap * instance,
- int invoke_id,
- char * obj_name,
- char * obj_val);
+ char * name,
+ buffer_t * val,
+ size_t len,
+ uint32_t flags);
+
int cdap_send_create(struct cdap * instance,
- int invoke_id,
- char * obj_name,
- char * obj_val);
+ char * name,
+ buffer_t val);
int cdap_send_delete(struct cdap * instance,
- int invoke_id,
- char * obj_name);
+ char * name,
+ buffer_t val);
+
int cdap_send_start(struct cdap * instance,
- int invoke_id,
- char * obj_name,
- char * obj_val);
+ char * name);
int cdap_send_stop(struct cdap * instance,
- int invoke_id,
- char * obj_name,
- char * obj_val);
+ char * name);
-/* Receiver related functions */
-int cdap_send_connect_r(struct cdap * instance,
- int invoke_id,
- int result);
-int cdap_send_release_r(struct cdap * instance,
- int invoke_id,
- int result);
-int cdap_send_read_r(struct cdap * instance,
- int invoke_id,
- int result,
- char * reason,
- char * obj_val,
- bool complete);
-int cdap_send_cancelread_r(struct cdap * instance,
- int invoke_id,
- int result);
-int cdap_send_write_r(struct cdap * instance,
- int invoke_id,
- int result,
- char * obj_name,
- char * obj_val);
-int cdap_send_create_r(struct cdap * instance,
- int invoke_id,
- int result);
-int cdap_send_delete_r(struct cdap * instance,
- int invoke_id,
- int result);
-int cdap_send_start_r(struct cdap * instance,
- int invoke_id,
- int result);
-int cdap_send_stop_r(struct cdap * instance,
- int invoke_id,
- int result);
+/* Can only be called following a callback function */
+int cdap_send_reply(struct cdap * instance,
+ int invoke_id,
+ int result,
+ buffer_t * val,
+ size_t len);
#endif
diff --git a/include/ouroboros/common.h b/include/ouroboros/common.h
index 039e1a83..dbd050f1 100644
--- a/include/ouroboros/common.h
+++ b/include/ouroboros/common.h
@@ -25,24 +25,10 @@
#include <stdint.h>
#include <unistd.h>
-#include <stdbool.h>
-#include <errno.h>
typedef struct {
uint8_t * data;
- size_t size;
+ size_t len;
} buffer_t;
-/* FIXME: To be decided which QoS cubes we support */
-enum qos_cube {
- QOS_CUBE_BE = 0,
- QOS_CUBE_VIDEO
-};
-
-enum flow_state {
- FLOW_NULL = 0,
- FLOW_PENDING,
- FLOW_ALLOCATED
-};
-
#endif /* OUROBOROS_COMMON_H */
diff --git a/include/ouroboros/ipcp.h b/include/ouroboros/ipcp.h
index f5657b64..c1aa452b 100644
--- a/include/ouroboros/ipcp.h
+++ b/include/ouroboros/ipcp.h
@@ -22,7 +22,7 @@
#include <ouroboros/irm_config.h>
#include <ouroboros/sockets.h>
-#include <ouroboros/common.h>
+#include <ouroboros/shared.h>
#include <sys/types.h>
diff --git a/include/ouroboros/shared.h b/include/ouroboros/shared.h
new file mode 100644
index 00000000..f5e34dc8
--- /dev/null
+++ b/include/ouroboros/shared.h
@@ -0,0 +1,38 @@
+/*
+ * Ouroboros - Copyright (C) 2016
+ *
+ * Shared definitions between IRMd and IPCPs
+ *
+ * Sander Vrijders <sander.vrijders@intec.ugent.be>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef OUROBOROS_SHARED_H
+#define OUROBOROS_SHARED_H
+
+/* FIXME: To be decided which QoS cubes we support */
+enum qos_cube {
+ QOS_CUBE_BE = 0,
+ QOS_CUBE_VIDEO
+};
+
+enum flow_state {
+ FLOW_NULL = 0,
+ FLOW_PENDING,
+ FLOW_ALLOCATED
+};
+
+#endif /* OUROBOROS_SHARED_H */
diff --git a/include/ouroboros/shm_du_map.h b/include/ouroboros/shm_du_map.h
index e8934bae..9d6d7aaf 100644
--- a/include/ouroboros/shm_du_map.h
+++ b/include/ouroboros/shm_du_map.h
@@ -24,7 +24,9 @@
#ifndef OUROBOROS_SHM_DU_MAP_H
#define OUROBOROS_SHM_DU_MAP_H
-#include "common.h"
+#include <errno.h>
+#include <unistd.h>
+#include <stdint.h>
#include <sys/types.h>
#include <pthread.h>