Horizon Official Technical Documentation
Horizon::Auth::AC_ACCEPT_LOGIN Class Reference

Main object for the aegis packet: AC_ACCEPT_LOGIN. More...

#include <TransmittedPackets.hpp>

+ Inheritance diagram for Horizon::Auth::AC_ACCEPT_LOGIN:
+ Collaboration diagram for Horizon::Auth::AC_ACCEPT_LOGIN:

Public Member Functions

 AC_ACCEPT_LOGIN (std::shared_ptr< AuthSession > s)
 
virtual ~AC_ACCEPT_LOGIN ()
 
void deliver (int32_t auth_code, uint32_t aid, uint32_t user_level, uint8_t sex)
 AC_ACCEPT_LOGIN. More...
 
ByteBufferserialize ()
 
- Public Member Functions inherited from Horizon::Base::NetworkPacket< AuthSession >
 NetworkPacket (uint16_t packet_id, std::shared_ptr< AuthSession > s)
 
virtual ~NetworkPacket ()
 
void set_packet_id (uint16_t id)
 
uint16_t get_packet_id ()
 
ByteBufferbuf ()
 
std::shared_ptr< AuthSession > get_session ()
 Retrieves the session from this handler instance. More...
 
virtual void handle (ByteBuffer &&buf)
 
virtual void deserialize (ByteBuffer &buf)
 
void transmit ()
 Send an Asynchronous packet by queueing a buffer of a particular size to the connected session. More...
 
void transmit (std::size_t size)
 Send an Asynchronous packet by queueing a buffer of a particular size to the connected session. More...
 

Public Attributes

s_ac_accept_login _al
 
std::vector< s_ac_char_server_list_c
 

Additional Inherited Members

- Protected Attributes inherited from Horizon::Base::NetworkPacket< AuthSession >
ByteBuffer _buffer
 Buffer storage facility for the packet stream. More...
 
uint16_t _packet_id
 ID of the network packet. More...
 

Detailed Description

Main object for the aegis packet: AC_ACCEPT_LOGIN.

Constructor & Destructor Documentation

◆ AC_ACCEPT_LOGIN()

Horizon::Auth::AC_ACCEPT_LOGIN::AC_ACCEPT_LOGIN ( std::shared_ptr< AuthSession s)
inline
107 : NetworkPacket<AuthSession>(ID_AC_ACCEPT_LOGIN, s)
108 {}
@ ID_AC_ACCEPT_LOGIN
Definition: TransmittedPackets.hpp:76

◆ ~AC_ACCEPT_LOGIN()

virtual Horizon::Auth::AC_ACCEPT_LOGIN::~AC_ACCEPT_LOGIN ( )
inlinevirtual
109{}

Member Function Documentation

◆ deliver()

void AC_ACCEPT_LOGIN::deliver ( int32_t  auth_code,
uint32_t  aid,
uint32_t  user_level,
uint8_t  sex 
)

AC_ACCEPT_LOGIN.

39{
40 _al.packet_len = 2 + sizeof(struct s_ac_accept_login) + (sizeof(s_ac_char_server_list) * sAuth->get_auth_config().get_char_servers().size());
41 _al.auth_code = auth_code;
42 _al.aid = aid;
43 _al.user_level = user_level;
45 memset(_al.last_login_time, '\0', sizeof(_al.last_login_time));
46 _al.sex = sex;
47
48 for (auth_config_type::char_server c : sAuth->get_auth_config().get_char_servers()) {
50 sc.ip = inet_addr(c._host.c_str());
51 sc.port = c._port;
52 strncpy(sc.name, c._name.c_str(), sizeof(sc.name));
53 sc.usercount = 10;
54 sc.is_new = c._is_new;
55 sc.type = c._type;
56 _c.push_back(sc);
57 }
58
59 serialize();
60 transmit();
61}
#define sAuth
Definition: Auth.hpp:131
std::vector< s_ac_char_server_list > _c
Definition: TransmittedPackets.hpp:116
ByteBuffer & serialize()
Definition: TransmittedPackets.cpp:63
s_ac_accept_login _al
Definition: TransmittedPackets.hpp:115
void transmit()
Send an Asynchronous packet by queueing a buffer of a particular size to the connected session.
Definition: NetworkPacket.hpp:94
Definition: TransmittedPackets.hpp:42
uint32_t last_login_ip
Last login IP.
Definition: TransmittedPackets.hpp:47
char last_login_time[26]
Last login timestamp.
Definition: TransmittedPackets.hpp:48
int16_t packet_len
Packet length (variable length)
Definition: TransmittedPackets.hpp:43
uint32_t aid
Account ID.
Definition: TransmittedPackets.hpp:45
uint32_t user_level
User level.
Definition: TransmittedPackets.hpp:46
int32_t auth_code
Authentication code.
Definition: TransmittedPackets.hpp:44
uint8_t sex
Account sex.
Definition: TransmittedPackets.hpp:49
Definition: TransmittedPackets.hpp:57
uint16_t is_new
Server state.
Definition: TransmittedPackets.hpp:62
char name[20]
Server name.
Definition: TransmittedPackets.hpp:60
uint32_t ip
Server IP address.
Definition: TransmittedPackets.hpp:58
uint16_t type
Server type @ character_server_type.
Definition: TransmittedPackets.hpp:63
uint16_t usercount
Online users.
Definition: TransmittedPackets.hpp:61
int16_t port
Server port.
Definition: TransmittedPackets.hpp:59

References _al, _c, Horizon::Auth::s_ac_accept_login::aid, Horizon::Auth::s_ac_accept_login::auth_code, Horizon::Auth::s_ac_char_server_list::ip, Horizon::Auth::s_ac_char_server_list::is_new, Horizon::Auth::s_ac_accept_login::last_login_ip, Horizon::Auth::s_ac_accept_login::last_login_time, Horizon::Auth::s_ac_char_server_list::name, Horizon::Auth::s_ac_accept_login::packet_len, Horizon::Auth::s_ac_char_server_list::port, sAuth, serialize(), Horizon::Auth::s_ac_accept_login::sex, Horizon::Base::NetworkPacket< AuthSession >::transmit(), Horizon::Auth::s_ac_char_server_list::type, Horizon::Auth::s_ac_accept_login::user_level, and Horizon::Auth::s_ac_char_server_list::usercount.

Referenced by Horizon::Auth::AuthClientInterface::process_login().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ serialize()

ByteBuffer & AC_ACCEPT_LOGIN::serialize ( )
64{
65 buf() << _packet_id;
66 buf() << _al.packet_len;
67 buf() << _al.auth_code;
68 buf() << _al.aid;
69 buf() << _al.user_level;
70 buf() << _al.last_login_ip; // not used anymore
71 memset(_al.last_login_time, '\0', sizeof(_al.last_login_time));
72 buf().append(_al.last_login_time, sizeof(_al.last_login_time)); // not used anymore
73 buf() << _al.sex;
74
75#if PACKET_VERSION >= 20170315
77 buf() << _al.twitter_flag;
78#endif
79
80 for (s_ac_char_server_list sc : _c) {
81 buf() << sc.ip;
82 buf() << sc.port;
83 buf().append(sc.name, sizeof(sc.name));
84 buf() << sc.usercount;
85 buf() << sc.is_new;
86 buf() << sc.type;
87#if PACKET_VERSION >= 20170315
88 buf().append(sc.unknown2, sizeof(sc.unknown2));
89#endif
90 }
91
92 HLog(debug) << "Serialized AC_ACCEPT_LOGIN of size " << _al.packet_len << ". Buffer:" << buf().to_string();
93
94 return buf();
95}
#define HLog(type)
Definition: Logger.hpp:122
void append(T value)
Definition: ByteBuffer.hpp:140
std::string to_string()
Definition: ByteBuffer.hpp:330
uint16_t _packet_id
ID of the network packet.
Definition: NetworkPacket.hpp:87
ByteBuffer & buf()
Definition: NetworkPacket.hpp:59
uint8_t twitter_flag
Definition: TransmittedPackets.hpp:52
char twitter_auth_token[16]
Definition: TransmittedPackets.hpp:51

References _al, _c, Horizon::Base::NetworkPacket< AuthSession >::_packet_id, Horizon::Auth::s_ac_accept_login::aid, ByteBuffer::append(), Horizon::Auth::s_ac_accept_login::auth_code, Horizon::Base::NetworkPacket< AuthSession >::buf(), HLog, Horizon::Auth::s_ac_accept_login::last_login_ip, Horizon::Auth::s_ac_accept_login::last_login_time, Horizon::Auth::s_ac_accept_login::packet_len, Horizon::Auth::s_ac_accept_login::sex, ByteBuffer::to_string(), Horizon::Auth::s_ac_accept_login::twitter_auth_token, Horizon::Auth::s_ac_accept_login::twitter_flag, and Horizon::Auth::s_ac_accept_login::user_level.

Referenced by deliver().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ _al

s_ac_accept_login Horizon::Auth::AC_ACCEPT_LOGIN::_al

Referenced by deliver(), and serialize().

◆ _c

std::vector<s_ac_char_server_list> Horizon::Auth::AC_ACCEPT_LOGIN::_c

Referenced by deliver(), and serialize().


The documentation for this class was generated from the following files: