5 * Copyright (C) 2003, 2007, 2008, 2009 Thomas Perl <thp@thpinfo.com>
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
30 #include <SDL/SDL_net.h>
32 /* Vanity ports "STNX" and "MTNX" */
33 #define TENNIXNET_PORT_SLAVE 7869
34 #define TENNIXNET_PORT_MASTER 6869
56 unsigned char sets
[SETS_TO_WIN
*2];
62 NetworkPlayer players
[MAXPLAYERS
];
63 unsigned char serving_player
;
65 unsigned char current_set
;
67 soundevent_t sound_events
;
68 scoreevent_t score_event
;
69 unsigned char score_time
;
70 eventcounter_t ec_game
;
71 eventcounter_t ec_sets
;
72 statusmessage_t status_message
;
82 network_connect(const char* host
, bool master
);
85 network_disconnect(TennixNet
* connection
);
88 network_send_input(TennixNet
* connection
, NetworkInputData
* src
);
91 network_send_state(TennixNet
* connection
, GameState
* src
);
94 network_receive(TennixNet
* connection
);
97 network_get_input(TennixNet
* connection
, NetworkInputData
* dest
);
100 network_get_gamestate(TennixNet
* connection
, GameState
* dest
);
103 net_serialize_ball(const Ball
* src
, NetworkBall
* dest
);
106 net_unserialize_ball(const NetworkBall
* src
, Ball
* dest
);
109 net_serialize_player(const Player
* src
, NetworkPlayer
* dest
);
112 net_unserialize_player(const NetworkPlayer
* src
, Player
* dest
);
115 net_serialize_gamestate(const GameState
* src
, NetworkGameState
* dest
);
118 net_unserialize_gamestate(const NetworkGameState
* src
, GameState
* dest
);