1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef NL_ACTION_LOGIN_H
20 #define NL_ACTION_LOGIN_H
22 #include "nel/misc/types_nl.h"
24 #include "nel/net/login_cookie.h"
29 namespace CLFECOMMON
{
32 * This action means the entity Id has left the game.
33 * Note: No more data or processing than in CAction.
34 * \author Olivier Cado
35 * \author Nevrax France
38 class CActionLogin
: public CAction
42 /** This function creates initializes its fields using the buffer.
43 * \param buffer pointer to the buffer where the data are
44 * \size size of the buffer
46 virtual void unpack (NLMISC::CBitMemStream
&message
)
52 Cookie
.set (ua
, uk
, ui
);
55 /** Returns the size of this action when it will be send to the UDP connection:
56 * the size is IN BITS, not in bytes (the actual size is this one plus the header size)
58 virtual uint32
size () { return 3*32; }
60 static CAction
*create () { return new CActionLogin(); }
62 void setCookie (NLNET::CLoginCookie
&lc
)
67 const NLNET::CLoginCookie
&getCookie () const { return Cookie
; }
71 NLNET::CLoginCookie Cookie
;
73 /** This function transform the internal field and transform them into a buffer for the UDP connection.
74 * \param buffer pointer to the buffer where the data will be written
75 * \size size of the buffer
77 virtual void pack (NLMISC::CBitMemStream
&message
)
80 if (Cookie
.isValid ())
82 ua
= Cookie
.getUserAddr ();
83 uk
= Cookie
.getUserKey ();
84 ui
= Cookie
.getUserId ();
86 // if not valid, serialize dummy things
97 friend class CActionFactory
;
103 #endif // NL_ACTION_LOGIN_H
105 /* End of action_login.h */