2019-10-04 18:10:58 +00:00
|
|
|
#ifndef LLARP_EV_VPNIO_HPP
|
|
|
|
#define LLARP_EV_VPNIO_HPP
|
2020-05-20 19:02:48 +00:00
|
|
|
#include <net/ip_packet.hpp>
|
2019-10-04 18:10:58 +00:00
|
|
|
#include <util/thread/queue.hpp>
|
2020-06-29 20:39:31 +00:00
|
|
|
#include <llarp.hpp>
|
2019-10-04 18:10:58 +00:00
|
|
|
#include <functional>
|
|
|
|
|
|
|
|
struct llarp_main;
|
|
|
|
struct llarp_vpn_io;
|
|
|
|
|
|
|
|
struct llarp_vpn_pkt_queue
|
|
|
|
{
|
|
|
|
using Packet_t = llarp::net::IPPacket;
|
2020-04-07 18:38:56 +00:00
|
|
|
llarp::thread::Queue<Packet_t> queue;
|
2019-10-04 18:10:58 +00:00
|
|
|
|
|
|
|
llarp_vpn_pkt_queue() : queue(1024){};
|
|
|
|
~llarp_vpn_pkt_queue() = default;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct llarp_vpn_pkt_writer : public llarp_vpn_pkt_queue
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
|
|
|
struct llarp_vpn_pkt_reader : public llarp_vpn_pkt_queue
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
|
|
|
struct llarp_vpn_io_impl
|
|
|
|
{
|
2020-06-29 20:39:31 +00:00
|
|
|
llarp_vpn_io_impl(llarp::Context* c, llarp_vpn_io* io) : ctx(c), parent(io)
|
2019-10-04 18:10:58 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
~llarp_vpn_io_impl() = default;
|
|
|
|
|
2020-06-29 20:39:31 +00:00
|
|
|
llarp::Context* ctx;
|
2019-10-04 18:10:58 +00:00
|
|
|
llarp_vpn_io* parent;
|
|
|
|
|
|
|
|
llarp_vpn_pkt_writer writer;
|
|
|
|
llarp_vpn_pkt_reader reader;
|
|
|
|
|
|
|
|
void
|
|
|
|
AsyncClose();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void
|
|
|
|
Expunge();
|
|
|
|
};
|
|
|
|
|
2020-05-20 19:02:48 +00:00
|
|
|
#endif
|