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/irmd/ipcp.c | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) (limited to 'src/irmd/ipcp.c') diff --git a/src/irmd/ipcp.c b/src/irmd/ipcp.c index 7f3f4807..08547d01 100644 --- a/src/irmd/ipcp.c +++ b/src/irmd/ipcp.c @@ -435,12 +435,13 @@ int ipcp_query(pid_t pid, return ret; } -int ipcp_flow_alloc(pid_t pid, - int flow_id, - pid_t n_pid, - const uint8_t * dst, - size_t len, - qosspec_t qs) +static int __ipcp_flow_alloc(pid_t pid, + int flow_id, + pid_t n_pid, + const uint8_t * dst, + size_t len, + qosspec_t qs, + bool join) { ipcp_msg_t msg = IPCP_MSG__INIT; qosspec_msg_t qs_msg; @@ -449,7 +450,10 @@ int ipcp_flow_alloc(pid_t pid, assert(dst); - msg.code = IPCP_MSG_CODE__IPCP_FLOW_ALLOC; + if (join) + msg.code = IPCP_MSG_CODE__IPCP_FLOW_JOIN; + else + msg.code = IPCP_MSG_CODE__IPCP_FLOW_ALLOC; msg.has_flow_id = true; msg.flow_id = flow_id; msg.has_pid = true; @@ -475,6 +479,26 @@ int ipcp_flow_alloc(pid_t pid, return ret; } +int ipcp_flow_alloc(pid_t pid, + int flow_id, + pid_t n_pid, + const uint8_t * dst, + size_t len, + qosspec_t qs) +{ + return __ipcp_flow_alloc(pid, flow_id, n_pid, dst, len, qs, false); +} + +int ipcp_flow_join(pid_t pid, + int flow_id, + pid_t n_pid, + const uint8_t * dst, + size_t len, + qosspec_t qs) +{ + return __ipcp_flow_alloc(pid, flow_id, n_pid, dst, len, qs, true); +} + int ipcp_flow_alloc_resp(pid_t pid, int flow_id, pid_t n_pid, -- cgit v1.2.3