| 1 | /* |
| 2 | * Copyright (C) 1998 Mark Baysinger ([email protected]) |
| 3 | * Copyright (C) 1998,1999,2000,2001 Ross Combs ([email protected]) |
| 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_UDP_PROTOCOL_TYPES |
| 20 | #define INCLUDED_UDP_PROTOCOL_TYPES |
| 21 | |
| 22 | namespace pvpgn |
| 23 | { |
| 24 | |
| 25 | /* |
| 26 | * This file describes the UDP chat packets. The game packets aren't |
| 27 | * in here and would probably go in another file. The first 4 bytes |
| 28 | * seem to be a little-endian 32 bit integer id for the packet type. |
| 29 | * FIXME: add more UDP packet types |
| 30 | */ |
| 31 | /******************************************************/ |
| 32 | typedef struct |
| 33 | { |
| 34 | bn_int type; |
| 35 | } PACKED_ATTR() t_udp_header; |
| 36 | /******************************************************/ |
| 37 | |
| 38 | |
| 39 | /******************************************************/ |
| 40 | typedef struct |
| 41 | { |
| 42 | t_udp_header h; |
| 43 | } PACKED_ATTR() t_udp_generic; |
| 44 | /******************************************************/ |
| 45 | |
| 46 | |
| 47 | /******************************************************/ |
| 48 | /* client echos back with UDPOK packet */ |
| 49 | /* |
| 50 | 05 00 00 00 74 65 6E 62 ....tenb |
| 51 | */ |
| 52 | #define SERVER_UDPTEST 0x00000005 |
| 53 | typedef struct |
| 54 | { |
| 55 | t_udp_header h; |
| 56 | bn_int bnettag; /* 74 65 6E 62 */ |
| 57 | } PACKED_ATTR() t_server_udptest; |
| 58 | /******************************************************/ |
| 59 | |
| 60 | |
| 61 | /******************************************************/ |
| 62 | /* |
| 63 | 07 00 00 00 49 41 19 00 ....IA.. |
| 64 | |
| 65 | 07 00 00 00 11 60 1D 00 .....`.. |
| 66 | */ |
| 67 | #define CLIENT_UDPPING 0x00000007 |
| 68 | typedef struct |
| 69 | { |
| 70 | t_udp_header h; |
| 71 | bn_int unknown1; /* time? */ |
| 72 | } PACKED_ATTR() t_client_udpping; |
| 73 | /******************************************************/ |
| 74 | |
| 75 | |
| 76 | /******************************************************/ |
| 77 | /* |
| 78 | From Brood War 1.04 |
| 79 | 08 00 00 00 75 EC A0 28 ....u..( |
| 80 | */ |
| 81 | #define CLIENT_SESSIONADDR1 0x00000008 |
| 82 | typedef struct |
| 83 | { |
| 84 | t_udp_header h; |
| 85 | bn_int sessionkey; |
| 86 | } PACKED_ATTR() t_client_sessionaddr1; |
| 87 | /******************************************************/ |
| 88 | |
| 89 | |
| 90 | /******************************************************/ |
| 91 | /* |
| 92 | From Brood War 1.07 |
| 93 | 09 00 00 00 7A 11 07 ED 9D DF 01 00 ....z....... |
| 94 | */ |
| 95 | #define CLIENT_SESSIONADDR2 0x00000009 |
| 96 | typedef struct |
| 97 | { |
| 98 | t_udp_header h; |
| 99 | bn_int sessionkey; |
| 100 | bn_int sessionnum; |
| 101 | } PACKED_ATTR() t_client_sessionaddr2; |
| 102 | /******************************************************/ |
| 103 | |
| 104 | } |
| 105 | |
| 106 | #endif |