-
Notifications
You must be signed in to change notification settings - Fork 1
/
nat_get.h
63 lines (47 loc) · 1.37 KB
/
nat_get.h
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
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef __NAT_GET_H__
#define __NAT_GET_H__
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
#include <vector>
#include <string>
#include "type_key.h"
#include <ydx/callback_types.h>
#include <ydx/ydx_mutex.h>
#include <ydx/tcp_server.h>
#include <ydx/epoller.h>
using namespace ydx;
struct nf_info;
struct nfct_handle;
struct nf_conntrack;
struct nfct_filter_dump;
struct request_message;
class NetFilterGet : boost::noncopyable
{
public:
NetFilterGet();
~NetFilterGet();
void work(void);
void Run(request_message* msg, const ydx::TcpConnectionPtr& conn);
int filter_nat(const struct nf_conntrack *obj,
const struct nf_conntrack *ct);
void store_info(char* in_buf);
void onMessage(const TcpConnectionPtr& conn, ydx::Buffer* buf);
void onConnection(const TcpConnectionPtr& conn);
boost::shared_ptr<nf_info> get_info(){return info_;}
private:
int alloc_tmpl_objects(void);
void free_tmpl_objects(void);
bool get_key_and_value(std::string & line,
std::string & key,
std::string & value);
boost::shared_ptr<nf_info> info_;
boost::shared_ptr<nfct_handle> nf_handle_;
boost::shared_ptr<nfct_filter_dump> filter_dump_;
tuple_key_map netfliter_map_;
std::vector<std::string> info_buf_;
int family_;
mutable ydx::MutexLock mutex_;
boost::shared_ptr<EPollPoller> epoller_;
boost::shared_ptr<TcpServer> server_;
};
#endif