add packet constructor which accepts payload buffer.
This commit is contained in:
@@ -38,6 +38,16 @@ Packet::Packet (uint32_t size)
|
||||
{
|
||||
m_global_uid++;
|
||||
}
|
||||
Packet::Packet (uint8_t const*buffer, uint32_t size)
|
||||
: m_buffer (),
|
||||
m_uid (m_global_uid)
|
||||
{
|
||||
m_global_uid++;
|
||||
m_buffer.AddAtStart (size);
|
||||
Buffer::Iterator i = m_buffer.Begin ();
|
||||
i.Write (buffer, size);
|
||||
}
|
||||
|
||||
Packet::Packet (Buffer buffer, Tags tags, uint32_t uid)
|
||||
: m_buffer (buffer),
|
||||
m_tags (tags),
|
||||
|
||||
@@ -103,6 +103,15 @@ public:
|
||||
* \param size the size of the zero-filled payload
|
||||
*/
|
||||
Packet (uint32_t size);
|
||||
/**
|
||||
* Create a packet with payload filled with the content
|
||||
* of this buffer. The input data is copied: the input
|
||||
* buffer is untouched.
|
||||
*
|
||||
* \param buffer the data to store in the packet.
|
||||
* \param size the size of the input buffer.
|
||||
*/
|
||||
Packet (uint8_t const*buffer, uint32_t size);
|
||||
/**
|
||||
* Create a new packet which contains a fragment of the original
|
||||
* packet. The returned packet shares the same uid as this packet.
|
||||
|
||||
Reference in New Issue
Block a user