MCPcopy Create free account
hub / github.com/LUX-Core/lux / CMessageHeader

Class CMessageHeader

src/protocol.h:30–65  ·  view source on GitHub ↗

Message header. * (4) message start. * (12) command. * (4) size. * (4) checksum. */

Source from the content-addressed store, hash-verified

28 * (4) checksum.
29 */
30class CMessageHeader
31{
32public:
33 CMessageHeader();
34 CMessageHeader(const char* pszCommand, unsigned int nMessageSizeIn);
35
36 std::string GetCommand() const;
37 bool IsValid() const;
38
39 ADD_SERIALIZE_METHODS;
40
41 template <typename Stream, typename Operation>
42 inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion)
43 {
44 READWRITE(FLATDATA(pchMessageStart));
45 READWRITE(FLATDATA(pchCommand));
46 READWRITE(nMessageSize);
47 READWRITE(nChecksum);
48 }
49
50 // TODO: make private (improves encapsulation)
51public:
52 enum {
53 COMMAND_SIZE = 12,
54 MESSAGE_SIZE_SIZE = sizeof(int),
55 CHECKSUM_SIZE = sizeof(int),
56
57 MESSAGE_SIZE_OFFSET = MESSAGE_START_SIZE + COMMAND_SIZE,
58 CHECKSUM_OFFSET = MESSAGE_SIZE_OFFSET + MESSAGE_SIZE_SIZE,
59 HEADER_SIZE = MESSAGE_START_SIZE + COMMAND_SIZE + MESSAGE_SIZE_SIZE + CHECKSUM_SIZE
60 };
61 char pchMessageStart[MESSAGE_START_SIZE];
62 char pchCommand[COMMAND_SIZE];
63 unsigned int nMessageSize;
64 unsigned int nChecksum;
65};
66
67/** nServices flags */
68enum ServiceFlags : uint64_t {

Callers 1

EXCLUSIVE_LOCK_FUNCTIONFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected