~ubuntu-branches/ubuntu/edgy/ggz-client-libs/edgy

« back to all changes in this revision

Viewing changes to ggzmod-ggz/mod-ggz.h

  • Committer: Bazaar Package Importer
  • Author(s): Peter Eisentraut, Josef Spillner, Peter Eisentraut
  • Date: 2006-09-09 13:37:14 UTC
  • mfrom: (2.1.2 edgy)
  • Revision ID: james.westby@ubuntu.com-20060909133714-q49a9kvjfkc0wcc3
Tags: 0.0.13-3
[ Josef Spillner ]
* Change ggzcore-bin dependency from ggzmod to recommends from ggzcore
  (closes: #384671).

[ Peter Eisentraut ]
* Make package dependencies binNMU-safe through use of ${binary:Version}
  (closes: #386126)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* 
 
2
 * File: mod-ggz.h
 
3
 * Author: GGZ Dev Team
 
4
 * Project: ggzmod
 
5
 * Date: 11/18/01
 
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 $
 
8
 *
 
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).
 
13
 *
 
14
 * Copyright (C) 2001 GGZ Dev Team.
 
15
 *
 
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.
 
20
 *
 
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.
 
25
 *
 
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
 
29
 */
 
30
 
 
31
 
 
32
#ifndef __GGZ_MOD_GGZ_H__
 
33
#define __GGZ_MOD_GGZ_H__
 
34
 
 
35
#ifdef HAVE_WINSOCK2_H
 
36
# include <winsock2.h>
 
37
#endif
 
38
 
 
39
#include <ggz.h>
 
40
 
 
41
#include "ggzmod-ggz.h"
 
42
 
 
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)
 
47
 
 
48
/* This is the actual structure, but it's only visible internally. */
 
49
struct GGZMod {
 
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 */
 
55
 
 
56
        int server_fd;
 
57
        const char *server_host;
 
58
        unsigned int server_port;
 
59
        const char *server_handle;
 
60
 
 
61
        const char *my_name;
 
62
        int i_am_spectator;
 
63
        int my_seat_num;
 
64
 
 
65
        /* Seat and spectator seat data. */
 
66
        int num_seats;
 
67
        GGZList *seats;
 
68
        GGZList *stats;
 
69
        GGZList *infos;
 
70
        int num_spectator_seats;
 
71
        GGZList *spectator_seats;
 
72
        GGZList *spectator_stats;
 
73
 
 
74
        /* ggz-only data */
 
75
#ifdef HAVE_FORK
 
76
        pid_t pid;      /* process ID of table */
 
77
#else
 
78
        HANDLE process;
 
79
#endif
 
80
        char *pwd;      /* working directory for game */
 
81
        char **argv;    /* command-line arguments for launching module */
 
82
        GGZModTransactionHandler thandlers[GGZMOD_NUM_TRANSACTIONS];
 
83
 
 
84
        /* etc. */
 
85
};
 
86
 
 
87
/* GGZ+game side error function */
 
88
void _ggzmod_ggz_error(GGZMod *ggzmod, char* error);
 
89
 
 
90
/* GGZ+game side functions for handling various messages */
 
91
void _ggzmod_ggz_handle_state(GGZMod * ggzmod, GGZModState state);
 
92
 
 
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);
 
101
 
 
102
#endif /* __GGZ_MOD_GGZ_H__ */