Skip to main content

uint8_value_in_range

Function uint8_value_in_range 

Source
fn uint8_value_in_range(key: u64, value: u8) -> bool
Expand description

Whether value is inside the range draft-20 allows for a uint8-valued parameter.

Three of the four uint8 parameters restrict their range and say the receiver MUST close the session with PROTOCOL_VIOLATION on anything outside it: GROUP_ORDER allows only Ascending (0x1) and Descending (0x2) (Section 10.2.8), FORWARD allows only 0 and 1 (Section 10.2.18), and INCLUDE_PROPERTIES — new in draft-20 — allows only 0 and 1 (Section 10.2.21). SUBSCRIBER_PRIORITY (Section 10.2.7) uses the whole 0-255 range, so it has no entry here.

Range-checking on decode is what makes the values usable: an application that tests group_order == 2 for descending would otherwise treat 7 as neither ascending nor descending and carry on.