forked from ravinet/mahimahi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpacketshell.hh
49 lines (36 loc) · 1.22 KB
/
packetshell.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* -*-mode:c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#ifndef PACKETSHELL_HH
#define PACKETSHELL_HH
#include <memory>
#include "netdevice.hh"
#include "nat.hh"
#include "util.hh"
#include "get_address.hh"
#include "address.hh"
#include "dns_proxy.hh"
template <class FerryType>
class PacketShell
{
private:
std::pair<Address, Address> egress_ingress;
Address nameserver_;
TunDevice egress_tun_;
std::unique_ptr<DNSProxy> dns_outside_;
NAT nat_rule_ {};
std::pair<FileDescriptor, FileDescriptor> pipe_;
std::vector<ChildProcess> child_processes_;
const Address & egress_addr( void ) { return egress_ingress.first; }
const Address & ingress_addr( void ) { return egress_ingress.second; }
public:
PacketShell( const std::string & device_prefix );
template <typename... Targs>
void start_uplink( const std::string & shell_prefix,
char ** const user_environment,
Targs&&... Fargs );
template <typename... Targs>
void start_downlink( Targs&&... Fargs );
int wait_for_exit( void );
PacketShell( const PacketShell & other ) = delete;
PacketShell & operator=( const PacketShell & other ) = delete;
};
#endif