aboutsummaryrefslogtreecommitdiff
path: root/Src/auth/ifc_authcallback.h
blob: f6b44c2f85897fa91ff995a6fb69a83f8c409502 (plain) (blame)
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
#pragma once

#include <bfc/dispatch.h>
#include <windows.h> //need this for Sleep()

class ifc_authcallback : public Dispatchable
{
protected:
	ifc_authcallback() {}
	~ifc_authcallback() {}
public:
	int OnConnecting();
	int OnSending();
	int OnReceiving();
	// pump your message loop for a little while
	int OnIdle();

	enum
	{
		ONCONNECTING=0,
		ONSENDING=1,
		ONRECEIVING=2,
		ONIDLE=3,
	};
};

inline int ifc_authcallback::OnConnecting()
{
	return _call(ONCONNECTING, (int)0);
}
inline int ifc_authcallback::OnSending()
{
	return _call(ONSENDING, (int)0);
}
inline int ifc_authcallback::OnReceiving()
{
	return _call(ONRECEIVING, (int)0);
}
inline int ifc_authcallback::OnIdle()
{
	int retval;
  if (_dispatch(ONIDLE, &retval)) 
		return retval;
	else
	{
		// default implementation
		Sleep(50);
		return 0; 
	}

}