2
* Copyright (C) 2004 by the Widelands Development Team
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License
6
* as published by the Free Software Foundation; either version 2
7
* of the License, or (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
#ifndef __NETWORK_LAN_PROMOTION_H__
21
#define __NETWORK_LAN_PROMOTION_H__
24
#include "network_system.h"
26
#define LAN_PROMOTION_PROTOCOL_VERSION 1
28
#define LAN_GAME_CLOSED 0
29
#define LAN_GAME_OPEN 1
31
struct LAN_Game_Info {
33
unsigned char version;
41
struct LAN_Open_Game {
52
void bind (unsigned short);
56
ssize_t recv (void*, size_t, sockaddr_in*);
58
void send (const void*, size_t, const sockaddr_in*);
59
void broadcast (const void*, size_t, unsigned short);
64
std::list<in_addr_t> broadcast_addresses;
67
class LAN_Game_Promoter:LAN_Base {
70
~LAN_Game_Promoter ();
74
void set_map (const char*);
77
LAN_Game_Info gameinfo;
81
class LAN_Game_Finder:LAN_Base {
94
void set_callback (void(*)(int, const LAN_Open_Game*, void*), void*);
97
std::list<LAN_Open_Game*> opengames;
99
void (*callback) (int, const LAN_Open_Game*, void*);