1 /*
2  * file browse.h - datatype used in game browsing
3  *
4  * $Id: browse.h,v 1.5 2006/02/09 21:21:23 fzago Exp $
5  *
6  * Program XBLAST
7  * (C) by Oliver Vogel (e-mail: m.vogel@ndh.net)
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published
11  * by the Free Software Foundation; either version 2; or (at your option)
12  * any later version
13  *
14  * This program is distributed in the hope that it will be entertaining,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILTY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
17  * Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License along
20  * with this program; if not, write to the Free Software Foundation, Inc.
21  * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22  */
23 #ifndef XBLAST_BROWSE_H
24 #define XBLAST_BROWSE_H
25 
26 /*
27  * type definitions
28  */
29 typedef enum
30 {
31 	XBBT_None,					/* invalid data */
32 	XBBT_Query,					/* query for games */
33 	XBBT_Reply,					/* direct reply from game server */
34 	XBBT_NewGame,				/* XBCC inform central of new game */
35 	XBBT_NewGameOK				/* XBCC inform central of new game */
36 } XBBrowseTeleType;
37 
38 typedef struct
39 {
40 	XBBrowseTeleType type;
41 	unsigned char serial;		/* Serial of request */
42 } XBBrowseTeleAny;
43 
44 typedef struct
45 {
46 	XBBrowseTeleAny any;
47 } XBBrowseTeleQuery;
48 
49 typedef struct
50 {
51 	XBBrowseTeleAny any;
52 	unsigned short port;		/* port for game */
53 	unsigned char version[3];	/* version numbers */
54 	char game[48];				/* name of the game */
55 	char host[32];				/* XBCC host address */
56 	unsigned char numLives;		/* number of lives */
57 	unsigned char numWins;		/* number of matches to win */
58 	unsigned char frameRate;	/* frames per second */
59 } XBBrowseTeleReply;
60 
61 typedef struct
62 {
63 	XBBrowseTeleAny any;
64 	unsigned short port;		/* port for game */
65 	unsigned char version[3];	/* version numbers */
66 	char game[48];				/* name of the game */
67 	//char             host[32];   /* XBCC host address */
68 	int gameID;					/* XBCC */
69 	unsigned char numLives;		/* number of lives */
70 	unsigned char numWins;		/* number of matches to win */
71 	unsigned char frameRate;	/* frames per second */
72 } XBBrowseTeleNewGame;
73 
74 typedef struct
75 {
76 	XBBrowseTeleAny any;
77 	int gameID;					/* XBCC ID for game */
78 } XBBrowseTeleNewGameOK;
79 
80 typedef union
81 {
82 	XBBrowseTeleType type;
83 	XBBrowseTeleAny any;
84 	XBBrowseTeleQuery query;
85 	XBBrowseTeleReply reply;
86 	XBBrowseTeleNewGame newGame;
87 	XBBrowseTeleNewGameOK newGameOK;
88 } XBBrowseTele;
89 
90 /*
91  * global prototypes
92  */
93 extern XBBrowseTeleType BrowseTele_Parse (XBBrowseTele *, const unsigned char *, size_t len);
94 extern size_t BrowseTele_Write (const XBBrowseTeleAny *, unsigned char *);
95 
96 #endif
97 /*
98  * end of file browse.h
99  */
100