MCPcopy Create free account
hub / github.com/comaps/comaps / DecodeHeader

Method DecodeHeader

libs/tracking/protocol.cpp:81–93  ·  view source on GitHub ↗

static

Source from the content-addressed store, hash-verified

79
80// static
81pair<Protocol::PacketType, size_t> Protocol::DecodeHeader(vector<uint8_t> const & data)
82{
83 if (data.size() < sizeof(uint32_t /* header */))
84 {
85 LOG(LWARNING, ("Header size is too small", data.size(), sizeof(uint32_t /* header */)));
86 return make_pair(PacketType::Error, data.size());
87 }
88
89 uint32_t size = (*reinterpret_cast<uint32_t const *>(data.data())) & 0xFFFFFF00;
90 if (!IsBigEndianMacroBased())
91 size = ReverseByteOrder(size);
92 return make_pair(PacketType(static_cast<uint8_t>(data[0])), size);
93}
94
95// static
96string Protocol::DecodeAuthPacket(Protocol::PacketType type, vector<uint8_t> const & data)

Callers

nothing calls this directly

Calls 5

IsBigEndianMacroBasedFunction · 0.85
ReverseByteOrderFunction · 0.85
PacketTypeEnum · 0.85
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected