summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@ugent.be>2017-08-30 17:11:22 +0200
committerdimitri staessens <dimitri.staessens@ugent.be>2017-08-31 09:18:41 +0200
commit4060efec26115dbb9e68da67bc482a12b4f80ea8 (patch)
tree559ab25cc65cbac1ddda458f8370e8ee2675edf8 /include
parent8fe0340d2117cf9b5c724ff10621978ef2bee5f1 (diff)
downloadouroboros-4060efec26115dbb9e68da67bc482a12b4f80ea8.tar.gz
ouroboros-4060efec26115dbb9e68da67bc482a12b4f80ea8.zip
lib: Add fccntl configuration command
This replaces the flow_set_* commands with a single fccntl command that can configure flows and the FRCT instance. For more details, see "man 3 fccntl".
Diffstat (limited to 'include')
-rw-r--r--include/ouroboros/CMakeLists.txt2
-rw-r--r--include/ouroboros/fccntl.h67
-rw-r--r--include/ouroboros/fcntl.h59
-rw-r--r--include/ouroboros/frct_pci.h10
-rw-r--r--include/ouroboros/qos.h13
-rw-r--r--include/ouroboros/wrap/CMakeLists.txt2
-rw-r--r--include/ouroboros/wrap/ouroboros.i4
7 files changed, 79 insertions, 78 deletions
diff --git a/include/ouroboros/CMakeLists.txt b/include/ouroboros/CMakeLists.txt
index e39759fd..b6edac53 100644
--- a/include/ouroboros/CMakeLists.txt
+++ b/include/ouroboros/CMakeLists.txt
@@ -4,7 +4,7 @@ set(HEADER_FILES
cdefs.h
dev.h
errno.h
- fcntl.h
+ fccntl.h
fqueue.h
ipcp.h
irm.h
diff --git a/include/ouroboros/fccntl.h b/include/ouroboros/fccntl.h
new file mode 100644
index 00000000..d938439f
--- /dev/null
+++ b/include/ouroboros/fccntl.h
@@ -0,0 +1,67 @@
+/*
+ * Ouroboros - Copyright (C) 2016 - 2017
+ *
+ * Flow and FRCT connection control
+ *
+ * Dimitri Staessens <dimitri.staessens@ugent.be>
+ * Sander Vrijders <sander.vrijders@ugent.be>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., http://www.fsf.org/about/contact/.
+ */
+
+#ifndef OUROBOROS_FCCNTL_H
+#define OUROBOROS_FCCNTL_H
+
+#include <ouroboros/cdefs.h>
+
+#include <sys/time.h>
+
+/* Flow flags, same values as fcntl.h */
+#define FLOWFRDONLY 00000000 /* Read-only flow */
+#define FLOWFWRONLY 00000001 /* Write-only flow */
+#define FLOWFRDWR 00000002 /* Read-write flow */
+#define FLOWFACCMODE 00000003 /* Access mask */
+
+#define FLOWFNONBLOCK 00004000 /* Non-blocking flow */
+#define FLOWFDEFAULT 00000002 /* Default, blocking, rw */
+
+#define FLOWFINVALID (FLOWFWRONLY | FLOWFRDWR)
+
+/* FRCT flags */
+#define FRCTFRESCNTRL 00000001 /* Feedback from receiver */
+#define FRCTFRTX 00000002 /* Reliable flow */
+#define FRCTFERRCHCK 00000004 /* Check for errors */
+#define FRCTFORDERING 00000010 /* Ordered delivery */
+#define FRCTFPARTIAL 00000020 /* Allow partial delivery */
+
+/* Operations */
+#define FLOWSRCVTIMEO 00000001 /* Set read timeout */
+#define FLOWGRCVTIMEO 00000002 /* Get read timeout */
+#define FLOWSSNDTIMEO 00000003 /* Set send timeout */
+#define FLOWGSNDTIMEO 00000004 /* Get send timeout */
+#define FLOWGQOSSPEC 00000005 /* Get qosspec_t */
+#define FLOWSFLAGS 00000006 /* Set flags for flow */
+#define FLOWGFLAGS 00000007 /* Get flags for flow */
+#define FRCTSFLAGS 00000010 /* Set flags for FRCT */
+#define FRCTGFLAGS 00000011 /* Get flags for FRCT */
+
+__BEGIN_DECLS
+
+int fccntl(int fd,
+ int cmd,
+ ...);
+
+__END_DECLS
+
+#endif /* OUROBOROS_FCCNTL_H */
diff --git a/include/ouroboros/fcntl.h b/include/ouroboros/fcntl.h
deleted file mode 100644
index 655a0a03..00000000
--- a/include/ouroboros/fcntl.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Ouroboros - Copyright (C) 2016 - 2017
- *
- * Flows
- *
- * Dimitri Staessens <dimitri.staessens@ugent.be>
- * Sander Vrijders <sander.vrijders@ugent.be>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., http://www.fsf.org/about/contact/.
- */
-
-#ifndef OUROBOROS_FCNTL_H
-#define OUROBOROS_FCNTL_H
-
-#include <ouroboros/cdefs.h>
-
-#include <sys/time.h>
-
-/* same values as fcntl.h */
-#define FLOW_O_RDONLY 00000000
-#define FLOW_O_WRONLY 00000001
-#define FLOW_O_RDWR 00000002
-#define FLOW_O_ACCMODE 00000003
-
-#define FLOW_O_NONBLOCK 00004000
-#define FLOW_O_DEFAULT 00000002
-
-#define FLOW_O_INVALID (FLOW_O_WRONLY | FLOW_O_RDWR)
-
-__BEGIN_DECLS
-
-int flow_set_flags(int fd,
- int flags);
-
-int flow_get_flags(int fd);
-
-int flow_set_timeout(int fd,
- const struct timespec * to);
-
-int flow_get_timeout(int fd,
- struct timespec * to);
-
-int flow_get_qosspec(int fd,
- qosspec_t * qs);
-
-__END_DECLS
-
-#endif /* OUROBOROS_FCNTL_H */
diff --git a/include/ouroboros/frct_pci.h b/include/ouroboros/frct_pci.h
index 601c0ce4..a919bc60 100644
--- a/include/ouroboros/frct_pci.h
+++ b/include/ouroboros/frct_pci.h
@@ -35,7 +35,7 @@ struct frct_pci {
uint64_t seqno;
/* Present in config PDU. */
- uint8_t conf_flags;
+ uint16_t conf_flags;
/* Present in flow control PDU. */
uint64_t lwe;
@@ -51,14 +51,6 @@ enum pdu_types {
PDU_TYPE_RENDEZ_VOUS = 0x10
};
-enum config_flags {
- CONF_RESOURCE_CONTROL = 0x01,
- CONF_RELIABLE = 0x02,
- CONF_ERROR_CHECK = 0x04,
- CONF_ORDERED = 0x08,
- CONF_PARTIAL = 0x10
-};
-
enum data_flags {
FLAG_DATA_RUN = 0x01,
FLAG_MORE_FRAGMENTS = 0x02
diff --git a/include/ouroboros/qos.h b/include/ouroboros/qos.h
index f68df911..3d43dc31 100644
--- a/include/ouroboros/qos.h
+++ b/include/ouroboros/qos.h
@@ -31,15 +31,14 @@ typedef struct qos_spec {
uint64_t bandwidth; /* In bits/s */
uint8_t availability; /* Class of 9s */
uint32_t maximum_interruption; /* In ms */
-
- bool resource_control; /* Feedback from receiver */
- bool reliable; /* Reliable flow */
- bool error_check; /* Check for errors */
- bool ordered; /* Ordered delivery */
- bool partial; /* Allow partial delivery */
} qosspec_t;
+__BEGIN_DECLS
+
int qosspec_init(qosspec_t * qs);
+
int qosspec_fini(qosspec_t * qs);
-#endif
+__END_DECLS
+
+#endif /* OUROBOROS_QOS_H */
diff --git a/include/ouroboros/wrap/CMakeLists.txt b/include/ouroboros/wrap/CMakeLists.txt
index 435b3b70..44c652d5 100644
--- a/include/ouroboros/wrap/CMakeLists.txt
+++ b/include/ouroboros/wrap/CMakeLists.txt
@@ -17,6 +17,8 @@ else ()
# Python assumes C99 since Python 3.6
test_and_set_c_compiler_flag_global(-std=c99)
+ # SWIG generates code for varargs with an unused parameter
+ test_and_set_c_compiler_flag_global(-Wno-unused-parameter)
# CMake > 3.8 deprecates swig_add_module
if (${CMAKE_VERSION} VERSION_LESS 3.8.0)
diff --git a/include/ouroboros/wrap/ouroboros.i b/include/ouroboros/wrap/ouroboros.i
index 4bf343b9..ebda2453 100644
--- a/include/ouroboros/wrap/ouroboros.i
+++ b/include/ouroboros/wrap/ouroboros.i
@@ -26,7 +26,7 @@
#include "ouroboros/cdap.h"
#include "ouroboros/dev.h"
#include "ouroboros/errno.h"
-#include "ouroboros/fcntl.h"
+#include "ouroboros/fccntl.h"
#include "ouroboros/fqueue.h"
#include "ouroboros/irm.h"
#include "ouroboros/ipcp.h"
@@ -41,7 +41,7 @@ typedef int pid_t;
%include "ouroboros/cdap.h"
%include "ouroboros/dev.h"
%include "ouroboros/errno.h"
-%include "ouroboros/fcntl.h"
+%include "ouroboros/fccntl.h"
%include "ouroboros/fqueue.h"
%include "ouroboros/irm.h"
%include "ouroboros/ipcp.h"