From 9dab3985812e75071271ce69000561156d0d9374 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Thu, 27 Dec 2018 15:42:00 +0100 Subject: 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 Signed-off-by: Sander Vrijders --- src/lib/dev.c | 26 ++++++++++++++++++++++---- src/lib/ipcpd_messages.proto | 11 ++++++----- src/lib/irmd_messages.proto | 9 +++++---- 3 files changed, 33 insertions(+), 13 deletions(-) (limited to 'src/lib') 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; diff --git a/src/lib/ipcpd_messages.proto b/src/lib/ipcpd_messages.proto index ae1014ac..1793aee7 100644 --- a/src/lib/ipcpd_messages.proto +++ b/src/lib/ipcpd_messages.proto @@ -32,11 +32,12 @@ enum ipcp_msg_code { IPCP_UNREG = 4; IPCP_QUERY = 5; IPCP_FLOW_ALLOC = 6; - IPCP_FLOW_ALLOC_RESP = 7; - IPCP_FLOW_DEALLOC = 8; - IPCP_CONNECT = 9; - IPCP_DISCONNECT = 10; - IPCP_REPLY = 11; + IPCP_FLOW_JOIN = 7; + IPCP_FLOW_ALLOC_RESP = 8; + IPCP_FLOW_DEALLOC = 9; + IPCP_CONNECT = 10; + IPCP_DISCONNECT = 11; + IPCP_REPLY = 12; }; message ipcp_msg { diff --git a/src/lib/irmd_messages.proto b/src/lib/irmd_messages.proto index 351b4a8e..9b935f57 100644 --- a/src/lib/irmd_messages.proto +++ b/src/lib/irmd_messages.proto @@ -43,10 +43,11 @@ enum irm_msg_code { IRM_UNREG = 15; IRM_FLOW_ALLOC = 16; IRM_FLOW_ACCEPT = 17; - IRM_FLOW_DEALLOC = 18; - IPCP_FLOW_REQ_ARR = 19; - IPCP_FLOW_ALLOC_REPLY = 20; - IRM_REPLY = 21; + IRM_FLOW_JOIN = 18; + IRM_FLOW_DEALLOC = 19; + IPCP_FLOW_REQ_ARR = 20; + IPCP_FLOW_ALLOC_REPLY = 21; + IRM_REPLY = 22; }; message ipcp_info_msg { -- cgit v1.2.3