From e6c2d4c9c6b8b12bbcf7bc8bd494b3ba56133e1f Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Fri, 23 Feb 2024 09:29:47 +0100 Subject: lib: Revise app flow allocation This revises the application flow allocator to use the flow_info struct/message between the components. Revises the messaging to move the use protocol buffers to its own source (serdes-irm). Adds a timeout to the IRMd flow allocator to make sure flow allocations don't hang forever (this was previously taken care of by the sanitize thread). Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/lib/pb/ipcp.proto | 3 ++- src/lib/pb/ipcp_config.proto | 5 +--- src/lib/pb/irm.proto | 55 ++++++++++++++++++--------------------- src/lib/pb/model.proto | 61 ++++++++++++++++++++++++++++++++++++++++++++ src/lib/pb/qos.proto | 35 ------------------------- 5 files changed, 89 insertions(+), 70 deletions(-) create mode 100644 src/lib/pb/model.proto delete mode 100644 src/lib/pb/qos.proto (limited to 'src/lib/pb') diff --git a/src/lib/pb/ipcp.proto b/src/lib/pb/ipcp.proto index 71bf90b8..c2c7f48b 100644 --- a/src/lib/pb/ipcp.proto +++ b/src/lib/pb/ipcp.proto @@ -23,7 +23,8 @@ syntax = "proto2"; import "ipcp_config.proto"; -import "qos.proto"; +import "model.proto"; + enum ipcp_msg_code { IPCP_BOOTSTRAP = 1; diff --git a/src/lib/pb/ipcp_config.proto b/src/lib/pb/ipcp_config.proto index ca4d55aa..28528b0c 100644 --- a/src/lib/pb/ipcp_config.proto +++ b/src/lib/pb/ipcp_config.proto @@ -22,10 +22,7 @@ syntax = "proto2"; -message layer_info_msg { - required string name = 1; - required uint32 dir_hash_algo = 2; -} +import "model.proto"; message dt_config_msg { required uint32 addr_size = 1; diff --git a/src/lib/pb/irm.proto b/src/lib/pb/irm.proto index c962e5e5..da3bd982 100644 --- a/src/lib/pb/irm.proto +++ b/src/lib/pb/irm.proto @@ -23,7 +23,7 @@ syntax = "proto2"; import "ipcp_config.proto"; -import "qos.proto"; +import "model.proto"; enum irm_msg_code { IRM_CREATE_IPCP = 1; @@ -55,11 +55,9 @@ enum irm_msg_code { IRM_REPLY = 27; } -message ipcp_info_msg { - required uint32 type = 1; - required string name = 2; - required uint32 pid = 3; - required uint32 state = 4; +message timespec_msg { + required uint64 tv_sec = 1; + required uint32 tv_nsec = 2; } message ipcp_list_msg { @@ -70,33 +68,30 @@ message ipcp_list_msg { required uint32 hash_algo = 5; } -message name_info_msg { - required string name = 1; - required uint32 pol_lb = 2; -} - message irm_msg { required irm_msg_code code = 1; optional string prog = 2; optional sint32 pid = 3; optional string name = 4; - optional ipcp_info_msg ipcp_info = 5; - optional string layer = 6; - repeated string exec = 7; - optional sint32 response = 8; - optional string dst = 9; - optional bytes hash = 10; - optional sint32 flow_id = 11; - optional qosspec_msg qosspec = 12; - optional ipcp_config_msg conf = 13; - optional uint32 opts = 14; - repeated ipcp_list_msg ipcps = 15; - repeated name_info_msg names = 16; - optional uint32 timeo_sec = 17; - optional uint32 timeo_nsec = 18; - optional sint32 mpl = 19; - optional string comp = 20; - optional bytes pk = 21; /* piggyback */ - optional bytes symmkey = 22; - optional sint32 result = 23; + optional flow_info_msg flow_info = 5; + optional ipcp_info_msg ipcp_info = 6; + optional string layer = 7; + repeated string exec = 8; + optional sint32 response = 9; + optional string dst = 10; + optional bytes hash = 11; + optional sint32 flow_id = 12; + optional qosspec_msg qosspec = 13; + optional ipcp_config_msg conf = 14; + optional uint32 opts = 15; + repeated ipcp_list_msg ipcps = 16; + repeated name_info_msg names = 17; + optional timespec_msg timeo = 18; + optional sint32 mpl = 20; + optional string comp = 21; + optional bytes pk = 22; /* piggyback */ + optional bytes symmkey = 23; + optional uint32 timeo_sec = 24; + optional uint32 timeo_nsec = 25; + optional sint32 result = 26; } diff --git a/src/lib/pb/model.proto b/src/lib/pb/model.proto new file mode 100644 index 00000000..f1e401f9 --- /dev/null +++ b/src/lib/pb/model.proto @@ -0,0 +1,61 @@ +/* + * Ouroboros - Copyright (C) 2016 - 2024 + * + * Model description messages + * + * Dimitri Staessens + * Sander Vrijders + * + * 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/. + */ + +syntax = "proto2"; + +message qosspec_msg { + required uint32 delay = 1; /* In ms. */ + required uint64 bandwidth = 2; /* In bits/s. */ + required uint32 availability = 3; /* Class of 9s. */ + required uint32 loss = 4; /* Packet loss. */ + required uint32 ber = 5; /* Bit error rate, ppb. */ + required uint32 in_order = 6; /* In-order delivery. */ + required uint32 max_gap = 7; /* In ms. */ + required uint32 cypher_s = 8; /* Crypto strength in bits. */ + required uint32 timeout = 9; /* Timeout in ms. */ +} + +message flow_info_msg { + required uint32 id = 1; + required uint32 n_pid = 2; + required uint32 n_1_pid = 3; + required uint32 mpl = 4; + required uint32 state = 5; + required qosspec_msg qos = 6; +} + +message name_info_msg { + required string name = 1; + required uint32 pol_lb = 2; +} + +message layer_info_msg { + required string name = 1; + required uint32 dir_hash_algo = 2; +} + +message ipcp_info_msg { + required uint32 type = 1; + required string name = 2; + required uint32 pid = 3; + required uint32 state = 4; +} diff --git a/src/lib/pb/qos.proto b/src/lib/pb/qos.proto deleted file mode 100644 index 64f5a285..00000000 --- a/src/lib/pb/qos.proto +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Ouroboros - Copyright (C) 2016 - 2024 - * - * QoS specification message - * - * Dimitri Staessens - * Sander Vrijders - * - * 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/. - */ - -syntax = "proto2"; - -message qosspec_msg { - required uint32 delay = 1; /* In ms. */ - required uint64 bandwidth = 2; /* In bits/s. */ - required uint32 availability = 3; /* Class of 9s. */ - required uint32 loss = 4; /* Packet loss. */ - required uint32 ber = 5; /* Bit error rate, ppb. */ - required uint32 in_order = 6; /* In-order delivery. */ - required uint32 max_gap = 7; /* In ms. */ - required uint32 cypher_s = 8; /* Crypto strength in bits. */ - required uint32 timeout = 9; /* Timeout in ms. */ -} -- cgit v1.2.3