26 if (
byte == ASH_FLAG_BYTE) {
28 const bool valid = !this->discarding_ && !this->poisoned_ && !this->escaped_ &&
29 this->index_ >= ASH_MIN_FRAME_SIZE && this->crc_ == 0;
31 this->frame_length_ = this->index_ - ASH_CRC_SIZE;
38 if (
byte == ASH_CANCEL_BYTE) {
43 if (this->discarding_ || (
byte == ASH_WAKE_BYTE && this->index_ == 0)) {
48 case ASH_SUBSTITUTE_BYTE:
49 this->discarding_ =
true;
57 this->escaped_ =
true;
66 this->escaped_ =
false;
67 value =
byte ^ ASH_XOR_BYTE;
70 if (this->index_ >= MAX_ASH_FRAME_SIZE) {
71 this->poisoned_ =
true;
75 if (this->index_ < ASH_HEADER_SIZE) {
76 this->header_[this->index_] = value;
79 this->crc_ =
crc16be(&value, 1, this->crc_);
93 const uint8_t control = body[0];
96 if (control == ASH_RSTACK_CONTROL) {
97 if (this->
scanner_.
length() == ASH_RSTACK_BODY_SIZE && body[1] == ASH_PROTOCOL_VERSION) {
104 if ((control & 0x80) != 0) {
112 const uint8_t frame_num = (control >> 4) & ASH_MAX_SEQUENCE;
113 const bool re_tx = (control & 0x08) != 0;