6
* Desc: Functions for reading/writing messages from/to game modules, GGZ side
7
* $Id: mod-ggz.h 7426 2005-08-15 09:03:04Z josef $
9
* This file contains the backend for the ggzmod library. This
10
* library facilitates the communication between the GGZ server (ggz)
11
* and game servers. The file must be kept synchronized with the game's
12
* library part (ggzmod.h, mod.h).
14
* Copyright (C) 2001 GGZ Dev Team.
16
* This program is free software; you can redistribute it and/or modify
17
* it under the terms of the GNU General Public License as published by
18
* the Free Software Foundation; either version 2 of the License, or
19
* (at your option) any later version.
21
* This program is distributed in the hope that it will be useful,
22
* but WITHOUT ANY WARRANTY; without even the implied warranty of
23
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
* GNU General Public License for more details.
26
* You should have received a copy of the GNU General Public License
27
* along with this program; if not, write to the Free Software
28
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
32
#ifndef __GGZ_MOD_GGZ_H__
33
#define __GGZ_MOD_GGZ_H__
35
#ifdef HAVE_WINSOCK2_H
36
# include <winsock2.h>
41
#include "ggzmod-ggz.h"
43
/* The number of event handlers there are. */
44
#define GGZMOD_NUM_HANDLERS (GGZMOD_EVENT_ERROR + 1)
45
/* The number of transaction handlers there are. */
46
#define GGZMOD_NUM_TRANSACTIONS (GGZMOD_TRANSACTION_CHAT + 1)
48
/* This is the actual structure, but it's only visible internally. */
50
GGZModType type; /* ggz-end or game-end */
51
GGZModState state; /* the state of the game */
52
int fd; /* file descriptor */
53
GGZModHandler handlers[GGZMOD_NUM_HANDLERS];
54
void *gamedata; /* game-specific data */
57
const char *server_host;
58
unsigned int server_port;
59
const char *server_handle;
65
/* Seat and spectator seat data. */
70
int num_spectator_seats;
71
GGZList *spectator_seats;
72
GGZList *spectator_stats;
76
pid_t pid; /* process ID of table */
80
char *pwd; /* working directory for game */
81
char **argv; /* command-line arguments for launching module */
82
GGZModTransactionHandler thandlers[GGZMOD_NUM_TRANSACTIONS];
87
/* GGZ+game side error function */
88
void _ggzmod_ggz_error(GGZMod *ggzmod, char* error);
90
/* GGZ+game side functions for handling various messages */
91
void _ggzmod_ggz_handle_state(GGZMod * ggzmod, GGZModState state);
93
/* GGZ side functions for handling various messages */
94
void _ggzmod_ggz_handle_stand_request(GGZMod *ggzmod);
95
void _ggzmod_ggz_handle_sit_request(GGZMod *ggzmod, int seat_num);
96
void _ggzmod_ggz_handle_boot_request(GGZMod *ggzmod, char *name);
97
void _ggzmod_ggz_handle_bot_request(GGZMod *ggzmod, int seat_num);
98
void _ggzmod_ggz_handle_open_request(GGZMod *ggzmod, int seat_num);
99
void _ggzmod_ggz_handle_chat_request(GGZMod *ggzmod, char *chat_msg);
100
void _ggzmod_ggz_handle_info_request(GGZMod *ggzmod, int seat_num);
102
#endif /* __GGZ_MOD_GGZ_H__ */