1 /* 2 * Copyright (C) 2000,2001 Onlyer (onlyer@263.net) 3 * Copyright (C) 2001 faster (lqx@cic.tsinghua.edu.cn) 4 * 5 * This program is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU General Public License 7 * as published by the Free Software Foundation; either version 2 8 * of the License, or (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 */ 19 #ifndef INCLUDED_D2CS_D2GS_PROTOCOL_H 20 #define INCLUDED_D2CS_D2GS_PROTOCOL_H 21 /* 22 * there is only little comments in this header file 23 * check the documents for more details 24 */ 25 26 /* include your own header files here */ 27 #ifdef D2CS 28 # include "common/bn_type.h" 29 #endif 30 31 #ifdef D2GS 32 # include "bn_types.h" 33 #pragma pack(push, pack01, 1) 34 #endif 35 36 typedef struct 37 { 38 bn_short size; 39 bn_short type; 40 bn_int seqno; /* seqno, set by the sender */ 41 } t_d2cs_d2gs_header; 42 43 typedef struct 44 { 45 t_d2cs_d2gs_header h; 46 } t_d2cs_d2gs_generic; 47 48 #define D2CS_D2GS_AUTHREQ 0x10 49 typedef struct 50 { 51 t_d2cs_d2gs_header h; 52 bn_int sessionnum; 53 bn_int signlen; 54 /* realm name */ 55 /* key check sum, maybe 128 bytes */ 56 } t_d2cs_d2gs_authreq; 57 58 #define D2GS_D2CS_AUTHREPLY 0x11 59 typedef struct 60 { 61 t_d2cs_d2gs_header h; 62 bn_int version; 63 bn_int checksum; 64 bn_int randnum; 65 bn_int signlen; 66 bn_basic sign[128]; 67 } t_d2gs_d2cs_authreply; 68 69 #define D2CS_D2GS_AUTHREPLY 0x11 70 typedef struct 71 { 72 t_d2cs_d2gs_header h; 73 bn_int reply; 74 } t_d2cs_d2gs_authreply; 75 #define D2CS_D2GS_AUTHREPLY_SUCCEED 0x00 76 #define D2CS_D2GS_AUTHREPLY_BAD_VERSION 0x01 77 #define D2CS_D2GS_AUTHREPLY_BAD_CHECKSUM 0x02 78 79 #define D2GS_D2CS_SETGSINFO 0x12 80 typedef struct 81 { 82 t_d2cs_d2gs_header h; 83 bn_int maxgame; 84 bn_int gameflag; 85 } t_d2gs_d2cs_setgsinfo; 86 87 #define D2CS_D2GS_SETGSINFO 0x12 88 typedef struct 89 { 90 t_d2cs_d2gs_header h; 91 bn_int maxgame; 92 bn_int gameflag; 93 } t_d2cs_d2gs_setgsinfo; 94 95 #define D2CS_D2GS_ECHOREQ 0x13 96 typedef struct 97 { 98 t_d2cs_d2gs_header h; 99 } t_d2cs_d2gs_echoreq; 100 101 #define D2GS_D2CS_ECHOREPLY 0x13 102 typedef struct 103 { 104 t_d2cs_d2gs_header h; 105 } t_d2gs_d2cs_echoreply; 106 107 #define D2CS_D2GS_CONTROL 0x14 108 typedef struct 109 { 110 t_d2cs_d2gs_header h; 111 bn_int cmd; 112 bn_int value; 113 } t_d2cs_d2gs_control; 114 #define D2CS_D2GS_CONTROL_CMD_RESTART 0x01 115 #define D2CS_D2GS_CONTROL_CMD_SHUTDOWN 0x02 116 #define D2CS_D2GS_CONTROL_VALUE_DEFAULT 0x00 117 118 #define D2CS_D2GS_SETINITINFO 0x15 119 typedef struct 120 { 121 t_d2cs_d2gs_header h; 122 bn_int time; 123 bn_int gs_id; 124 bn_int ac_version; 125 /* ac_checksum */ 126 } t_d2cs_d2gs_setinitinfo; 127 128 #define D2CS_D2GS_SETCONFFILE 0x16 129 typedef struct 130 { 131 t_d2cs_d2gs_header h; 132 bn_int size; 133 bn_int reserved1; 134 /* conf file (null terminated string) */ 135 } t_d2cs_d2gs_setconffile; 136 137 #define D2CS_D2GS_CREATEGAMEREQ 0x20 138 typedef struct 139 { 140 t_d2cs_d2gs_header h; 141 bn_byte ladder; 142 bn_byte expansion; 143 bn_byte difficulty; 144 bn_byte hardcore; 145 /* gamename */ 146 /* gamepass */ 147 /* gamedesc */ 148 /* create by acctname */ 149 /* create by charname */ 150 /* create by ip address(string) */ 151 } t_d2cs_d2gs_creategamereq; 152 #define D2GAME_DIFFICULTY_NORMAL 0 153 #define D2GAME_DIFFICULTY_NIGHTMARE 1 154 #define D2GAME_DIFFICULTY_HELL 2 155 156 #define D2GS_D2CS_CREATEGAMEREPLY 0x20 157 typedef struct 158 { 159 t_d2cs_d2gs_header h; 160 bn_int result; 161 bn_int gameid; 162 } t_d2gs_d2cs_creategamereply; 163 #define D2GS_D2CS_CREATEGAME_SUCCEED 0 164 #define D2GS_D2CS_CREATEGAME_FAILED 1 165 166 167 #define D2CS_D2GS_JOINGAMEREQ 0x21 168 typedef struct 169 { 170 t_d2cs_d2gs_header h; 171 bn_int gameid; 172 bn_int token; 173 /* character name */ 174 /* account name */ 175 /* client ip address(string) */ 176 } t_d2cs_d2gs_joingamereq; 177 178 #define D2GS_D2CS_JOINGAMEREPLY 0x21 179 typedef struct 180 { 181 t_d2cs_d2gs_header h; 182 bn_int result; 183 bn_int gameid; 184 } t_d2gs_d2cs_joingamereply; 185 #define D2GS_D2CS_JOINGAME_SUCCEED 0 186 #define D2GS_D2CS_JOINGAME_FAILED 1 187 #define D2GS_D2CS_JOINGAME_GAME_FULL 2 188 189 #define D2GS_D2CS_UPDATEGAMEINFO 0x22 190 typedef struct 191 { 192 t_d2cs_d2gs_header h; 193 bn_int flag; 194 bn_int gameid; 195 bn_int charlevel; 196 bn_int charclass; 197 /* charname */ 198 } t_d2gs_d2cs_updategameinfo; 199 #define D2GS_D2CS_UPDATEGAMEINFO_FLAG_UPDATE 0 200 #define D2GS_D2CS_UPDATEGAMEINFO_FLAG_ENTER 1 201 #define D2GS_D2CS_UPDATEGAMEINFO_FLAG_LEAVE 2 202 203 #define D2GS_D2CS_CLOSEGAME 0x23 204 typedef struct 205 { 206 t_d2cs_d2gs_header h; 207 bn_int gameid; 208 } t_d2gs_d2cs_closegame; 209 210 #ifdef D2GS 211 #pragma pack(pop, pack01) 212 #endif 213 214 #endif 215