⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 handle_bnet.c

📁 打魔兽战网的都知道他是什么
💻 C
📖 第 1 页 / 共 5 页
字号:
/* * Copyright (C) 1998  Mark Baysinger (mbaysing@ucsd.edu) * Copyright (C) 1998,1999,2000,2001  Ross Combs (rocombs@cs.nmsu.edu) * Copyright (C) 1999,2000  Rob Crittenden (rcrit@greyoak.com) * Copyright (C) 2000,2001  Marco Ziech (mmz@gmx.net) * Copyright (C) 2003 Dizzy  * * This program 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 2 * 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, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. */#define VERSIONCHECK_INTERNAL_ACCESS#include "common/setup_before.h"#include <stdio.h>#include <ctype.h>// amadeo#ifdef WIN32_GUI#include <win32/winmain.h>#endif// NonReal:#include <sys/stat.h>#ifdef HAVE_STDDEF_H# include <stddef.h>#else# ifndef NULL#  define NULL ((void *)0)# endif#endif#ifdef STDC_HEADERS		/* FIXME: remove ? */# include <stdlib.h>#endif#ifdef HAVE_STRING_H# include <string.h>#else# ifdef HAVE_STRINGS_H#  include <strings.h># endif# ifdef HAVE_MEMORY_H#  include <memory.h># endif#endif#ifdef WIN32#include "compat/socket.h"#endif#include "compat/strcasecmp.h"#include "compat/strncasecmp.h"#include "compat/strchr.h"#include "compat/strdup.h"#include "common/packet.h"#include "common/bnet_protocol.h"#include "common/tag.h"#include "message.h"#include "common/eventlog.h"#include "command.h"#include "team.h"#include "account.h"#include "account_wrap.h"#include "realm.h"#include "connection.h"#include "channel.h"#include "game.h"#include "common/queue.h"#include "tick.h"#include "file.h"#include "prefs.h"#include "common/util.h"#include "common/bnethash.h"#include "common/bnethashconv.h"#include "common/bn_type.h"#include "common/field_sizes.h"#include "ladder.h"#include "adbanner.h"#include "common/list.h"#include "common/bnettime.h"#include "common/addr.h"#include "game_conv.h"#include "autoupdate.h"#include "character.h"#include "versioncheck.h"#include "anongame.h"#include "handle_anongame.h"#include "common/proginfo.h"#include "clan.h"#include "handle_bnet.h"#include "handlers.h"#ifdef HAVE_NETINET_IN_H# include <netinet/in.h>#endif#include "compat/netinet_in.h"#include "watch.h"#include "anongame_infos.h"#include "news.h"		//by Spider#include "friends.h"#include "server.h"#include "compat/uint.h"#include "common/trans.h"#include "common/xalloc.h"#include "common/lstr.h"#include "common/setup_after.h"extern int last_news;extern int first_news;/* handlers prototypes */static int _client_unknown_1b(t_connection * c, t_packet const *const packet);static int _client_compinfo1(t_connection * c, t_packet const *const packet);static int _client_compinfo2(t_connection * c, t_packet const *const packet);static int _client_countryinfo1(t_connection * c, t_packet const *const packet);static int _client_countryinfo109(t_connection * c, t_packet const *const packet);static int _client_unknown2b(t_connection * c, t_packet const *const packet);static int _client_progident(t_connection * c, t_packet const *const packet);static int _client_createaccountw3(t_connection * c, t_packet const *const packet);static int _client_createacctreq1(t_connection * c, t_packet const *const packet);static int _client_createacctreq2(t_connection * c, t_packet const *const packet);static int _client_changepassreq(t_connection * c, t_packet const *const packet);static int _client_echoreply(t_connection * c, t_packet const *const packet);static int _client_authreq1(t_connection * c, t_packet const *const packet);static int _client_authreq109(t_connection * c, t_packet const *const packet);static int _client_regsnoopreply(t_connection * c, t_packet const *const packet);static int _client_iconreq(t_connection * c, t_packet const *const packet);static int _client_cdkey(t_connection * c, t_packet const *const packet);static int _client_cdkey2(t_connection * c, t_packet const *const packet);static int _client_cdkey3(t_connection * c, t_packet const *const packet);static int _client_udpok(t_connection * c, t_packet const *const packet);static int _client_fileinforeq(t_connection * c, t_packet const *const packet);static int _client_statsreq(t_connection * c, t_packet const *const packet);static int _client_loginreq1(t_connection * c, t_packet const *const packet);static int _client_loginreq2(t_connection * c, t_packet const *const packet);static int _client_loginreqw3(t_connection * c, t_packet const *const packet);static int _client_pingreq(t_connection * c, t_packet const *const packet);static int _client_logonproofreq(t_connection * c, t_packet const *const packet);static int _client_changegameport(t_connection * c, t_packet const *const packet);static int _client_friendslistreq(t_connection * c, t_packet const *const packet);static int _client_friendinforeq(t_connection * c, t_packet const *const packet);static int _client_atfriendscreen(t_connection * c, t_packet const *const packet);static int _client_atinvitefriend(t_connection * c, t_packet const *const packet);static int _client_atacceptinvite(t_connection * c, t_packet const *const packet);static int _client_atacceptdeclineinvite(t_connection * c, t_packet const *const packet);static int _client_motdw3(t_connection * c, t_packet const *const packet);static int _client_realmlistreq(t_connection * c, t_packet const *const packet);static int _client_realmlistreq110(t_connection * c, t_packet const *const packet);static int _client_profilereq(t_connection * c, t_packet const *const packet);static int _client_realmjoinreq109(t_connection * c, t_packet const *const packet);static int _client_unknown39(t_connection * c, t_packet const *const packet);static int _client_charlistreq(t_connection * c, t_packet const *const packet);static int _client_adreq(t_connection * c, t_packet const *const packet);static int _client_adack(t_connection * c, t_packet const *const packet);static int _client_adclick(t_connection * c, t_packet const *const packet);static int _client_adclick2(t_connection * c, t_packet const *const packet);static int _client_statsupdate(t_connection * c, t_packet const *const packet);static int _client_playerinforeq(t_connection * c, t_packet const *const packet);static int _client_progident2(t_connection * c, t_packet const *const packet);static int _client_joinchannel(t_connection * c, t_packet const *const packet);static int _client_message(t_connection * c, t_packet const *const packet);static int _client_gamelistreq(t_connection * c, t_packet const *const packet);static int _client_joingame(t_connection * c, t_packet const *const packet);static int _client_startgame1(t_connection * c, t_packet const *const packet);static int _client_startgame3(t_connection * c, t_packet const *const packet);static int _client_startgame4(t_connection * c, t_packet const *const packet);static int _client_closegame(t_connection * c, t_packet const *const packet);static int _client_gamereport(t_connection * c, t_packet const *const packet);static int _client_leavechannel(t_connection * c, t_packet const *const packet);static int _client_ladderreq(t_connection * c, t_packet const *const packet);static int _client_laddersearchreq(t_connection * c, t_packet const *const packet);static int _client_mapauthreq1(t_connection * c, t_packet const *const packet);static int _client_mapauthreq2(t_connection * c, t_packet const *const packet);static int _client_changeclient(t_connection * c, t_packet const *const packet);static int _client_w3xp_clanmemberlistreq(t_connection * c, t_packet const *const packet);static int _client_w3xp_clan_motdreq(t_connection * c, t_packet const *const packet);static int _client_w3xp_clan_motdchg(t_connection * c, t_packet const *const packet);static int _client_w3xp_clan_createreq(t_connection * c, t_packet const *const packet);static int _client_w3xp_clan_createinvitereq(t_connection * c, t_packet const *const packet);static int _client_w3xp_clan_createinvitereply(t_connection * c, t_packet const *const packet);static int _client_w3xp_clan_disbandreq(t_connection * c, t_packet const *const packet);static int _client_w3xp_clanmember_rankupdatereq(t_connection * c, t_packet const *const packet);static int _client_w3xp_clanmember_removereq(t_connection * c, t_packet const *const packet);static int _client_w3xp_clan_membernewchiefreq(t_connection * c, t_packet const *const packet);static int _client_w3xp_clan_invitereq(t_connection * c, t_packet const *const packet);static int _client_w3xp_clan_invitereply(t_connection * c, t_packet const *const packet);static int _client_crashdump(t_connection * c, t_packet const *const packet);static int _client_setemailreply(t_connection * c, t_packet const *const packet);static int _client_changeemailreq(t_connection * c, t_packet const *const packet);static int _client_getpasswordreq(t_connection * c, t_packet const *const packet);static int _client_claninforeq(t_connection * c, t_packet const *const packet);/* connection state connected handler table */static const t_htable_row bnet_htable_con[] = {    {CLIENT_UNKNOWN_1B, _client_unknown_1b},    {CLIENT_COMPINFO1, _client_compinfo1},    {CLIENT_COMPINFO2, _client_compinfo2},    {CLIENT_COUNTRYINFO1, _client_countryinfo1},    {CLIENT_COUNTRYINFO_109, _client_countryinfo109},    {CLIENT_UNKNOWN_2B, _client_unknown2b},    {CLIENT_PROGIDENT, _client_progident},    {CLIENT_CLOSEGAME, NULL},    {CLIENT_CREATEACCOUNT_W3, _client_createaccountw3},    {CLIENT_CREATEACCTREQ1, _client_createacctreq1},    {CLIENT_CREATEACCTREQ2, _client_createacctreq2},    {CLIENT_CHANGEPASSREQ, _client_changepassreq},    {CLIENT_ECHOREPLY, _client_echoreply},    {CLIENT_AUTHREQ1, _client_authreq1},    {CLIENT_AUTHREQ_109, _client_authreq109},    {CLIENT_REGSNOOPREPLY, _client_regsnoopreply},    {CLIENT_ICONREQ, _client_iconreq},    {CLIENT_CDKEY, _client_cdkey},    {CLIENT_CDKEY2, _client_cdkey2},    {CLIENT_CDKEY3, _client_cdkey3},    {CLIENT_UDPOK, _client_udpok},    {CLIENT_FILEINFOREQ, _client_fileinforeq},    {CLIENT_STATSREQ, _client_statsreq},    {CLIENT_PINGREQ, _client_pingreq},    {CLIENT_LOGINREQ1, _client_loginreq1},    {CLIENT_LOGINREQ2, _client_loginreq2},    {CLIENT_LOGINREQ_W3, _client_loginreqw3},    {CLIENT_LOGONPROOFREQ, _client_logonproofreq},    /* After this packet we know to translate the packets to the normal IDs */    {CLIENT_CHANGECLIENT, _client_changeclient},    {CLIENT_GETPASSWORDREQ, _client_getpasswordreq},    {CLIENT_CHANGEEMAILREQ, _client_changeemailreq},    {CLIENT_CRASHDUMP, _client_crashdump},    {-1, NULL}};/* connection state loggedin handlers */static const t_htable_row bnet_htable_log[] = {    {CLIENT_CHANGEGAMEPORT, _client_changegameport},    {CLIENT_FRIENDSLISTREQ, _client_friendslistreq},    {CLIENT_FRIENDINFOREQ, _client_friendinforeq},    {CLIENT_ARRANGEDTEAM_FRIENDSCREEN, _client_atfriendscreen},    {CLIENT_ARRANGEDTEAM_INVITE_FRIEND, _client_atinvitefriend},    {CLIENT_ARRANGEDTEAM_ACCEPT_INVITE, _client_atacceptinvite},    {CLIENT_ARRANGEDTEAM_ACCEPT_DECLINE_INVITE, _client_atacceptdeclineinvite},    /* anongame packet (44ff) handled in handle_anongame.c */    {CLIENT_FINDANONGAME, handle_anongame_packet},    {CLIENT_FILEINFOREQ, _client_fileinforeq},    {CLIENT_MOTD_W3, _client_motdw3},    {CLIENT_REALMLISTREQ, _client_realmlistreq},    {CLIENT_REALMLISTREQ_110, _client_realmlistreq110},    {CLIENT_PROFILEREQ, _client_profilereq},    {CLIENT_REALMJOINREQ_109, _client_realmjoinreq109},    {CLIENT_UNKNOWN_37, _client_charlistreq},    {CLIENT_UNKNOWN_39, _client_unknown39},    {CLIENT_ECHOREPLY, _client_echoreply},    {CLIENT_PINGREQ, _client_pingreq},    {CLIENT_ADREQ, _client_adreq},    {CLIENT_ADACK, _client_adack},    {CLIENT_ADCLICK, _client_adclick},    {CLIENT_ADCLICK2, _client_adclick2},    {CLIENT_STATSREQ, _client_statsreq},    {CLIENT_STATSUPDATE, _client_statsupdate},    {CLIENT_PLAYERINFOREQ, _client_playerinforeq},    {CLIENT_PROGIDENT2, _client_progident2},    {CLIENT_JOINCHANNEL, _client_joinchannel},    {CLIENT_MESSAGE, _client_message},    {CLIENT_GAMELISTREQ, _client_gamelistreq},    {CLIENT_JOIN_GAME, _client_joingame},    {CLIENT_STARTGAME1, _client_startgame1},    {CLIENT_STARTGAME3, _client_startgame3},    {CLIENT_STARTGAME4, _client_startgame4},    {CLIENT_CLOSEGAME, _client_closegame},    {CLIENT_CLOSEGAME2, _client_closegame},    {CLIENT_GAME_REPORT, _client_gamereport},    {CLIENT_LEAVECHANNEL, _client_leavechannel},    {CLIENT_LADDERREQ, _client_ladderreq},    {CLIENT_LADDERSEARCHREQ, _client_laddersearchreq},    {CLIENT_MAPAUTHREQ1, _client_mapauthreq1},    {CLIENT_MAPAUTHREQ2, _client_mapauthreq2},    {CLIENT_W3XP_CLAN_DISBANDREQ, _client_w3xp_clan_disbandreq},    {CLIENT_W3XP_CLANMEMBERLIST_REQ, _client_w3xp_clanmemberlistreq},    {CLIENT_W3XP_CLAN_MOTDCHG, _client_w3xp_clan_motdchg},    {CLIENT_W3XP_CLAN_MOTDREQ, _client_w3xp_clan_motdreq},    {CLIENT_W3XP_CLAN_CREATEREQ, _client_w3xp_clan_createreq},    {CLIENT_W3XP_CLAN_CREATEINVITEREQ, _client_w3xp_clan_createinvitereq},    {CLIENT_W3XP_CLAN_CREATEINVITEREPLY, _client_w3xp_clan_createinvitereply},    {CLIENT_W3XP_CLANMEMBER_RANKUPDATE_REQ, _client_w3xp_clanmember_rankupdatereq},    {CLIENT_W3XP_CLANMEMBER_REMOVE_REQ, _client_w3xp_clanmember_removereq},    {CLIENT_W3XP_CLAN_MEMBERNEWCHIEFREQ, _client_w3xp_clan_membernewchiefreq},    {CLIENT_W3XP_CLAN_INVITEREQ, _client_w3xp_clan_invitereq},    {CLIENT_W3XP_CLAN_INVITEREPLY, _client_w3xp_clan_invitereply},    {CLIENT_CRASHDUMP, _client_crashdump},    {CLIENT_SETEMAILREPLY, _client_setemailreply},    {CLIENT_CLANINFOREQ, _client_claninforeq},    {CLIENT_NULL, NULL},    {-1, NULL}};/* main handler function */static int handle(const t_htable_row * htable, int type, t_connection * c, t_packet const *const packet);extern int handle_bnet_packet(t_connection * c, t_packet const *const packet){    if (!c) {	eventlog(eventlog_level_error, __FUNCTION__, "[%d] got NULL connection", conn_get_socket(c));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -