Skip to main content

encode_packet_resend

Function encode_packet_resend 

Source
pub fn encode_packet_resend(
    request_id: u16,
    channel: u16,
    block_id: u64,
    first_packet: u32,
    last_packet: u32,
    extended_ids: bool,
) -> Bytes
Expand description

Encode a PACKETRESEND_CMD asking the device to send packets first_packet..=last_packet of block block_id on stream channel channel again.

The command asks for no acknowledgement: the answer is the packets themselves, on the stream channel. With 16-bit block ids the payload is 12 bytes; with extended ids (extended_ids, flag 0x10) it is 20:

BytesStandard idsExtended ids
0–1stream channel indexstream channel index
2–3block id (16 bits)reserved, 0
4–7first packet id (24 bits)first packet id (32 bits)
8–11last packet id (24 bits)last packet id (32 bits)
12–19—block id (64 bits)

The layout is the field table Wireshark’s packet-gvcp.c dissects (dissect_packetresend_cmd, which reads the standard packet ids as the low 24 bits of each word). aravis builds the same bytes for channel 0 (arv_gvcp_packet_new_packet_resend_cmd) — corroboration, not the rule. With standard ids the block id is truncated to its 16 bits and the packet ids to their 24, which is all those fields hold.