YAPOG
0.0.1
Yet Another Pokemon Online Game
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
Session.hpp
Go to the documentation of this file.
1
#ifndef YAPOG_CLIENT_SESSION_HPP
2
# define YAPOG_CLIENT_SESSION_HPP
3
4
# include "
YAPOG/Macros.hpp
"
5
# include "
YAPOG/System/Network/IPacketHandler.hpp
"
6
# include "
YAPOG/System/Network/PacketHandler.hpp
"
7
# include "
YAPOG/System/Network/ClientSocket.hpp
"
8
# include "
YAPOG/System/Network/NetworkHandler.hpp
"
9
# include "
YAPOG/System/IntTypes.hpp
"
10
# include "
YAPOG/System/Thread/Thread.hpp
"
11
# include "
YAPOG/System/IntTypes.hpp
"
12
# include "
YAPOG/Game/Factory/ObjectFactory.hpp
"
13
14
# include "
Client/User.hpp
"
15
16
namespace
ycl
17
{
18
class
Session
:
public
yap::IPacketHandler
19
{
20
DISALLOW_COPY
(
Session
);
21
22
public
:
23
24
static
Session
&
Instance
();
25
26
void
Refresh
();
27
28
void
Login
(
const
yap::String
& login,
const
yap::String
& password);
29
void
Register
(
30
const
yap::String
& login,
31
const
yap::String
& password,
32
const
yap::String
& email);
33
void
Disconnect
();
34
35
User
&
GetUser
();
36
39
virtual
bool
HandlePacket
(
yap::IPacket
& packet);
40
virtual
bool
SendPacket
(
yap::IPacket
& packet);
41
42
virtual
void
AddRelay
(
yap::IPacketHandler
* relay);
43
virtual
void
RemoveRelay
(
yap::IPacketHandler
* relay);
44
virtual
void
SetParent
(
yap::IPacketHandler
* parent);
46
49
yap::Event<Session&, yap::EmptyEventArgs>
OnLoginValidation
;
50
yap::Event<Session&, yap::EmptyEventArgs>
OnRegistrationValidation
;
51
yap::Event<Session&, yap::EmptyEventArgs>
OnLoginError
;
52
yap::Event<Session&, yap::EmptyEventArgs>
OnRegistrationError
;
54
55
private
:
56
57
Session
();
58
virtual
~Session
();
59
60
bool
Connect
();
61
void
HandleReception
();
62
63
void
HandleServerInfoLoginValidation
(
yap::IPacket
& packet);
64
void
HandleServerInfoRegistrationValidation
(
yap::IPacket
& packet);
65
void
HandleServerInfoLoginError
(
yap::IPacket
& packet);
66
void
HandleServerInfoRegistrationError
(
yap::IPacket
& packet);
67
68
void
HandleServerInfoPrimaryData
(
yap::IPacket
& packet);
69
void
UpdateObjectFactory
(
70
yap::IPacket
& packet,
71
yap::ObjectFactory
& objectFactory);
72
73
static
const
yap::String
DEFAULT_REMOTE_IP
;
74
static
const
yap::Int16
DEFAULT_REMOTE_PORT
;
75
76
static
const
yap::Time
DEFAULT_RECEPTION_SLEEP_DELAY
;
77
78
yap::PacketHandler
packetHandler_
;
79
80
yap::Thread
receptionThread_
;
81
bool
receptionIsActive_
;
82
83
yap::ClientSocket
socket_
;
84
yap::NetworkHandler
networkHandler_
;
85
yap::Mutex
networkHandlerMutex_
;
86
87
User
user_
;
88
89
bool
isConnected_
;
90
};
91
}
92
93
#endif // YAPOG_CLIENT_SESSION_HPP
YAPOG.Client
include
Client
Session.hpp
Generated on Mon Sep 17 2012 22:24:21 for YAPOG by
1.8.1.1