summaryrefslogtreecommitdiff
path: root/src/login/lclif.p.h
blob: cc9805ea813be9b55fbb02e0d6436675e025118b (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/**
 * This file is part of Hercules.
 * http://herc.ws - http://github.com/HerculesWS/Hercules
 *
 * Copyright (C) 2016  Hercules Dev Team
 *
 * Hercules is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#ifndef LOGIN_LCLIF_P_H
#define LOGIN_LCLIF_P_H

/** @file
 * Private header for the login client interface.
 */

#include "login/lclif.h"

#include "common/hercules.h"
#include "common/mmo.h"

/* Definitions and macros */
/// Maximum amount of packets processed at once from the same client
#ifndef MAX_PROCESSED_PACKETS
#define MAX_PROCESSED_PACKETS (3)
#endif

// Packet DB
#ifndef MIN_PACKET_DB
#define MIN_PACKET_DB 0x0064
#endif
#ifndef MAX_PACKET_LOGIN_DB
#define MAX_PACKET_LOGIN_DB 0x0ad0
#endif

/**
 * Login Client Interface additional data
 */
struct lclif_interface_dbs {
	struct login_packet_db packet_db[MAX_PACKET_LOGIN_DB + 1]; ///< Packet database.
};

/**
 * Login Client Interface Private Interface
 */
struct lclif_interface_private {
	struct lclif_interface_dbs *dbs;

	/**
	 * Populates the packet database.
	 */
	void (*packetdb_loaddb)(void);

	/**
	 * Attempts to validate and parse a received packet.
	 *
	 * @param fd  Client connection file descriptor.
	 * @param sd  Session data.
	 * @return Parse result error code.
	 */
	enum parsefunc_rcode (*parse_sub)(int fd, struct login_session_data *sd);

	LoginParseFunc *parse_CA_CONNECT_INFO_CHANGED; ///< Packet handler for #PACKET_CA_CONNECT_INFO_CHANGED.
	LoginParseFunc *parse_CA_EXE_HASHCHECK;        ///< Packet handler for #PACKET_CA_EXE_HASHCHECK.
	LoginParseFunc *parse_CA_LOGIN;                ///< Packet handler for #PACKET_CA_LOGIN.
	LoginParseFunc *parse_CA_LOGIN2;               ///< Packet handler for #PACKET_CA_LOGIN2.
	LoginParseFunc *parse_CA_LOGIN3;               ///< Packet handler for #PACKET_CA_LOGIN3.
	LoginParseFunc *parse_CA_LOGIN4;               ///< Packet handler for #PACKET_CA_LOGIN4.
	LoginParseFunc *parse_CA_LOGIN_PCBANG;         ///< Packet handler for #PACKET_CA_LOGIN_PCBANG.
	LoginParseFunc *parse_CA_LOGIN_HAN;            ///< Packet handler for #PACKET_CA_LOGIN_HAN.
	LoginParseFunc *parse_CA_SSO_LOGIN_REQ;        ///< Packet handler for #PACKET_CA_SSO_LOGIN_REQ.
	LoginParseFunc *parse_CA_LOGIN_OTP;            ///< Packet handler for #PACKET_CA_LOGIN_OTP.
	LoginParseFunc *parse_CA_ACK_MOBILE_OTP;       ///< Packet handler for #PACKET_CA_ACK_MOBILE_OTP.
	LoginParseFunc *parse_CA_OTP_CODE;             ///< Packet handler for #PACKET_CA_OTP_CODE.
	LoginParseFunc *parse_CA_REQ_HASH;             ///< Packet handler for #PACKET_CA_REQ_HASH.
	LoginParseFunc *parse_CA_CHARSERVERCONNECT;    ///< Packet handler for #PACKET_CA_CHARSERVERCONNECT.
};

#endif // LOGIN_LCLIF_P_H