-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathProxyController.h
More file actions
33 lines (27 loc) · 874 Bytes
/
ProxyController.h
File metadata and controls
33 lines (27 loc) · 874 Bytes
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
#ifndef __PROXY_CONTROLLER_H__
#define __PROXY_CONTROLLER_H__
#include <sys/types.h>
#include <boost/thread.hpp>
#include <boost/utility.hpp>
class ProxyServer;
typedef void (*proxy_callback_function)(const char* data, size_t len);
class ProxyController: boost::noncopyable
{
public:
static ProxyController& GetController();
~ProxyController();
void Start(unsigned int port);
void Stop();
void SetRequestCallback(proxy_callback_function f);
void SetResponseCallback(proxy_callback_function f);
void CallRequestCallback(const char* data, size_t len);
void CallResponseCallback(const char* data, size_t len);
private:
ProxyServer* GetProxyServer();
ProxyController();
proxy_callback_function m_request_callback;
proxy_callback_function m_response_callback;
boost::thread* m_server_thread;
bool m_running;
};
#endif