MADARA  3.4.1
ReducedMessageHeader.h
Go to the documentation of this file.
1 #ifndef _MADARA_REDUCED_MESSAGE_HEADER_H_
2 #define _MADARA_REDUCED_MESSAGE_HEADER_H_
3 
12 #include <string.h>
13 #include "madara/utility/StdInt.h"
14 #include "madara/MadaraExport.h"
16 
17 namespace madara
18 {
19 namespace transport
20 {
21 #define REDUCED_MADARA_ID "karl1.5"
22 
38 class MADARA_EXPORT ReducedMessageHeader : public MessageHeader
39 {
40 public:
41 #define REDUCED_ORIGINATOR_SIZE 24
42 
46  ReducedMessageHeader();
47 
51  virtual ~ReducedMessageHeader();
52 
58  virtual uint32_t encoded_size(void) const;
59 
69  virtual const char* read(const char* buffer, int64_t& buffer_remaining);
70 
80  virtual char* write(char* buffer, int64_t& buffer_remaining);
81 
86  virtual std::string to_string(void);
87 
93  virtual bool equals(const MessageHeader& other);
94 
99  static inline bool reduced_message_header_test(const char* buffer)
100  {
101  return strncmp(&(buffer[8]), REDUCED_MADARA_ID, 7) == 0;
102  }
103 };
104 }
105 }
106 
107 #endif // _MADARA_REDUCED_MESSAGE_HEADER_H_
#define REDUCED_MADARA_ID
Defines a robust message header which is the default for KaRL messages.
Definition: MessageHeader.h:57
Defines a simple, smaller message header of 29 bytes that supports less QoS.
static bool reduced_message_header_test(const char *buffer)
Tests the buffer for a reduced message identifier.
constexpr string_t string
Copyright(c) 2020 Galois.