1 /* 2 * Copyright (C) 2000,2001 Onlyer (onlyer@263.net) 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 2 7 * of the License, or (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 */ 18 #ifndef INCLUDED_D2CS_BNETD_PROTOCOL_H 19 #define INCLUDED_D2CS_BNETD_PROTOCOL_H 20 21 #include "common/bn_type.h" 22 23 typedef struct 24 { 25 bn_short size; 26 bn_short type; 27 bn_int seqno; /* seqno, set by the sender */ 28 } t_d2cs_bnetd_header; 29 30 typedef struct 31 { 32 t_d2cs_bnetd_header h; 33 } t_d2cs_bnetd_generic; 34 35 #define BNETD_D2CS_AUTHREQ 0x01 36 typedef struct 37 { 38 t_d2cs_bnetd_header h; 39 bn_int sessionnum; 40 } t_bnetd_d2cs_authreq; 41 42 #define D2CS_BNETD_AUTHREPLY 0x02 43 typedef struct 44 { 45 t_d2cs_bnetd_header h; 46 bn_int version; 47 /* realm name */ 48 } t_d2cs_bnetd_authreply; 49 50 #define BNETD_D2CS_AUTHREPLY 0x02 51 typedef struct 52 { 53 t_d2cs_bnetd_header h; 54 bn_int reply; 55 } t_bnetd_d2cs_authreply; 56 #define BNETD_D2CS_AUTHREPLY_SUCCEED 0x00 57 #define BNETD_D2CS_AUTHREPLY_BAD_VERSION 0x01 58 59 #define D2CS_BNETD_ACCOUNTLOGINREQ 0x10 60 typedef struct 61 { 62 t_d2cs_bnetd_header h; 63 bn_int seqno; 64 bn_int sessionnum; 65 bn_int sessionkey; 66 bn_int secret_hash[5]; 67 /* account name */ 68 } t_d2cs_bnetd_accountloginreq; 69 70 #define BNETD_D2CS_ACCOUNTLOGINREPLY 0x10 71 typedef struct 72 { 73 t_d2cs_bnetd_header h; 74 bn_int reply; 75 } t_bnetd_d2cs_accountloginreply; 76 #define BNETD_D2CS_ACCOUNTLOGINREPLY_SUCCEED 0x00 77 #define BNETD_D2CS_ACCOUNTLOGINREPLY_FAILED 0x01 78 79 #define D2CS_BNETD_CHARLOGINREQ 0x11 80 typedef struct 81 { 82 t_d2cs_bnetd_header h; 83 bn_int sessionnum; 84 /* character name */ 85 /* character portrait */ 86 } t_d2cs_bnetd_charloginreq; 87 88 #define BNETD_D2CS_CHARLOGINREPLY 0x11 89 typedef struct 90 { 91 t_d2cs_bnetd_header h; 92 bn_int reply; 93 } t_bnetd_d2cs_charloginreply; 94 #define BNETD_D2CS_CHARLOGINREPLY_SUCCEED 0x00 95 #define BNETD_D2CS_CHARLOGINREPLY_FAILED 0x01 96 97 #define BNETD_D2CS_GAMEINFOREQ 0x12 98 typedef struct 99 { 100 t_d2cs_bnetd_header h; 101 /* gamename */ 102 } t_bnetd_d2cs_gameinforeq; 103 104 #define D2CS_BNETD_GAMEINFOREPLY 0x12 105 typedef struct 106 { 107 t_d2cs_bnetd_header h; 108 bn_byte difficulty; 109 /* gamename */ 110 } t_d2cs_bnetd_gameinforeply; 111 112 #endif 113