forked from nefarius/sm-ext-socket
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Callback.h
53 lines (37 loc) · 1.06 KB
/
Callback.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
#ifndef INC_SEXT_CALLBACK_H
#define INC_SEXT_CALLBACK_H
#include <string>
#include <boost/asio.hpp>
#include "Define.h"
struct SocketWrapper;
class Callback {
public:
/**
* construct a connect, disconnect or sendqueueempty callback
*/
Callback(CallbackEvent callbackEvent, const void* socket);
/**
* construct a receive callback
*/
Callback(CallbackEvent callbackEvent, const void* socket, const char* data, size_t dataLength);
/**
* construct an incoming callback
*/
Callback(CallbackEvent callbackEvent, const void* socket, const void* newSocket, const boost::asio::ip::tcp::endpoint& remoteEndPoint);
/**
* construct an error callback
*/
Callback(CallbackEvent callbackEvent, const void* socket, SM_ErrorType errorType, int errorNumber);
~Callback();
bool IsExecutable();
bool IsValid();
void Execute();
friend class CallbackHandler;
private:
template<class SocketType> void ExecuteHelper();
const CallbackEvent callbackEvent;
SocketWrapper* socketWrapper;
const void* additionalData[2];
// volatile bool isExecuting;
};
#endif