summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/ouroboros/CMakeLists.txt2
-rw-r--r--include/ouroboros/dev.h25
-rw-r--r--include/ouroboros/fcntl.h (renamed from include/ouroboros/flow.h)10
-rw-r--r--include/ouroboros/ipcp-dev.h50
-rw-r--r--include/ouroboros/ipcp.h81
-rw-r--r--include/ouroboros/local-dev.h (renamed from include/ouroboros/common.h)22
-rw-r--r--include/ouroboros/np1_flow.h42
-rw-r--r--include/ouroboros/shared.h7
-rw-r--r--include/ouroboros/shm_ap_rbuff.h12
-rw-r--r--include/ouroboros/shm_rdrbuff.h59
-rw-r--r--include/ouroboros/sockets.h4
-rw-r--r--include/ouroboros/utils.h17
-rw-r--r--include/ouroboros/wrap/ouroboros.i4
13 files changed, 174 insertions, 161 deletions
diff --git a/include/ouroboros/CMakeLists.txt b/include/ouroboros/CMakeLists.txt
index 78a7bb9c..f24857ed 100644
--- a/include/ouroboros/CMakeLists.txt
+++ b/include/ouroboros/CMakeLists.txt
@@ -6,7 +6,7 @@ set(HEADER_FILES
cdap.h
dev.h
errno.h
- flow.h
+ fcntl.h
irm.h
irm_config.h
nsm.h
diff --git a/include/ouroboros/dev.h b/include/ouroboros/dev.h
index fe5ff4b5..25299ee3 100644
--- a/include/ouroboros/dev.h
+++ b/include/ouroboros/dev.h
@@ -20,11 +20,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <unistd.h>
-#include <stdint.h>
-
#include <ouroboros/qos.h>
-#include <ouroboros/flow.h>
+
+#include <unistd.h>
#ifndef OUROBOROS_DEV_H
#define OUROBOROS_DEV_H
@@ -36,32 +34,29 @@ int ap_init(char * ap_name);
void ap_fini(void);
-/* Returns file descriptor (> 0) and client AE name. */
+/* Returns flow descriptor (> 0) and client AE name. */
int flow_accept(char ** ae_name);
-int flow_alloc_resp(int fd, int result);
+int flow_alloc_resp(int fd,
+ int response);
/*
- * Returns file descriptor (> 0).
+ * Returns flow descriptor (> 0).
* On returning, qos will contain the actual supplied QoS.
*/
-int flow_alloc(char * dst_name,
- char * src_ae_name,
+int flow_alloc(char * dst_name,
+ char * src_ae_name,
struct qos_spec * qos);
int flow_alloc_res(int fd);
int flow_dealloc(int fd);
-int flow_cntl(int fd,
- int cmd,
- int oflags);
-
-ssize_t flow_write(int fd,
+ssize_t flow_write(int fd,
void * buf,
size_t count);
-ssize_t flow_read(int fd,
+ssize_t flow_read(int fd,
void * buf,
size_t count);
diff --git a/include/ouroboros/flow.h b/include/ouroboros/fcntl.h
index 754c7632..ccb45996 100644
--- a/include/ouroboros/flow.h
+++ b/include/ouroboros/fcntl.h
@@ -20,8 +20,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ifndef OUROBOROS_FLOW_H
-#define OUROBOROS_FLOW_H
+#ifndef OUROBOROS_FCNTL_H
+#define OUROBOROS_FCNTL_H
/* same values as fcntl.h */
#define FLOW_O_RDONLY 00000000
@@ -37,4 +37,8 @@
#define FLOW_F_GETFL 00000001
#define FLOW_F_SETFL 00000002
-#endif /* OUROBOROS_FLOW_H */
+int flow_cntl(int fd,
+ int cmd,
+ int oflags);
+
+#endif /* OUROBOROS_FCNTL_H */
diff --git a/include/ouroboros/ipcp-dev.h b/include/ouroboros/ipcp-dev.h
new file mode 100644
index 00000000..3c2ff264
--- /dev/null
+++ b/include/ouroboros/ipcp-dev.h
@@ -0,0 +1,50 @@
+/*
+ * Ouroboros - Copyright (C) 2016
+ *
+ * Additional API for IPCPs
+ *
+ * Dimitri Staessens <dimitri.staessens@intec.ugent.be>
+ * 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.
+ */
+
+#include <unistd.h>
+#include <time.h>
+
+#include <ouroboros/qos.h>
+#include <ouroboros/shm_rdrbuff.h>
+
+#ifndef OUROBOROS_IPCP_DEV_H
+#define OUROBOROS_IPCP_DEV_H
+
+int ipcp_create_r(pid_t api);
+
+int ipcp_flow_req_arr(pid_t api,
+ char * dst_name,
+ char * src_ae_name);
+
+int ipcp_flow_alloc_reply(int fd,
+ int response);
+
+/* returns flow descriptor and du buff */
+int ipcp_flow_read(struct shm_du_buff ** sdb);
+
+int ipcp_flow_write(int fd,
+ struct shm_du_buff * sdb);
+
+void ipcp_flow_del(struct shm_du_buff * sdb);
+
+#endif /* OUROBOROS_IPCP_DEV_H */
diff --git a/include/ouroboros/ipcp.h b/include/ouroboros/ipcp.h
deleted file mode 100644
index 98337da6..00000000
--- a/include/ouroboros/ipcp.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Ouroboros - Copyright (C) 2016
- *
- * The API for the IRM to instruct 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.
- */
-
-#include <ouroboros/irm_config.h>
-#include <ouroboros/sockets.h>
-#include <ouroboros/shared.h>
-
-#include <sys/types.h>
-
-#ifndef OUROBOROS_IPCP_H
-#define OUROBOROS_IPCP_H
-
-struct ipcp;
-
-/* Returns the process id */
-pid_t ipcp_create(enum ipcp_type ipcp_type);
-
-/* IPCP calls this when it is initialized */
-int ipcp_create_r(pid_t api);
-
-int ipcp_destroy(pid_t api);
-
-int ipcp_enroll(pid_t api,
- char * dif_name);
-
-int ipcp_bootstrap(pid_t api,
- dif_config_msg_t * conf);
-
-/* Flow related ops, these go from IRMd to IPCP */
-
-int ipcp_name_reg(pid_t api,
- char * name);
-int ipcp_name_unreg(pid_t api,
- char * name);
-
-int ipcp_flow_alloc(pid_t api,
- int port_id,
- pid_t n_api,
- char * dst_name,
- char * src_ae_name,
- enum qos_cube qos);
-int ipcp_flow_alloc_resp(pid_t api,
- int port_id,
- pid_t n_api,
- int response);
-
-/* These operations go from the IPCP to the IRMd */
-
-/* Returns the port_id */
-int ipcp_flow_req_arr(pid_t api,
- char * dst_name,
- char * src_ae_name);
-int ipcp_flow_alloc_reply(pid_t api,
- int port_id,
- int response);
-
-int ipcp_flow_dealloc(pid_t api,
- int port_id);
-
-int irm_flow_dealloc(int port_id);
-
-#endif /* OUROBOROS_IPCP_H */
diff --git a/include/ouroboros/common.h b/include/ouroboros/local-dev.h
index dbd050f1..b4915672 100644
--- a/include/ouroboros/common.h
+++ b/include/ouroboros/local-dev.h
@@ -1,9 +1,9 @@
/*
* Ouroboros - Copyright (C) 2016
*
- * Common definitions
+ * Optimized calls for the local IPCPs
*
- * 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
@@ -20,15 +20,15 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ifndef OUROBOROS_COMMON_H
-#define OUROBOROS_COMMON_H
+#include <ouroboros/shm_ap_rbuff.h>
-#include <stdint.h>
-#include <unistd.h>
+#ifndef OUROBOROS_LOCAL_DEV_H
+#define OUROBOROS_LOCAL_DEV_H
-typedef struct {
- uint8_t * data;
- size_t len;
-} buffer_t;
+/* returns flow descriptor and rb_entry, no access to du_buff */
+int local_flow_read(struct rb_entry * e);
-#endif /* OUROBOROS_COMMON_H */
+int local_flow_write(int fd,
+ struct rb_entry * e);
+
+#endif /* OUROBOROS_LOCAL_DEV_H */
diff --git a/include/ouroboros/np1_flow.h b/include/ouroboros/np1_flow.h
new file mode 100644
index 00000000..c89af70e
--- /dev/null
+++ b/include/ouroboros/np1_flow.h
@@ -0,0 +1,42 @@
+/*
+ * Ouroboros - Copyright (C) 2016
+ *
+ * Adapter functions for N + 1 flow descriptors
+ *
+ * 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
+ * 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.
+ */
+
+#include <unistd.h>
+#include <stdint.h>
+#include <time.h>
+
+#include <ouroboros/qos.h>
+#include <ouroboros/flow.h>
+#include <ouroboros/shm_rdrbuff.h>
+
+#ifndef OUROBOROS_NP1_FLOW_H
+#define OUROBOROS_NP1_FLOW_H
+
+int np1_flow_alloc(pid_t n_api,
+ int port_id);
+
+int np1_flow_resp(pid_t n_api,
+ int port_id);
+
+int np1_flow_dealloc(int port_id);
+
+#endif /* OUROBOROS_NP1_FLOW_H */
diff --git a/include/ouroboros/shared.h b/include/ouroboros/shared.h
index bfd99eb0..c38b1bde 100644
--- a/include/ouroboros/shared.h
+++ b/include/ouroboros/shared.h
@@ -30,11 +30,4 @@ enum qos_cube {
QOS_MAX
};
-enum flow_state {
- FLOW_NULL = 0,
- FLOW_PENDING,
- FLOW_ALLOCATED,
- FLOW_DESTROY
-};
-
#endif /* OUROBOROS_SHARED_H */
diff --git a/include/ouroboros/shm_ap_rbuff.h b/include/ouroboros/shm_ap_rbuff.h
index 6b11fd2d..89d9876d 100644
--- a/include/ouroboros/shm_ap_rbuff.h
+++ b/include/ouroboros/shm_ap_rbuff.h
@@ -36,17 +36,9 @@ struct rb_entry {
int port_id;
};
-/* recv SDUs from N + 1 */
-struct shm_ap_rbuff * shm_ap_rbuff_create_n();
+struct shm_ap_rbuff * shm_ap_rbuff_create();
-/* recv SDUs from N - 1 */
-struct shm_ap_rbuff * shm_ap_rbuff_create_s();
-
-/* write SDUs to N - 1 */
-struct shm_ap_rbuff * shm_ap_rbuff_open_n(pid_t api);
-
-/* write SDUs to N + 1 */
-struct shm_ap_rbuff * shm_ap_rbuff_open_s(pid_t api);
+struct shm_ap_rbuff * shm_ap_rbuff_open(pid_t api);
void shm_ap_rbuff_close(struct shm_ap_rbuff * rb);
diff --git a/include/ouroboros/shm_rdrbuff.h b/include/ouroboros/shm_rdrbuff.h
index 7a7049e3..f1be3652 100644
--- a/include/ouroboros/shm_rdrbuff.h
+++ b/include/ouroboros/shm_rdrbuff.h
@@ -33,6 +33,8 @@
struct shm_du_buff;
struct shm_rdrbuff;
+size_t shm_du_buff_get_idx(struct shm_du_buff * sdb);
+
struct shm_rdrbuff * shm_rdrbuff_create();
struct shm_rdrbuff * shm_rdrbuff_open();
@@ -44,40 +46,43 @@ void shm_rdrbuff_destroy(struct shm_rdrbuff * rdrb);
void * shm_rdrbuff_sanitize(void * o);
/* returns the index of the buffer in the DU map */
-ssize_t shm_rdrbuff_write(struct shm_rdrbuff * rdrb,
- pid_t dst_api,
- size_t headspace,
- size_t tailspace,
- uint8_t * data,
- size_t data_len);
+ssize_t shm_rdrbuff_write(struct shm_rdrbuff * rdrb,
+ pid_t dst_api,
+ size_t headspace,
+ size_t tailspace,
+ uint8_t * data,
+ size_t data_len);
+
+ssize_t shm_rdrbuff_write_b(struct shm_rdrbuff * rdrb,
+ pid_t dst_api,
+ size_t headspace,
+ size_t tailspace,
+ uint8_t * data,
+ size_t data_len);
-ssize_t shm_rdrbuff_write_b(struct shm_rdrbuff * rdrb,
- pid_t dst_api,
- size_t headspace,
- size_t tailspace,
- uint8_t * data,
- size_t data_len);
+int shm_rdrbuff_read(uint8_t ** dst,
+ struct shm_rdrbuff * rdrb,
+ ssize_t idx);
-int shm_rdrbuff_read(uint8_t ** dst,
- struct shm_rdrbuff * rdrb,
- ssize_t idx);
+struct shm_du_buff * shm_rdrbuff_get(struct shm_rdrbuff * rdrb,
+ ssize_t idx);
-int shm_rdrbuff_remove(struct shm_rdrbuff * rdrb,
- ssize_t idx);
+int shm_rdrbuff_remove(struct shm_rdrbuff * rdrb,
+ ssize_t idx);
-uint8_t * shm_du_buff_head(struct shm_du_buff * sdb);
+uint8_t * shm_du_buff_head(struct shm_du_buff * sdb);
-uint8_t * shm_du_buff_tail(struct shm_du_buff * sdb);
+uint8_t * shm_du_buff_tail(struct shm_du_buff * sdb);
-uint8_t * shm_du_buff_head_alloc(struct shm_du_buff * sdb,
- size_t size);
+uint8_t * shm_du_buff_head_alloc(struct shm_du_buff * sdb,
+ size_t size);
-uint8_t * shm_du_buff_tail_alloc(struct shm_du_buff * sdb,
- size_t size);
+uint8_t * shm_du_buff_tail_alloc(struct shm_du_buff * sdb,
+ size_t size);
-int shm_du_buff_head_release(struct shm_du_buff * sdb,
- size_t size);
+int shm_du_buff_head_release(struct shm_du_buff * sdb,
+ size_t size);
-int shm_du_buff_tail_release(struct shm_du_buff * sdb,
- size_t size);
+int shm_du_buff_tail_release(struct shm_du_buff * sdb,
+ size_t size);
#endif /* OUROBOROS_SHM_RDRBUFF_H */
diff --git a/include/ouroboros/sockets.h b/include/ouroboros/sockets.h
index 5d654cb1..aef4259e 100644
--- a/include/ouroboros/sockets.h
+++ b/include/ouroboros/sockets.h
@@ -23,8 +23,6 @@
#ifndef OUROBOROS_SOCKETS_H
#define OUROBOROS_SOCKETS_H
-#include <ouroboros/common.h>
-
#include <sys/types.h>
#include "dif_config.pb-c.h"
@@ -49,9 +47,11 @@ typedef IpcpMsg ipcp_msg_t;
char * ipcp_sock_path(pid_t api);
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);
+
irm_msg_t * send_recv_irm_msg_b(irm_msg_t * msg);
#endif
diff --git a/include/ouroboros/utils.h b/include/ouroboros/utils.h
index 17bd41ee..cf9a49bc 100644
--- a/include/ouroboros/utils.h
+++ b/include/ouroboros/utils.h
@@ -20,8 +20,19 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#define MAX(a,b) (a > b ? a : b)
-#define MIN(a,b) (a < b ? a : b)
+#ifndef OUROBOROS_UTILS_H
+#define OUROBOROS_UTILS_H
+
+#include <stdint.h>
+#include <unistd.h>
+
+#define MIN(a,b) (((a) < (b)) ? (a) : (b))
+#define MAX(a,b) (((a) > (b)) ? (a) : (b))
+
+typedef struct {
+ uint8_t * data;
+ size_t len;
+} buffer_t;
/*
* Returns the number of characters a uint would
@@ -34,3 +45,5 @@ char * strdup(const char * src);
/* gets the application name */
char * path_strip(char * src);
+
+#endif /* OUROBOROS_UTILS_H */
diff --git a/include/ouroboros/wrap/ouroboros.i b/include/ouroboros/wrap/ouroboros.i
index 2f66aa16..394b505a 100644
--- a/include/ouroboros/wrap/ouroboros.i
+++ b/include/ouroboros/wrap/ouroboros.i
@@ -25,7 +25,7 @@
#include "ouroboros/cdap.h"
#include "ouroboros/dev.h"
#include "ouroboros/errno.h"
-#include "ouroboros/flow.h"
+#include "ouroboros/fcntl.h"
#include "ouroboros/irm.h"
#include "ouroboros/irm_config.h"
#include "ouroboros/nsm.h"
@@ -38,7 +38,7 @@ typedef int pid_t;
%include "ouroboros/cdap.h"
%include "ouroboros/dev.h"
%include "ouroboros/errno.h"
-%include "ouroboros/flow.h"
+%include "ouroboros/fcntl.h"
%include "ouroboros/irm.h"
%include "ouroboros/irm_config.h"
%include "ouroboros/nsm.h"