summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/packets/packets2019_len_main.h62
-rw-r--r--src/common/packets/packets2019_len_re.h62
-rw-r--r--src/common/packets/packets2019_len_zero.h14
-rw-r--r--src/common/socket.c13
-rw-r--r--src/common/socket.h2
5 files changed, 129 insertions, 24 deletions
diff --git a/src/common/packets/packets2019_len_main.h b/src/common/packets/packets2019_len_main.h
index f7ad59577..3b46c26cb 100644
--- a/src/common/packets/packets2019_len_main.h
+++ b/src/common/packets/packets2019_len_main.h
@@ -2,8 +2,8 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2019 Hercules Dev Team
- * Copyright (C) 2019 Andrei Karas (4144)
+ * Copyright (C) 2018-2019 Hercules Dev Team
+ * Copyright (C) 2018-2019 Andrei Karas (4144)
*
* Hercules is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -3994,13 +3994,13 @@ packetLen(0x0a95, 4)
packetLen(0x0a96, 61) // ZC_ADD_EXCHANGE_ITEM4
// Packet: 0x0a97
-packetLen(0x0a97, 8) // CZ_ALT_EQUIPMENT_EQUIP
+packetLen(0x0a97, 8) // CZ_ALT_EQUIPMENT_ADD
// Packet: 0x0a98
packetLen(0x0a98, 10) // ZC_ALT_EQUIPMENT_EQUIP
// Packet: 0x0a99
-packetLen(0x0a99, 4)
+packetLen(0x0a99, 4) // CZ_ALT_EQUIPMENT_REMOVE
// Packet: 0x0a9a
packetLen(0x0a9a, 10) // ZC_ALT_EQUIPMENT_REMOVE
@@ -4009,10 +4009,10 @@ packetLen(0x0a9a, 10) // ZC_ALT_EQUIPMENT_REMOVE
packetLen(0x0a9b, -1) // ZC_ALT_EQUIPMENT_ITEMS
// Packet: 0x0a9c
-packetLen(0x0a9c, 2)
+packetLen(0x0a9c, 2) // CZ_ALT_EQUIPMENT_SWITCH
// Packet: 0x0a9d
-packetLen(0x0a9d, 4)
+packetLen(0x0a9d, 4) // ZC_ALT_EQUIPMENT_SWITCH_ACK
// Packet: 0x0a9e
packetLen(0x0a9e, 2)
@@ -4168,7 +4168,7 @@ packetLen(0x0acf, 68) // CA_LOGIN_OTP
packetLen(0x0ad0, 11) // CA_OTP_CODE
// Packet: 0x0ad1
-packetLen(0x0ad1, -1)
+packetLen(0x0ad1, -1) // AC_LOGIN_OTP
// Packet: 0x0ad2
packetLen(0x0ad2, 30)
@@ -4375,7 +4375,53 @@ packetLen(0x0b18, 4) // ZC_INVENTORY_EXPANSION_INFO
packetLen(0x0b19, 2) // CZ_INVENTORY_EXPAND_REJECTED
// Packet: 0x0b1a
-packetLen(0x0b1a, 29)
+packetLen(0x0b1a, 29) // ZC_USESKILL_ACK3
+
+// Packet: 0x0b1b
+#if PACKETVER >= 20190213
+packetLen(0x0b1b, 2)
+#endif
+
+// Packet: 0x0b1c
+#if PACKETVER >= 20190227
+packetLen(0x0b1c, 2)
+#endif
+
+// Packet: 0x0b1d
+#if PACKETVER >= 20190227
+packetLen(0x0b1d, 2)
+#endif
+
+// Packet: 0x0b1e
+#if PACKETVER >= 20190227
+packetLen(0x0b1e, 10)
+#endif
+
+// Packet: 0x0b1f
+#if PACKETVER >= 20190306
+packetLen(0x0b1f, 10)
+#endif
+
+// Packet: 0x0b21
+#if PACKETVER >= 20190306
+// removed
+#elif PACKETVER >= 20190227
+packetLen(0x0b21, 10)
+#endif
+
+// Packet: 0x0b22
+#if PACKETVER >= 20190306
+// removed
+#elif PACKETVER >= 20190227
+packetLen(0x0b22, 6)
+#endif
+
+// Packet: 0x0b23
+#if PACKETVER >= 20190306
+// removed
+#elif PACKETVER >= 20190227
+packetLen(0x0b23, 10)
+#endif
#endif /* COMMON_PACKETS2019_LEN_MAIN_H */
diff --git a/src/common/packets/packets2019_len_re.h b/src/common/packets/packets2019_len_re.h
index 134102bac..6614fa8fd 100644
--- a/src/common/packets/packets2019_len_re.h
+++ b/src/common/packets/packets2019_len_re.h
@@ -2,8 +2,8 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2019 Hercules Dev Team
- * Copyright (C) 2019 Andrei Karas (4144)
+ * Copyright (C) 2018-2019 Hercules Dev Team
+ * Copyright (C) 2018-2019 Andrei Karas (4144)
*
* Hercules is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -4000,13 +4000,13 @@ packetLen(0x0a95, 4)
packetLen(0x0a96, 61) // ZC_ADD_EXCHANGE_ITEM4
// Packet: 0x0a97
-packetLen(0x0a97, 8) // CZ_ALT_EQUIPMENT_EQUIP
+packetLen(0x0a97, 8) // CZ_ALT_EQUIPMENT_ADD
// Packet: 0x0a98
packetLen(0x0a98, 10) // ZC_ALT_EQUIPMENT_EQUIP
// Packet: 0x0a99
-packetLen(0x0a99, 4)
+packetLen(0x0a99, 4) // CZ_ALT_EQUIPMENT_REMOVE
// Packet: 0x0a9a
packetLen(0x0a9a, 10) // ZC_ALT_EQUIPMENT_REMOVE
@@ -4015,10 +4015,10 @@ packetLen(0x0a9a, 10) // ZC_ALT_EQUIPMENT_REMOVE
packetLen(0x0a9b, -1) // ZC_ALT_EQUIPMENT_ITEMS
// Packet: 0x0a9c
-packetLen(0x0a9c, 2)
+packetLen(0x0a9c, 2) // CZ_ALT_EQUIPMENT_SWITCH
// Packet: 0x0a9d
-packetLen(0x0a9d, 4)
+packetLen(0x0a9d, 4) // ZC_ALT_EQUIPMENT_SWITCH_ACK
// Packet: 0x0a9e
packetLen(0x0a9e, 2)
@@ -4174,7 +4174,7 @@ packetLen(0x0acf, 68) // CA_LOGIN_OTP
packetLen(0x0ad0, 11) // CA_OTP_CODE
// Packet: 0x0ad1
-packetLen(0x0ad1, -1)
+packetLen(0x0ad1, -1) // AC_LOGIN_OTP
// Packet: 0x0ad2
packetLen(0x0ad2, 30)
@@ -4381,7 +4381,53 @@ packetLen(0x0b18, 4) // ZC_INVENTORY_EXPANSION_INFO
packetLen(0x0b19, 2) // CZ_INVENTORY_EXPAND_REJECTED
// Packet: 0x0b1a
-packetLen(0x0b1a, 29)
+packetLen(0x0b1a, 29) // ZC_USESKILL_ACK3
+
+// Packet: 0x0b1b
+#if PACKETVER >= 20190213
+packetLen(0x0b1b, 2)
+#endif
+
+// Packet: 0x0b1c
+#if PACKETVER >= 20190220
+packetLen(0x0b1c, 2)
+#endif
+
+// Packet: 0x0b1d
+#if PACKETVER >= 20190220
+packetLen(0x0b1d, 2)
+#endif
+
+// Packet: 0x0b1e
+#if PACKETVER >= 20190227
+packetLen(0x0b1e, 10)
+#endif
+
+// Packet: 0x0b1f
+#if PACKETVER >= 20190306
+packetLen(0x0b1f, 10)
+#endif
+
+// Packet: 0x0b21
+#if PACKETVER >= 20190306
+// removed
+#elif PACKETVER >= 20190227
+packetLen(0x0b21, 10)
+#endif
+
+// Packet: 0x0b22
+#if PACKETVER >= 20190306
+// removed
+#elif PACKETVER >= 20190227
+packetLen(0x0b22, 6)
+#endif
+
+// Packet: 0x0b23
+#if PACKETVER >= 20190306
+// removed
+#elif PACKETVER >= 20190227
+packetLen(0x0b23, 10)
+#endif
#endif /* COMMON_PACKETS2019_LEN_RE_H */
diff --git a/src/common/packets/packets2019_len_zero.h b/src/common/packets/packets2019_len_zero.h
index 08e83f59f..8ddbdcc18 100644
--- a/src/common/packets/packets2019_len_zero.h
+++ b/src/common/packets/packets2019_len_zero.h
@@ -4168,7 +4168,7 @@ packetLen(0x0acf, 68) // CA_LOGIN_OTP
packetLen(0x0ad0, 11) // CA_OTP_CODE
// Packet: 0x0ad1
-packetLen(0x0ad1, -1)
+packetLen(0x0ad1, -1) // AC_LOGIN_OTP
// Packet: 0x0ad2
packetLen(0x0ad2, 30)
@@ -4375,12 +4375,22 @@ packetLen(0x0b18, 4) // ZC_INVENTORY_EXPANSION_INFO
packetLen(0x0b19, 2) // CZ_INVENTORY_EXPAND_REJECTED
// Packet: 0x0b1a
-packetLen(0x0b1a, 29)
+packetLen(0x0b1a, 29) // ZC_USESKILL_ACK3
// Packet: 0x0b1b
#if PACKETVER >= 20190130
packetLen(0x0b1b, 2)
#endif
+// Packet: 0x0b1c
+#if PACKETVER >= 20190220
+packetLen(0x0b1c, 2)
+#endif
+
+// Packet: 0x0b1d
+#if PACKETVER >= 20190220
+packetLen(0x0b1d, 2)
+#endif
+
#endif /* COMMON_PACKETS2019_LEN_ZERO_H */
diff --git a/src/common/socket.c b/src/common/socket.c
index 95d8bf578..faf57f412 100644
--- a/src/common/socket.c
+++ b/src/common/socket.c
@@ -79,8 +79,6 @@
static struct socket_interface sockt_s;
struct socket_interface *sockt;
-static const char *SOCKET_CONF_FILENAME = "conf/common/socket.conf";
-
#ifdef SEND_SHORTLIST
// Add a fd to the shortlist so that it'll be recognized as a fd that needs
// sending done on it.
@@ -462,7 +460,7 @@ static int recv_to_fifo(int fd)
socket_data_ci += len;
}
#endif // SHOW_SERVER_STATS
- return 0;
+ return (int)len;
}
static int send_from_fifo(int fd)
@@ -648,7 +646,7 @@ static int make_listen_bind(uint32 ip, uint16 port)
if(sockt->fd_max <= fd) sockt->fd_max = fd + 1;
- create_session(fd, connect_client, null_send, null_parse);
+ create_session(fd, sockt->connect_client, null_send, null_parse);
sockt->session[fd]->client_addr = 0; // just listens
sockt->session[fd]->rdata_tick = 0; // disable timeouts on this socket
return fd;
@@ -1505,7 +1503,7 @@ static bool socket_config_read(const char *filename, bool imported)
// import should overwrite any previous configuration, so it should be called last
if (libconfig->lookup_string(&config, "import", &import) == CONFIG_TRUE) {
- if (strcmp(import, filename) == 0 || strcmp(import, SOCKET_CONF_FILENAME) == 0) {
+ if (strcmp(import, filename) == 0 || strcmp(import, sockt->SOCKET_CONF_FILENAME) == 0) {
ShowWarning("socket_config_read: Loop detected! Skipping 'import'...\n");
} else {
if (!socket_config_read(import, true))
@@ -1714,7 +1712,7 @@ static void socket_init(void)
// Get initial local ips
sockt->naddr_ = sockt->getips(sockt->addr_,16);
- socket_config_read(SOCKET_CONF_FILENAME, false);
+ socket_config_read(sockt->SOCKET_CONF_FILENAME, false);
#ifndef SOCKET_EPOLL
// Select based Event Dispatcher:
@@ -2143,6 +2141,8 @@ void socket_defaults(void)
{
sockt = &sockt_s;
+ sockt->SOCKET_CONF_FILENAME = "conf/common/socket.conf";
+
sockt->fd_max = 0;
/* */
sockt->stall_time = 60;
@@ -2177,6 +2177,7 @@ void socket_defaults(void)
/* */
sockt->flush = flush_fifo;
sockt->flush_fifos = flush_fifos;
+ sockt->connect_client = connect_client;
sockt->set_nonblocking = set_nonblocking;
sockt->set_defaultparse = set_defaultparse;
sockt->host2ip = host2ip;
diff --git a/src/common/socket.h b/src/common/socket.h
index 5e4251989..193b22645 100644
--- a/src/common/socket.h
+++ b/src/common/socket.h
@@ -178,6 +178,7 @@ struct socket_interface {
time_t stall_time;
time_t last_tick;
+ const char *SOCKET_CONF_FILENAME;
/* */
uint32 addr_[16]; // ip addresses of local host (host byte order)
int naddr_; // # of ip addresses
@@ -212,6 +213,7 @@ struct socket_interface {
/* */
void (*flush) (int fd);
void (*flush_fifos) (void);
+ int (*connect_client) (int listen_fd);
void (*set_nonblocking) (int fd, unsigned long yes);
void (*set_defaultparse) (ParseFunc defaultparse);
/* hostname/ip conversion functions */