summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri.staessens@ugent.be>2018-05-14 09:20:44 +0200
committerSander Vrijders <sander.vrijders@ugent.be>2018-05-14 11:40:09 +0200
commit38cfdc212c623a46038f005b0c1604c3fdaf3762 (patch)
tree57d9c0860f014afc9cb10de022d3e72fe4fa8fbc /include
parenteaf14819c8cdab3c5ae1d678b0a12977f8b2d9e1 (diff)
downloadouroboros-38cfdc212c623a46038f005b0c1604c3fdaf3762.tar.gz
ouroboros-38cfdc212c623a46038f005b0c1604c3fdaf3762.zip
lib: Add event types to fqueue
The event type of the current event in the fqueue can now be requested using the fqueue_type() command. Currently events for packets (FLOW_PKT), flows (FLOW_UP, FLOW_DOWN) and allocation (FLOW_ALLOC, FLOW_DEALLOC) are specified. The implementation only tracks FLOW_PKT at this point. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
Diffstat (limited to 'include')
-rw-r--r--include/ouroboros/fqueue.h40
-rw-r--r--include/ouroboros/shm_flow_set.h3
2 files changed, 27 insertions, 16 deletions
diff --git a/include/ouroboros/fqueue.h b/include/ouroboros/fqueue.h
index 1b102669..8a5dc988 100644
--- a/include/ouroboros/fqueue.h
+++ b/include/ouroboros/fqueue.h
@@ -28,6 +28,14 @@
#include <stdbool.h>
#include <time.h>
+enum fqtype {
+ FLOW_PKT = 0,
+ FLOW_DOWN,
+ FLOW_UP,
+ FLOW_ALLOC,
+ FLOW_DEALLOC
+};
+
struct flow_set;
struct fqueue;
@@ -37,30 +45,32 @@ typedef struct fqueue fqueue_t;
__BEGIN_DECLS
-fset_t * fset_create(void);
+fset_t * fset_create(void);
+
+void fset_destroy(fset_t * set);
-void fset_destroy(fset_t * set);
+fqueue_t * fqueue_create(void);
-fqueue_t * fqueue_create(void);
+void fqueue_destroy(struct fqueue * fq);
-void fqueue_destroy(struct fqueue * fq);
+void fset_zero(fset_t * set);
-void fset_zero(fset_t * set);
+int fset_add(fset_t * set,
+ int fd);
-int fset_add(fset_t * set,
- int fd);
+bool fset_has(const fset_t * set,
+ int fd);
-bool fset_has(const fset_t * set,
- int fd);
+void fset_del(fset_t * set,
+ int fd);
-void fset_del(fset_t * set,
- int fd);
+int fqueue_next(fqueue_t * fq);
-int fqueue_next(fqueue_t * fq);
+enum fqtype fqueue_type(fqueue_t * fq);
-int fevent(fset_t * set,
- fqueue_t * fq,
- const struct timespec * timeo);
+int fevent(fset_t * set,
+ fqueue_t * fq,
+ const struct timespec * timeo);
__END_DECLS
diff --git a/include/ouroboros/shm_flow_set.h b/include/ouroboros/shm_flow_set.h
index 76849137..ebf63af5 100644
--- a/include/ouroboros/shm_flow_set.h
+++ b/include/ouroboros/shm_flow_set.h
@@ -53,7 +53,8 @@ void shm_flow_set_del(struct shm_flow_set * shm_set,
int port_id);
void shm_flow_set_notify(struct shm_flow_set * set,
- int port_id);
+ int port_id,
+ int event);
ssize_t shm_flow_set_wait(const struct shm_flow_set * shm_set,
size_t idx,