mirror of https://github.com/oxen-io/lokinet
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
556 B
C++
36 lines
556 B
C++
6 years ago
|
#ifndef LLARP_EV_HPP
|
||
|
#define LLARP_EV_HPP
|
||
|
#include <llarp/ev.h>
|
||
|
|
||
|
#include <unistd.h>
|
||
|
|
||
|
namespace llarp
|
||
|
{
|
||
|
struct ev_io
|
||
|
{
|
||
|
char buff[2048];
|
||
|
int fd;
|
||
|
ev_io(int f) : fd(f) {};
|
||
|
virtual int read() = 0;
|
||
|
virtual int sendto(const sockaddr * dst, const void * data, size_t sz) = 0;
|
||
|
virtual ~ev_io()
|
||
|
{
|
||
|
::close(fd);
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
|
||
|
struct llarp_ev_loop {
|
||
|
|
||
|
virtual bool init() = 0;
|
||
|
virtual int run() = 0;
|
||
|
virtual void stop() = 0;
|
||
|
|
||
|
virtual bool udp_listen(llarp_udp_io * l) = 0;
|
||
|
|
||
|
virtual ~llarp_ev_loop() {};
|
||
|
|
||
|
};
|
||
|
|
||
|
#endif
|