summaryrefslogtreecommitdiff
path: root/src/lib/dev.c
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri.staessens@ugent.be>2018-12-27 15:42:00 +0100
committerSander Vrijders <sander.vrijders@ugent.be>2018-12-27 16:08:56 +0100
commit9dab3985812e75071271ce69000561156d0d9374 (patch)
tree8569e3186cdcf37c205c7bae0d2d9b595b607602 /src/lib/dev.c
parent8eed1b3fc3d4e3261a68855ccc54c35102738a79 (diff)
downloadouroboros-9dab3985812e75071271ce69000561156d0d9374.tar.gz
ouroboros-9dab3985812e75071271ce69000561156d0d9374.zip
include: Add a flow_join operation for broadcast
This adds a new flow_join operaiton for broadcast, which is a much safer solution than overloading destination name semantics. The internal API now also has a different IPCP_FLOW_JOIN operation. The IRMd doesn't need to query broadcasts IPCPs for the name, it can just check if an IPCP with the layer name exists. The broadcast IPCP doesn't need to implement the query proxy call anymore. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
Diffstat (limited to 'src/lib/dev.c')
-rw-r--r--src/lib/dev.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/lib/dev.c b/src/lib/dev.c
index a2ec836f..57dfc3f2 100644
--- a/src/lib/dev.c
+++ b/src/lib/dev.c
@@ -561,9 +561,10 @@ int flow_accept(qosspec_t * qs,
return fd;
}
-int flow_alloc(const char * dst,
- qosspec_t * qs,
- const struct timespec * timeo)
+static int __flow_alloc(const char * dst,
+ qosspec_t * qs,
+ const struct timespec * timeo,
+ bool join)
{
irm_msg_t msg = IRM_MSG__INIT;
qosspec_msg_t qs_msg = QOSSPEC_MSG__INIT;
@@ -574,7 +575,10 @@ int flow_alloc(const char * dst,
if (qs != NULL)
qs->ber = 1;
#endif
- msg.code = IRM_MSG_CODE__IRM_FLOW_ALLOC;
+ if (join)
+ msg.code = IRM_MSG_CODE__IRM_FLOW_JOIN;
+ else
+ msg.code = IRM_MSG_CODE__IRM_FLOW_ALLOC;
msg.dst = (char *) dst;
msg.has_pid = true;
msg.pid = ai.pid;
@@ -634,6 +638,20 @@ int flow_alloc(const char * dst,
return fd;
}
+int flow_alloc(const char * dst,
+ qosspec_t * qs,
+ const struct timespec * timeo)
+{
+ return __flow_alloc(dst, qs, timeo, false);
+}
+
+int flow_join(const char * dst,
+ qosspec_t * qs,
+ const struct timespec * timeo)
+{
+ return __flow_alloc(dst, qs, timeo, true);
+}
+
int flow_dealloc(int fd)
{
irm_msg_t msg = IRM_MSG__INIT;