From 0bc6f1342d839b375b3d007aa5e29cd2961bd45c Mon Sep 17 00:00:00 2001 From: Mason Ticehurst Date: Wed, 24 Jan 2024 21:22:04 -0500 Subject: [PATCH 01/10] Add IPCP map to lookup IPCP_Id by name. Add Hash function for bounded_strings in HashMap --- eRINA_Linux/src/ada_src/bindings-rlite-ctrl.adb | 4 ++++ eRINA_Linux/src/ada_src/bindings-rlite-ctrl.ads | 12 ++++++++++++ .../src/ada_src/messages/bindings-rlite-msg-flow.ads | 3 --- eRINA_Linux/src/ada_src/names.adb | 4 ++++ eRINA_Linux/src/ada_src/names.ads | 11 ++++++++--- 5 files changed, 28 insertions(+), 6 deletions(-) diff --git a/eRINA_Linux/src/ada_src/bindings-rlite-ctrl.adb b/eRINA_Linux/src/ada_src/bindings-rlite-ctrl.adb index 78bf6fa..4e0b5f2 100644 --- a/eRINA_Linux/src/ada_src/bindings-rlite-ctrl.adb +++ b/eRINA_Linux/src/ada_src/bindings-rlite-ctrl.adb @@ -98,6 +98,10 @@ package body Bindings.Rlite.Ctrl is Debug.Print("RINA_Create_IPCP", "Deserialized wrong event_id?", Debug.Error); raise Exceptions.IPCP_Creation_Exception; end if; + + -- Insert into IPCP name => IPCP ID map + -- The hashmap will simply update if this name already exists + IPCP_Map.Include(Name, Response.Ipcp_Id); return Response.Ipcp_Id; end RINA_Create_IPCP; diff --git a/eRINA_Linux/src/ada_src/bindings-rlite-ctrl.ads b/eRINA_Linux/src/ada_src/bindings-rlite-ctrl.ads index 75732e2..4c0ed6a 100644 --- a/eRINA_Linux/src/ada_src/bindings-rlite-ctrl.ads +++ b/eRINA_Linux/src/ada_src/bindings-rlite-ctrl.ads @@ -3,7 +3,10 @@ pragma Style_Checks (Off); with Interfaces; use Interfaces; + with Ada.Containers.Doubly_Linked_Lists; +with Ada.Containers.Hashed_Maps; + use Ada.Containers; with Bindings.Rlite.API; with Bindings.Rlite.Common; @@ -49,6 +52,15 @@ package Bindings.Rlite.Ctrl is package Sig_Action_List is new Ada.Containers.Doubly_Linked_Lists (Element_Type => Sa_Pending_Item); + package IPCP_Id_Map is new Ada.Containers.Hashed_Maps ( + Key_Type => Bounded_String, + Element_Type => Rl_Ipcp_Id_T, + Hash => Names.Hash, + Equivalent_Keys => "=" + ); + + IPCP_Map : IPCP_Id_Map.Map; + function RINA_Register_Common (Fd : OS.File_Descriptor; Dif_Name : Bounded_String; Local_Appl : Bounded_String; diff --git a/eRINA_Linux/src/ada_src/messages/bindings-rlite-msg-flow.ads b/eRINA_Linux/src/ada_src/messages/bindings-rlite-msg-flow.ads index b66a8a9..43d6620 100644 --- a/eRINA_Linux/src/ada_src/messages/bindings-rlite-msg-flow.ads +++ b/eRINA_Linux/src/ada_src/messages/bindings-rlite-msg-flow.ads @@ -4,9 +4,6 @@ pragma Style_Checks (Off); with Bindings.Rlite.Msg; use Bindings.Rlite.Msg; -with Bindings.Rlite.List; - use Bindings.Rlite; - package Bindings.Rlite.Msg.Flow is RINA_FLOW_SPEC_VERSION : constant Unsigned_32 := 2; diff --git a/eRINA_Linux/src/ada_src/names.adb b/eRINA_Linux/src/ada_src/names.adb index b61be6f..5bd50d8 100644 --- a/eRINA_Linux/src/ada_src/names.adb +++ b/eRINA_Linux/src/ada_src/names.adb @@ -24,4 +24,8 @@ package body Names is return Buffer; end To_Packed_Buffer; + + function Hash(Name : in Bounded_String) return Ada.Containers.Hash_Type is begin + return Ada.Strings.Hash(To_String (Name)); + end Hash; end Names; \ No newline at end of file diff --git a/eRINA_Linux/src/ada_src/names.ads b/eRINA_Linux/src/ada_src/names.ads index c820274..5ed0ea0 100644 --- a/eRINA_Linux/src/ada_src/names.ads +++ b/eRINA_Linux/src/ada_src/names.ads @@ -1,13 +1,15 @@ -- Temp disabling pragma Style_Checks (Off); +with Ada.Strings; +with Ada.Strings.Hash; with Ada.Strings.Bounded; + +with Ada.Containers; + with Buffers; use Buffers; -with Interfaces; - use Interfaces; - -- Max name length to be used for DIF_Name, Appl_Name, etc package Names is package Name_String is new Ada.Strings.Bounded.Generic_Bounded_Length @@ -19,4 +21,7 @@ package Names is -- Takes a Bounded String and returns the packed buffer of all characters up to null terminator function To_Packed_Buffer(Input : Bounded_String) return Byte_Buffer; + + -- Takes in a bounded_string and returns a unique hash code + function Hash(Name : in Bounded_String) return Ada.Containers.Hash_Type; end Names; \ No newline at end of file From b5c2a15e54af00b7ffba2c5afd6d5b65dd165a3b Mon Sep 17 00:00:00 2001 From: Mason Ticehurst Date: Wed, 24 Jan 2024 23:39:36 -0500 Subject: [PATCH 02/10] Add RINA_Destroy_IPCP API level function --- .../src/ada_src/bindings-rlite-api.adb | 22 +++++++++++++++++++ .../src/ada_src/bindings-rlite-api.ads | 13 +++++++++++ 2 files changed, 35 insertions(+) diff --git a/eRINA_Linux/src/ada_src/bindings-rlite-api.adb b/eRINA_Linux/src/ada_src/bindings-rlite-api.adb index e399f3b..6f3eb3b 100644 --- a/eRINA_Linux/src/ada_src/bindings-rlite-api.adb +++ b/eRINA_Linux/src/ada_src/bindings-rlite-api.adb @@ -3,6 +3,8 @@ pragma Style_Checks (Off); -- Bindings with Bindings.Rlite.Ctrl; + +-- Exceptions with Exceptions; package body Bindings.Rlite.API is @@ -37,6 +39,26 @@ package body Bindings.Rlite.API is return Ctrl.RINA_Create_IPCP (Fd, To_Bounded_String (Name), DIF_Type, To_Bounded_String (DIF_Name)); end RINA_Create_IPCP; + -- Removes/destroys an existing IPCP by name + procedure RINA_Destroy_IPCP ( + Fd : OS.File_Descriptor; + Name : String) is + Bounded_Name : constant Bounded_String := To_Bounded_String (Name); + begin + if Ctrl.IPCP_Map.Contains (Bounded_Name) then + RINA_Destroy_IPCP(Fd, Ctrl.IPCP_Map (Bounded_Name)); + end if; + end RINA_Destroy_IPCP; + + -- Removes/destroys an existing IPCP by its IPCP_Id + -- (This can be looked up via the IPCP hashmap in Ctrl logic) + procedure RINA_Destroy_IPCP ( + Fd : OS.File_Descriptor; + Id : Rl_Ipcp_Id_T) is + begin + Ctrl.RINA_Destroy_IPCP (Fd, Id); + end RINA_Destroy_IPCP; + function RINA_Register (Fd : OS.File_Descriptor; DIF_Name : String; Local_Appl : String; diff --git a/eRINA_Linux/src/ada_src/bindings-rlite-api.ads b/eRINA_Linux/src/ada_src/bindings-rlite-api.ads index 01d95f6..ce7e4de 100644 --- a/eRINA_Linux/src/ada_src/bindings-rlite-api.ads +++ b/eRINA_Linux/src/ada_src/bindings-rlite-api.ads @@ -45,6 +45,19 @@ package Bindings.Rlite.API is DIF_Name : String ) return Rl_IPCP_Id_T; + -- Removes/destroys an existing IPCP by name + procedure RINA_Destroy_IPCP ( + Fd : OS.File_Descriptor; + Name : String + ); + + -- Removes/destroys an existing IPCP by its IPCP_Id + -- (This can be looked up via the IPCP hashmap in Ctrl logic) + procedure RINA_Destroy_IPCP ( + Fd : OS.File_Descriptor; + Id : Rl_Ipcp_Id_T + ); + -- Register the application name local_appl to a DIF in the system. -- After a successful registration, flow allocation requests can be received -- on fd. From 5d32bb9b0be09e0ee331650264538c9fbe9ba178 Mon Sep 17 00:00:00 2001 From: Mason Ticehurst Date: Wed, 24 Jan 2024 23:39:51 -0500 Subject: [PATCH 03/10] Add Search_Map_By_Value --- .../src/ada_src/bindings-rlite-ctrl.adb | 41 ++++++++++++++++++- .../src/ada_src/bindings-rlite-ctrl.ads | 9 +++- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/eRINA_Linux/src/ada_src/bindings-rlite-ctrl.adb b/eRINA_Linux/src/ada_src/bindings-rlite-ctrl.adb index 4e0b5f2..e428735 100644 --- a/eRINA_Linux/src/ada_src/bindings-rlite-ctrl.adb +++ b/eRINA_Linux/src/ada_src/bindings-rlite-ctrl.adb @@ -10,10 +10,26 @@ with Names; with Exceptions; with Bindings.Rlite.Msg.Register; -with Bindings.Rlite.Msg.IPCP; package body Bindings.Rlite.Ctrl is + -- I don't like this being here + -- we should separate the IPCP map and relevant funcs to a separate package + function Search_Map_By_Value + (Map_Var : in out Map; Value : Rl_Ipcp_Id_T) return Cursor is + Index : Cursor := No_Element; + begin + while Index /= No_Element loop + if Map_Var (Index) = Value then + return Index; + end if; + + Index := Next (Index); + end loop; + + return No_Element; + end Search_Map_By_Value; + procedure Rl_Write_Msg (Rfd : OS.File_Descriptor; Msg : Byte_Buffer; @@ -106,6 +122,29 @@ package body Bindings.Rlite.Ctrl is return Response.Ipcp_Id; end RINA_Create_IPCP; + procedure RINA_Destroy_IPCP ( + Fd : OS.File_Descriptor; + Id : Rl_Ipcp_Id_T) is + Request : IPCP.Destroy; + Index : Cursor; + begin + Request.Hdr.Msg_Type := RLITE_KER_IPCP_DESTROY; + Request.Hdr.Event_Id := 1; + Request.Ipcp_Id := Id; + + declare + Buffer : constant Byte_Buffer := IPCP.Serialize (Request); + begin + Rl_Write_Msg (Fd, Buffer, 0); + end; + + Index := Search_Map_By_Value (IPCP_Map, Id); + + if Index /= No_Element then + IPCP_Map.Delete (Index); + end if; + end RINA_Destroy_IPCP; + function RINA_Register_Wait (Fd : OS.File_Descriptor; Wfd : OS.File_Descriptor) return OS.File_Descriptor is Buffer : Byte_Buffer(1 .. 4096) := (others => 0); diff --git a/eRINA_Linux/src/ada_src/bindings-rlite-ctrl.ads b/eRINA_Linux/src/ada_src/bindings-rlite-ctrl.ads index 4c0ed6a..c06d130 100644 --- a/eRINA_Linux/src/ada_src/bindings-rlite-ctrl.ads +++ b/eRINA_Linux/src/ada_src/bindings-rlite-ctrl.ads @@ -59,7 +59,10 @@ package Bindings.Rlite.Ctrl is Equivalent_Keys => "=" ); - IPCP_Map : IPCP_Id_Map.Map; + use IPCP_Id_Map; + + IPCP_Map : Map; + function Search_Map_By_Value (Map_Var : in out Map; Value : Rl_Ipcp_Id_T) return Cursor; function RINA_Register_Common (Fd : OS.File_Descriptor; Dif_Name : Bounded_String; @@ -75,6 +78,10 @@ package Bindings.Rlite.Ctrl is DIF_Name : Bounded_String ) return Rl_IPCP_Id_T; + procedure RINA_Destroy_IPCP ( + Fd : OS.File_Descriptor; + Id : Rl_Ipcp_Id_T); + -- struct rl_msg_base *rl_read_next_msg(int rfd, int quiet) function Rl_Read_Msg ( Rfd : OS.File_Descriptor; From 9f33ee0df8a4428ec5c290cc4cb12b96d74c09dc Mon Sep 17 00:00:00 2001 From: Mason Ticehurst Date: Wed, 24 Jan 2024 23:40:56 -0500 Subject: [PATCH 04/10] Make Deserialize procedure not abstract so implementation is not required --- eRINA_Linux/src/ada_src/messages/bindings-rlite-msg.ads | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eRINA_Linux/src/ada_src/messages/bindings-rlite-msg.ads b/eRINA_Linux/src/ada_src/messages/bindings-rlite-msg.ads index ae560a5..f6f3d14 100644 --- a/eRINA_Linux/src/ada_src/messages/bindings-rlite-msg.ads +++ b/eRINA_Linux/src/ada_src/messages/bindings-rlite-msg.ads @@ -91,7 +91,7 @@ package Bindings.Rlite.Msg is -- Abstract base serialization function, must be overridden by child messages function Serialize (Self : in Rl_Msg_Base) return Byte_Buffer is abstract; - procedure Deserialize (Self : in out Rl_Msg_Base; fd : OS.File_Descriptor) is abstract; + procedure Deserialize (Self : in out Rl_Msg_Base; fd : OS.File_Descriptor) is null; function Read_Next_Msg(fd : OS.File_Descriptor) return Byte_Buffer; From e64132ecd6d67e1823b32f8fb6fb375d085b6e10 Mon Sep 17 00:00:00 2001 From: Mason Ticehurst Date: Wed, 24 Jan 2024 23:41:16 -0500 Subject: [PATCH 05/10] Cleanup --- .../messages/bindings-rlite-msg-ipcp.adb | 25 +++++++++++++------ .../messages/bindings-rlite-msg-ipcp.ads | 15 +++++++---- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/eRINA_Linux/src/ada_src/messages/bindings-rlite-msg-ipcp.adb b/eRINA_Linux/src/ada_src/messages/bindings-rlite-msg-ipcp.adb index e3669f1..970ac64 100644 --- a/eRINA_Linux/src/ada_src/messages/bindings-rlite-msg-ipcp.adb +++ b/eRINA_Linux/src/ada_src/messages/bindings-rlite-msg-ipcp.adb @@ -18,7 +18,7 @@ package body Bindings.Rlite.Msg.IPCP is IPCP_Name_Ptr : constant Byte_Buffer := To_Packed_Buffer (Self.Ipcp_Name); - DIF_Type : String := Ada.Characters.Handling.To_Lower (DIF_Types'Image (Self.DIF_Type)); + DIF_Type : constant String := Ada.Characters.Handling.To_Lower (DIF_Types'Image (Self.DIF_Type)); DIF_Type_Size : constant Unsigned_16 := Unsigned_16 (DIF_Type'Size / 8); @@ -39,11 +39,6 @@ package body Bindings.Rlite.Msg.IPCP is begin return Serialized_Msg; end Serialize; - - procedure Deserialize (Self : in out Create; fd : OS.File_Descriptor) is - begin - raise Exceptions.Not_Implemented_Exception; - end Deserialize; function Serialize (Self : in Create_Response) return Byte_Buffer is t : constant Byte_Buffer(1 .. 128) := (others => 0); @@ -52,10 +47,11 @@ package body Bindings.Rlite.Msg.IPCP is return t; end Serialize; + overriding procedure Deserialize (Self : in out Create_Response; Fd : OS.File_Descriptor) is Buffer : constant Byte_Buffer := Read_Next_Msg (Fd); Msg_Data : constant Byte_Buffer := Buffer(Rl_Msg_Hdr'Size / 8 + 1 .. Buffer'Size / 8); - Offset : Integer := Msg_Data'First; + Offset : constant Integer := Msg_Data'First; begin -- Byte buffer must not include any tagged record parts. This assumes -- byte_buffer is coming from C struct read from FD and not Ada! @@ -69,4 +65,19 @@ package body Bindings.Rlite.Msg.IPCP is Self.Ipcp_Id := Rl_Ipcp_Id_T (Buffer_To_Unsigned_16(Msg_Data(Offset .. Offset + 1))); end Deserialize; + overriding + function Serialize (Self : Destroy) return Byte_Buffer is + Hdr_Ptr : constant Byte_Buffer(1 .. Self.Hdr'Size / 8) + with Address => Self.Hdr'Address, Import, Volatile; + + IPCP_Id : constant Byte_Buffer(1 .. Self.Ipcp_Id'Size / 8) + with Address => Self.Ipcp_Id'Address, Import, Volatile; + + Pad1 : constant Byte_Buffer(1 .. 6) := (others => 0); + + Serialized_Msg : constant Byte_Buffer := Hdr_Ptr & IPCP_Id & Pad1; + begin + return Serialized_Msg; + end Serialize; + end Bindings.Rlite.Msg.IPCP; \ No newline at end of file diff --git a/eRINA_Linux/src/ada_src/messages/bindings-rlite-msg-ipcp.ads b/eRINA_Linux/src/ada_src/messages/bindings-rlite-msg-ipcp.ads index af2bf37..18b686b 100644 --- a/eRINA_Linux/src/ada_src/messages/bindings-rlite-msg-ipcp.ads +++ b/eRINA_Linux/src/ada_src/messages/bindings-rlite-msg-ipcp.ads @@ -13,9 +13,6 @@ package Bindings.Rlite.Msg.IPCP is end record; pragma Pack(Create); - overriding - procedure Deserialize (Self : in out Create; fd : OS.File_Descriptor); - overriding function Serialize (Self : in Create) return Byte_Buffer; @@ -25,9 +22,17 @@ package Bindings.Rlite.Msg.IPCP is pragma Pack(Create_Response); overriding - procedure Deserialize (Self : in out Create_Response; fd : OS.File_Descriptor); + function Serialize (Self : in Create_Response) return Byte_Buffer; overriding - function Serialize (Self : in Create_Response) return Byte_Buffer; + procedure Deserialize (Self : in out Create_Response; Fd : OS.File_Descriptor); + + type Destroy is new Rl_Msg_Base with record + Ipcp_Id : Rl_Ipcp_Id_T; + end record; + pragma Pack(Destroy); + + overriding + function Serialize (Self : in Destroy) return Byte_Buffer; end Bindings.Rlite.Msg.IPCP; \ No newline at end of file From c31e8cbddad85af53c4170c0ce3ddef1c576cf5c Mon Sep 17 00:00:00 2001 From: Mason Ticehurst Date: Thu, 25 Jan 2024 17:58:21 -0500 Subject: [PATCH 06/10] Test CI/CD updates --- .github/workflows/ada.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ada.yml b/.github/workflows/ada.yml index 58418d1..a87df97 100644 --- a/.github/workflows/ada.yml +++ b/.github/workflows/ada.yml @@ -18,7 +18,7 @@ jobs: - uses: alire-project/setup-alire@v2 - - name: Set up GNAT toolchain + - name: Install Dependencies run: > sudo apt-get update && sudo apt-get install gcc g++ libprotobuf-dev protobuf-compiler cmake linux-headers-$(uname -r) python-is-python3 swig wpasupplicant hostapd && @@ -31,6 +31,17 @@ jobs: - name: Build run: cd eRINA_Linux && alr build + - name: Run UIPCPS + run: > + sudo modprobe rlite && + sudo modprobe rlite-normal && + sudo rlite-uipcps & + + - name: Execute Tests + run: > + cd ../eRINA_Tests/ + sudo ./bin/erina_tests + - name: Slack Notification Success if: success() uses: rtCamp/action-slack-notify@v2 From 74ff8ed2b1a886bc9aa43e1d3bcf4df861089038 Mon Sep 17 00:00:00 2001 From: Mason Ticehurst Date: Thu, 25 Jan 2024 18:03:10 -0500 Subject: [PATCH 07/10] Fix missing and operator --- .github/workflows/ada.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ada.yml b/.github/workflows/ada.yml index a87df97..029960e 100644 --- a/.github/workflows/ada.yml +++ b/.github/workflows/ada.yml @@ -39,7 +39,7 @@ jobs: - name: Execute Tests run: > - cd ../eRINA_Tests/ + cd ../eRINA_Tests/ && sudo ./bin/erina_tests - name: Slack Notification Success From 6eee19de45a966adce91862009f5fe400ab43258 Mon Sep 17 00:00:00 2001 From: Mason Ticehurst Date: Thu, 25 Jan 2024 18:07:49 -0500 Subject: [PATCH 08/10] Another test --- .github/workflows/ada.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ada.yml b/.github/workflows/ada.yml index 029960e..d9d7522 100644 --- a/.github/workflows/ada.yml +++ b/.github/workflows/ada.yml @@ -29,7 +29,10 @@ jobs: sudo make install depmod - name: Build - run: cd eRINA_Linux && alr build + run: > + cd eRINA_Linux && + alr build && + cd .. - name: Run UIPCPS run: > @@ -39,7 +42,8 @@ jobs: - name: Execute Tests run: > - cd ../eRINA_Tests/ && + cd eRINA_Tests && + alr build && sudo ./bin/erina_tests - name: Slack Notification Success From 8c186795cb0b8ae54fdf8e26f75ae65769f3419a Mon Sep 17 00:00:00 2001 From: Mason Ticehurst Date: Fri, 26 Jan 2024 17:19:01 -0500 Subject: [PATCH 09/10] Check for existing IPCP before sending creation request --- eRINA_Linux/src/ada_src/bindings-rlite-ctrl.adb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/eRINA_Linux/src/ada_src/bindings-rlite-ctrl.adb b/eRINA_Linux/src/ada_src/bindings-rlite-ctrl.adb index e428735..6695ea4 100644 --- a/eRINA_Linux/src/ada_src/bindings-rlite-ctrl.adb +++ b/eRINA_Linux/src/ada_src/bindings-rlite-ctrl.adb @@ -75,9 +75,6 @@ package body Bindings.Rlite.Ctrl is return Buffer; end Rl_Read_Msg; - -- TODO: Check special case where IPCP already exists - -- i.e. Probe for IPCP first, if exists, return that IPCP_ID - -- otherwise, create it. This way no exceptions thrown on deserialize later... function RINA_Create_IPCP ( Fd : OS.File_Descriptor; Name : Bounded_String; @@ -87,6 +84,12 @@ package body Bindings.Rlite.Ctrl is Request : IPCP.Create; Response : IPCP.Create_Response; begin + + -- If we're trying to create an IPCP that already exists, return the known IPCP_Id + if IPCP_Map.Contains (Name) then + return IPCP_Map (Name); + end if; + Request.Hdr.Msg_Type := RLITE_KER_IPCP_CREATE; Request.Hdr.Event_Id := 1; Request.Ipcp_Name := Name; From 9e08817d0980778f812775d230ae8437e25067a4 Mon Sep 17 00:00:00 2001 From: Mason Ticehurst Date: Sat, 27 Jan 2024 00:20:03 -0500 Subject: [PATCH 10/10] Update incorrect EFCP header (rlite's is different from ETSI docs) --- eRINA_STM32F7/src/net/efcp.ads | 68 ++++++++++++++++++++++------------ 1 file changed, 45 insertions(+), 23 deletions(-) diff --git a/eRINA_STM32F7/src/net/efcp.ads b/eRINA_STM32F7/src/net/efcp.ads index fdbc7e0..a9fcf13 100644 --- a/eRINA_STM32F7/src/net/efcp.ads +++ b/eRINA_STM32F7/src/net/efcp.ads @@ -11,35 +11,57 @@ package EFCP is subtype Uint32 is Interfaces.Unsigned_32; subtype Uint64 is Interfaces.Unsigned_64; - -- EFCP header as defined by GR-NGP-009. + -- PCI header to be used for transfer PDUs. + -- The order of the fields is extremely important, because we only + -- accept struct layouts where the compiler does not insert any + -- padding. + -- + -- struct rina_pci { + -- uint8_t pdu_version; + -- uint8_t pdu_type; + -- uint16_t pdu_flags; + -- uint16_t pdu_csum; + -- uint16_t pdu_ttl; + -- rl_seq_t seqnum; + -- rl_addr_t dst_addr; + -- rl_addr_t src_addr; + -- rl_cepid_t dst_cep; + -- rl_cepid_t src_cep; + -- rl_pdulen_t pdu_len; + -- rl_qosid_t qos_id; + -- } __attribute__((__packed__)); + + -- EFCP header as defined by rLite PDUs type EFCP_Header is record - Version : Uint8; - Daddr : Uint16; -- This is the IPC process that hosts the endpoint (not an IP) - Saddr : Uint16; - Qosid : Uint32; - Dcepid : Uint32; -- Connection Endpoint Id field in EFCP PDUs - Scepid : Uint32; - Pdutype : Uint8; - Flags : Uint8; - Len : Uint32; - Seq : Uint32; + PDU_Version : Uint8; + PDU_Type : Uint8; + PDU_Flags : Uint16; + PDU_CSum : Uint16; + PDU_TTL : Uint16; + PDU_SeqNum : Uint32; + Dst_Addr : Uint32; + Src_Addr : Uint32; + Dst_Cep : Uint16; + Src_Cep : Uint16; + PDU_Len : Uint16; + QOS_Id : Uint16; end record; type EFCP_Header_Access is access all EFCP_Header; - -- Sizes consistent with - -- https://github.com/rlite/rlite/blob/6ac276b11a36832d58a9674f100a705614947d34/user/uipcps/uipcp-gpb/BaseRIB.proto#L19 for EFCP_Header use record - Version at 0 range 0 .. 7; - Daddr at 1 range 0 .. 15; - Saddr at 3 range 0 .. 15; - Qosid at 5 range 0 .. 39; - Dcepid at 10 range 0 .. 31; - Scepid at 14 range 0 .. 31; - Pdutype at 18 range 0 .. 7; - Flags at 19 range 0 .. 7; - Len at 20 range 0 .. 55; - Seq at 27 range 0 .. 47; + PDU_Version at 0 range 0 .. 7; + PDU_Type at 1 range 0 .. 7; + PDU_Flags at 2 range 0 .. 15; + PDU_CSum at 4 range 0 .. 15; + PDU_TTL at 6 range 0 .. 15; + PDU_SeqNum at 8 range 0 .. 31; + Dst_Addr at 12 range 0 .. 31; + Src_Addr at 16 range 0 .. 31; + Dst_Cep at 20 range 0 .. 15; + Src_Cep at 22 range 0 .. 15; + PDU_Len at 24 range 0 .. 15; + QOS_Id at 26 range 0 .. 15; end record; end EFCP; \ No newline at end of file