BDX TransferSession spec implementation (#4473)
* First commit for BDX message utilities
- establish directory for BDX
- add BDXMessageUtils files
- add unit tests for BDXMessageUtils
- edit BUILD.gn files to build BDX directory and tests
* First commit for BDX message utilities
- establish directory for BDX
- add BDXMessageUtils files
- add unit tests for BDXMessageUtils
- edit BUILD.gn files to build BDX directory and tests
* move bdx directory to src/protocols
* fix BufferReader usage, style mistakes
* remove transport/bdx and fix build files
* remove unused header
* adding State files to BDX directory
* First commit for BDX message utilities
- establish directory for BDX
- add BDXMessageUtils files
- add unit tests for BDXMessageUtils
- edit BUILD.gn files to build BDX directory and tests
* move bdx directory to src/protocols
* fix BufferReader usage, style mistakes
* First commit for BDX message utilities
- establish directory for BDX
- add BDXMessageUtils files
- add unit tests for BDXMessageUtils
- edit BUILD.gn files to build BDX directory and tests
* remove transport/bdx and fix build files
* remove unused header
* adding State files to BDX directory
* WIP: integrating BdxMessages back into this branch
* Redesign BdxTransferSession API around StartTransfer, WaitForTransfer
* Delete old files BDXState + BDXMessageUtils
* Implementation for StartTransfer and unit test
* write full exchange test up to first BlockQuery
- add test logic for exchange up to first BlockQuery message (failing
here)
- fix virtual destructor errors
- add helper method for writing BDX messages to packetbuffer
* add methods for verifying transfer control options
also add delegate methods for file descriptor and metadata
* Full overhaul of TransferSession using EmitOutput()
also includes two tests for receiver drive and sender drive
* rename MessageType enum values
* remove reference to kProtocol_StatusReport and add TODO
* remove accidental change to src/BUILD.gn
* fix accidental third party repo changes
* restyling
* fix struct initialization compiler errors
* QEMU compilation fix
* initialize anonymous union to fix -Werror=uninitialized
* replace std::move() calls with Retain(), fix OutputEvent initialization
* remove brace-enclosed initializer lists
* replace Retain() with std::move() when possible
* Address comments from Tennessee:
- lowercase bdx namespace
- remove PrepareBlockAckEOF and combine in PrepareBlockAck
- add test helper for verifying output message type
- change test metadata to TLV format
* add checks for invalid AcceptTransfer data and add tests
* fix build after merge
* add check for transfer timeout, add timestamps to API, add timeout test
* fix build: add SystemPacketBuffer.h include
* change NewWithAvailableSize() -> New()
* add helper test function VerifyNoMoreOutput()
* fix block counter tracking, add test conditions for counters
- also add test helper SendAndVerifyTransferInit
* change OutputEventFlags (bitfield) to OutputEventType (flat enum)
* Update src/protocols/bdx/BdxTransferSession.h
Co-authored-by: Tennessee Carmel-Veilleux <tennessee.carmelveilleux@gmail.com>
* use strlen instead of sizeof
* use and enforce metadata with top-level list (path)
* add BdxMessage struct interface for common method calls
* change kTLVType_Path to _List
* addressing many of Tennessee's comments:
- rename remove Output from kOutput_ enums
- add AvailableDataLength() check when writing message to buffer
- fix timeout check
- fix payloadHeader.Encode() call, use headerSize
* remove "State_" prefix from TransferStates enum
- also rename from Idle to Unititalized
* rename TransferStates -> TransferState
* restyling: whitespace
* Use PacketBufBound instead of PacketBufferHandle::New()
* Implement StatusReport handling and sending with tests
* implement AbortTransfer() and update comments related to StatusReport
* combine vendorID and profileID in StatusReport handling
Co-authored-by: Justin Wood <woody@apple.com>
Co-authored-by: Tennessee Carmel-Veilleux <tennessee.carmelveilleux@gmail.com>
diff --git a/src/protocols/bdx/BUILD.gn b/src/protocols/bdx/BUILD.gn
index ddc63fb..e8ca3f1 100644
--- a/src/protocols/bdx/BUILD.gn
+++ b/src/protocols/bdx/BUILD.gn
@@ -20,6 +20,8 @@
sources = [
"BdxMessages.cpp",
"BdxMessages.h",
+ "BdxTransferSession.cpp",
+ "BdxTransferSession.h",
]
cflags = [ "-Wconversion" ]
@@ -28,5 +30,6 @@
"${chip_root}/src/lib/core",
"${chip_root}/src/lib/support",
"${chip_root}/src/system",
+ "${chip_root}/src/transport/raw",
]
}