Move buffer.hpp to llarp/

pull/137/head
Michael 6 years ago
parent f51384f92e
commit c064893947
No known key found for this signature in database
GPG Key ID: 2D51757B47E2434C

@ -1,10 +1,11 @@
#ifndef LLARP_BENCODE_HPP
#define LLARP_BENCODE_HPP
#include <buffer.hpp>
#include <llarp/bencode.h>
#include <llarp/buffer.hpp>
#include <llarp/logger.hpp>
#include <llarp/mem.hpp>
#include <set>
#include <fstream>

@ -1,57 +0,0 @@
#ifndef LLARP_BUFFER_HPP
#define LLARP_BUFFER_HPP
#include <llarp/buffer.h>
namespace llarp
{
template < typename T >
llarp_buffer_t
StackBuffer(T& stack)
{
llarp_buffer_t buff;
buff.base = &stack[0];
buff.cur = buff.base;
buff.sz = sizeof(stack);
return buff;
}
/** initialize llarp_buffer_t from raw memory */
template < typename T >
llarp_buffer_t
InitBuffer(T buf, size_t sz)
{
byte_t* ptr = (byte_t*)buf;
llarp_buffer_t ret;
ret.cur = ptr;
ret.base = ptr;
ret.sz = sz;
return ret;
}
/** initialize llarp_buffer_t from container */
template < typename T >
llarp_buffer_t
Buffer(T& t)
{
llarp_buffer_t buff;
buff.base = &t[0];
buff.cur = buff.base;
buff.sz = t.size();
return buff;
}
template < typename T >
llarp_buffer_t
ConstBuffer(const T& t)
{
llarp_buffer_t buff;
buff.base = (byte_t*)&t[0];
buff.cur = buff.base;
buff.sz = t.size();
return buff;
}
} // namespace llarp
#endif

@ -2,7 +2,7 @@
#include <abyss/http.hpp>
#include <llarp/logger.hpp>
#include <llarp/crypto.hpp>
#include <llarp/buffer.hpp>
#include <buffer.hpp>
namespace abyss
{

@ -1,12 +1,13 @@
#include <abyss/server.hpp>
#include <abyss/http.hpp>
#include <abyss/server.hpp>
#include <buffer.hpp>
#include <llarp/logger.hpp>
#include <llarp/time.hpp>
#include <llarp/buffer.hpp>
#include <algorithm>
#include <sstream>
#include <unordered_map>
#include <string>
#include <llarp/logger.hpp>
#include <algorithm>
#include <unordered_map>
namespace abyss
{

@ -1 +1,57 @@
#include <llarp/buffer.hpp>
#ifndef LLARP_BUFFER_HPP
#define LLARP_BUFFER_HPP
#include <llarp/buffer.h>
namespace llarp
{
template < typename T >
llarp_buffer_t
StackBuffer(T& stack)
{
llarp_buffer_t buff;
buff.base = &stack[0];
buff.cur = buff.base;
buff.sz = sizeof(stack);
return buff;
}
/** initialize llarp_buffer_t from raw memory */
template < typename T >
llarp_buffer_t
InitBuffer(T buf, size_t sz)
{
byte_t* ptr = (byte_t*)buf;
llarp_buffer_t ret;
ret.cur = ptr;
ret.base = ptr;
ret.sz = sz;
return ret;
}
/** initialize llarp_buffer_t from container */
template < typename T >
llarp_buffer_t
Buffer(T& t)
{
llarp_buffer_t buff;
buff.base = &t[0];
buff.cur = buff.base;
buff.sz = t.size();
return buff;
}
template < typename T >
llarp_buffer_t
ConstBuffer(const T& t)
{
llarp_buffer_t buff;
buff.base = (byte_t*)&t[0];
buff.cur = buff.base;
buff.sz = t.size();
return buff;
}
} // namespace llarp
#endif

@ -1,7 +1,7 @@
#include <buffer.hpp>
#include <llarp/dns/message.hpp>
#include <llarp/endian.hpp>
#include <llarp/logger.hpp>
#include <llarp/buffer.hpp>
namespace llarp
{

@ -1,13 +1,13 @@
#include <llarp/endian.hpp>
#include <algorithm>
#include <llarp/ip.hpp>
#include "llarp/buffer.hpp"
#include <buffer.hpp>
#include <llarp/endian.hpp>
#include "mem.hpp"
#ifndef _WIN32
#include <netinet/in.h>
#endif
#include <map>
#include <algorithm>
#include <map>
namespace llarp
{

@ -1,14 +1,15 @@
#include <buffer.hpp>
#include <llarp/endian.hpp>
#include <llarp/link/utp.hpp>
#include <llarp/messages/link_intro.hpp>
#include <llarp/messages/discard.hpp>
#include <llarp/buffer.hpp>
#include <llarp/endian.hpp>
#include <llarp/messages/link_intro.hpp>
#include <router.hpp>
#include <utp.h>
#include <cassert>
#include <tuple>
#include <deque>
#include <router.hpp>
#ifdef __linux__
#include <linux/errqueue.h>

Loading…
Cancel
Save