36 #include <tins/macros.h> 37 #include <tins/cxxstd.h> 84 RawPDU(
const uint8_t* pload, uint32_t size);
95 template<
typename ForwardIterator>
96 RawPDU(ForwardIterator start, ForwardIterator end)
97 : payload_(start, end) { }
118 : payload_(move(data)) { }
119 #endif // TINS_IS_CXX11 126 RawPDU(
const std::string& data);
132 void payload(
const payload_type& pload);
139 template<
typename ForwardIterator>
140 void payload(ForwardIterator start, ForwardIterator end) {
141 payload_.assign(start, end);
167 uint32_t header_size()
const;
175 return static_cast<uint32_t
>(payload_.size());
188 bool matches_response(
const uint8_t* ptr, uint32_t total_sz)
const;
204 return T(&payload_[0], static_cast<uint32_t>(payload_.size()));
214 void write_serialization(uint8_t* buffer, uint32_t total_sz);
216 payload_type payload_;
221 #endif // TINS_RAWPDU_H RawPDU(const payload_type &data)
Creates an instance of RawPDU from a payload_type.
Definition: rawpdu.h:106
PDUType
Enum which identifies each type of PDU.
Definition: pdu.h:127
std::vector< uint8_t > payload_type
Definition: rawpdu.h:69
T to() const
Constructs the given PDU type from the raw data stored in this RawPDU.
Definition: rawpdu.h:203
uint32_t payload_size() const
Returns the payload size.
Definition: rawpdu.h:174
PDUType pdu_type() const
Getter for the PDU's type.
Definition: rawpdu.h:194
RawPDU(ForwardIterator start, ForwardIterator end)
Constructs a RawPDU from an iterator range.
Definition: rawpdu.h:96
The Tins namespace.
Definition: address_range.h:38
const payload_type & payload() const
Const getter for the payload.
Definition: rawpdu.h:148
RawPDU * clone() const
Definition: rawpdu.h:210
RawPDU(payload_type &&data)
Creates an instance of RawPDU from a payload_type.
Definition: rawpdu.h:117
void payload(ForwardIterator start, ForwardIterator end)
Setter for the payload field.
Definition: rawpdu.h:140
payload_type & payload()
Non-const getter for the payload.
Definition: rawpdu.h:156
Base class for protocol data units.
Definition: pdu.h:107