Skip to content

decode_ functions don't provide the number of bytes used. #24

@Abestanis

Description

@Abestanis

TCP is a protocol based on streams. The underlying packages are an implementation detail, and modbus ADUs can be split over multiple packages or merged together into a single package.

codec::tcp::client::decode_response, codec::tcp::server::decode_response and codec::tcp::client::decode_request currently only return the parsed ADU, but discard the FrameLocation that has the information on where the parsed bytes of the ADU were located in the input buf.

Given that two ADUs might arrive in the same buffer, this makes these functions unusable for actual parsing of modbus ADUs. Can we either change these functions to return the FrameLocation / the number of bytes used / the remaining slice of the input buf that was not used, or add a second decode function that exposes this information?

I'm willing to provide a PR if you tell me which of these solutions you prefer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions