* Extract a sized byte buffer from the packet. * @return The extracted buffer. */
| 383 | * @return The extracted buffer. |
| 384 | */ |
| 385 | std::vector<uint8_t> Packet::Recv_buffer() |
| 386 | { |
| 387 | uint16_t size = this->Recv_uint16(); |
| 388 | if (size == 0 || !this->CanReadFromPacket(size, true)) return {}; |
| 389 | |
| 390 | std::vector<uint8_t> data; |
| 391 | while (size-- > 0) { |
| 392 | data.push_back(this->buffer[this->pos++]); |
| 393 | } |
| 394 | |
| 395 | return data; |
| 396 | } |
| 397 | |
| 398 | /** |
| 399 | * Extract at most the length of the span bytes from the packet into the span. |
no test coverage detected