From 72e703353d18305aa2c6cf114bac208674a37e2a Mon Sep 17 00:00:00 2001 From: Kedar Sovani Date: Sat, 31 Dec 2022 11:02:16 +0530 Subject: [PATCH] Debug: Include TLV dumps for Secure Channel exchanges --- matter/src/secure_channel/core.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/matter/src/secure_channel/core.rs b/matter/src/secure_channel/core.rs index eb36531..8a2774c 100644 --- a/matter/src/secure_channel/core.rs +++ b/matter/src/secure_channel/core.rs @@ -23,6 +23,7 @@ use crate::{ mdns::{self, Mdns}, secure_channel::{common::*, pake::PAKE}, sys::SysMdnsService, + tlv, transport::proto_demux::{self, ProtoCtx, ResponseRequired}, }; use log::{error, info}; @@ -120,7 +121,9 @@ impl proto_demux::HandleProto for SecureChannel { let proto_opcode: OpCode = num::FromPrimitive::from_u8(ctx.rx.get_proto_opcode()).ok_or(Error::Invalid)?; ctx.tx.set_proto_id(PROTO_ID_SECURE_CHANNEL as u16); - match proto_opcode { + info!("Received Data"); + tlv::print_tlv_list(ctx.rx.as_borrow_slice()); + let result = match proto_opcode { OpCode::MRPStandAloneAck => self.mrpstandaloneack_handler(ctx), OpCode::PBKDFParamRequest => self.pbkdfparamreq_handler(ctx), OpCode::PASEPake1 => self.pasepake1_handler(ctx), @@ -131,7 +134,12 @@ impl proto_demux::HandleProto for SecureChannel { error!("OpCode Not Handled: {:?}", proto_opcode); Err(Error::InvalidOpcode) } + }; + if result == Ok(ResponseRequired::Yes) { + info!("Sending response"); + tlv::print_tlv_list(ctx.tx.as_borrow_slice()); } + result } fn get_proto_id(&self) -> usize {