Freeciv-3.2
Loading...
Searching...
No Matches
servers.h
Go to the documentation of this file.
1/**********************************************************************
2 Freeciv - Copyright (C) 1996-2005 - Freeciv Development Team
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13
14#ifndef FC__SERVERS_H
15#define FC__SERVERS_H
16
17#ifdef __cplusplus
18extern "C" {
19#endif /* __cplusplus */
20
21/* utility */
22#include "fcthread.h"
23
24#define SERVER_LAN_PORT 4555
25#define SERVER_LAN_TTL 1
26#define SERVER_LAN_VERSION 2
27
28struct server
29{
30 char *host;
31 int port;
33 char *patches;
34 char *version;
35 char *state;
36 char *topic;
37 char *message;
38
39 struct players
40 {
41 char *name;
42 char *type;
43 char *host;
44 char *nation;
45 } *players;
46
48 int humans;
49};
50
51#define SPECLIST_TAG server
52#define SPECLIST_TYPE struct server
53#include "speclist.h"
54
55#define server_list_iterate(serverlist, pserver) \
56 TYPED_LIST_ITERATE(struct server, serverlist, pserver)
57#define server_list_iterate_end LIST_ITERATE_END
58
59struct server_scan;
60
66
68 SERVER_SCAN_LOCAL, /* Local servers, detected through a LAN scan */
69 SERVER_SCAN_GLOBAL, /* Global servers, read from the metaserver */
71};
72
73typedef void (*ServerScanErrorFunc)(struct server_scan *scan,
74 const char *message);
75
87struct srv_list *
89void server_scan_finish(struct server_scan *scan);
90
91#ifdef __cplusplus
92}
93#endif /* __cplusplus */
94
95#endif /* FC__SERVERS_H */
char * incite_cost
Definition comments.c:75
GType type
Definition repodlgs.c:1313
static struct server_list * server_list
Definition connectdlg.c:61
struct srv_list * server_scan_get_list(struct server_scan *scan)
Definition servers.c:866
void server_scan_finish(struct server_scan *scan)
Definition servers.c:879
struct server_scan * server_scan_begin(enum server_scan_type type, ServerScanErrorFunc error_func)
Definition servers.c:755
server_scan_status
Definition servers.h:79
@ SCAN_STATUS_WAITING
Definition servers.h:81
@ SCAN_STATUS_ABORT
Definition servers.h:84
@ SCAN_STATUS_PARTIAL
Definition servers.h:82
@ SCAN_STATUS_ERROR
Definition servers.h:80
@ SCAN_STATUS_DONE
Definition servers.h:83
server_scan_type
Definition servers.h:67
@ SERVER_SCAN_LOCAL
Definition servers.h:68
@ SERVER_SCAN_LAST
Definition servers.h:70
@ SERVER_SCAN_GLOBAL
Definition servers.h:69
enum server_scan_type server_scan_get_type(const struct server_scan *scan)
Definition servers.c:809
void(* ServerScanErrorFunc)(struct server_scan *scan, const char *message)
Definition servers.h:73
enum server_scan_status server_scan_poll(struct server_scan *scan)
Definition servers.c:832
char * host
Definition servers.h:43
char * name
Definition servers.h:41
char * nation
Definition servers.h:44
char * type
Definition servers.h:42
ServerScanErrorFunc error_func
Definition servers.c:86
char * capability
Definition servers.h:32
char * patches
Definition servers.h:33
int humans
Definition servers.h:48
char * host
Definition servers.h:30
char * version
Definition servers.h:34
char * message
Definition servers.h:37
char * state
Definition servers.h:35
int port
Definition servers.h:31
char * topic
Definition servers.h:36
int nplayers
Definition servers.h:47
fc_mutex mutex
Definition servers.h:64
struct server_list * servers
Definition servers.h:63