forked from ravinet/mahimahi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnat.hh
50 lines (36 loc) · 995 Bytes
/
nat.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
50
/* -*-mode:c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#ifndef NAT_HH
#define NAT_HH
/* Network Address Translator */
#include <string>
#include "config.h"
#include "system_runner.hh"
#include "address.hh"
/* RAII class to make connections coming from the ingress address
look like they're coming from the output device's address.
We mark the connections on entry from the ingress address (with our PID),
and then look for the mark on output. */
class NATRule {
private:
std::vector< std::string > arguments;
public:
NATRule( const std::vector< std::string > & s_args );
~NATRule();
NATRule( const NATRule & other ) = delete;
const NATRule & operator=( const NATRule & other ) = delete;
};
class NAT
{
private:
NATRule pre_, post_;
public:
NAT( const Address & ingress_addr );
};
class DNAT
{
private:
NATRule rule_;
public:
DNAT( const Address & listener, const std::string & interface );
};
#endif /* NAT_HH */