| 119 | |
| 120 | |
| 121 | uint8_t Packet::get_packed_flags() { |
| 122 | assert(_object); |
| 123 | uint8_t packed_flags = 0; |
| 124 | if (_object->_context == LRPROOF) { |
| 125 | //TRACE("***** Packing with LINK type"); |
| 126 | packed_flags = (_object->_header_type << 6) | (_object->_context_flag << 5) | (_object->_transport_type << 4) | (Type::Destination::LINK << 2) | _object->_packet_type; |
| 127 | } |
| 128 | else { |
| 129 | if (!_object->_destination) { |
| 130 | throw std::logic_error("Packet destination is required"); |
| 131 | } |
| 132 | //TRACEF("***** Packing with %d type", _object->_destination.type()); |
| 133 | packed_flags = (_object->_header_type << 6) | (_object->_context_flag << 5) | (_object->_transport_type << 4) | (_object->_destination.type() << 2) | _object->_packet_type; |
| 134 | } |
| 135 | return packed_flags; |
| 136 | } |
| 137 | |
| 138 | void Packet::unpack_flags(uint8_t flags) { |
| 139 | assert(_object); |