2018-07-09 04:12:43 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "llarp/buffer.h"
|
|
|
|
|
|
|
|
#include <queue>
|
|
|
|
|
|
|
|
struct sendbuf_t
|
|
|
|
{
|
|
|
|
sendbuf_t(size_t s) : sz(s)
|
|
|
|
{
|
2018-07-11 16:11:19 +00:00
|
|
|
_buf = new byte_t[s];
|
2018-07-09 04:12:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
~sendbuf_t()
|
|
|
|
{
|
2018-07-11 16:11:19 +00:00
|
|
|
if(_buf)
|
|
|
|
delete[] _buf;
|
2018-07-09 04:12:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
size_t sz;
|
|
|
|
|
|
|
|
size_t
|
|
|
|
size() const
|
|
|
|
{
|
|
|
|
return sz;
|
|
|
|
}
|
|
|
|
|
|
|
|
byte_t *
|
|
|
|
data()
|
|
|
|
{
|
2018-07-11 16:11:19 +00:00
|
|
|
return _buf;
|
2018-07-09 04:12:43 +00:00
|
|
|
}
|
2018-07-11 16:11:19 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
byte_t *_buf = nullptr;
|
2018-07-09 04:12:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::queue< sendbuf_t * > sendqueue_t;
|