project_files/frontlib/net/netconn.h
author Medo <smaxein@googlemail.com>
Thu, 19 Jul 2012 17:56:38 +0200
changeset 7338 1ed603a54ebd
parent 7324 fb6bfe8e30c8
child 7482 d70a5b0d1190
permissions -rw-r--r--
frontlib: - Removed automatic roomlist handling, since the server doesn't inform of every change after all - Added flib_netconn_get_playername - Added a callback mechanism for logging
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7314
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
     1
/*
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
     2
 * Hedgewars, a free turn based strategy game
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
     3
 * Copyright (C) 2012 Simeon Maxein <smaxein@googlemail.com>
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
     4
 *
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
     5
 * This program is free software; you can redistribute it and/or
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
     6
 * modify it under the terms of the GNU General Public License
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
     7
 * as published by the Free Software Foundation; either version 2
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
     8
 * of the License, or (at your option) any later version.
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
     9
 *
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    13
 * GNU General Public License for more details.
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    14
 *
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    15
 * You should have received a copy of the GNU General Public License
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    16
 * along with this program; if not, write to the Free Software
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    18
 */
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    19
7234
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    20
#ifndef NETCONN_H_
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    21
#define NETCONN_H_
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    22
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    23
#include "../model/gamesetup.h"
7320
e704706008d4 frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    24
#include "../model/scheme.h"
7338
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7324
diff changeset
    25
#include "../model/room.h"
7234
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    26
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    27
#include <stddef.h>
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    28
#include <stdint.h>
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    29
#include <stdbool.h>
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    30
7269
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    31
#define NETCONN_STATE_CONNECTING 0
7234
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    32
#define NETCONN_STATE_LOBBY 1
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    33
#define NETCONN_STATE_ROOM 2
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    34
#define NETCONN_STATE_INGAME 3
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    35
#define NETCONN_STATE_DISCONNECTED 10
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    36
7269
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    37
#define NETCONN_DISCONNECT_NORMAL 0
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    38
#define NETCONN_DISCONNECT_SERVER_TOO_OLD 1
7316
f7b49b2c5d84 frontlib: Improved and unified parameter checking, moved the cmdlineClient out
Medo <smaxein@googlemail.com>
parents: 7314
diff changeset
    39
#define NETCONN_DISCONNECT_AUTH_FAILED 2 // TODO can you retry instead?
7324
fb6bfe8e30c8 frontlib: Added missing disconnect case
Medo <smaxein@googlemail.com>
parents: 7320
diff changeset
    40
#define NETCONN_DISCONNECT_CONNLOST 3
7269
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    41
#define NETCONN_DISCONNECT_INTERNAL_ERROR 100
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    42
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    43
#define NETCONN_ROOMLEAVE_ABANDONED 0
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    44
#define NETCONN_ROOMLEAVE_KICKED 1
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    45
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    46
#define NETCONN_MSG_TYPE_PLAYERINFO 0
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    47
#define NETCONN_MSG_TYPE_SERVERMESSAGE 1
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    48
#define NETCONN_MSG_TYPE_WARNING 2
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    49
#define NETCONN_MSG_TYPE_ERROR 3
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    50
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    51
#define NETCONN_MAPCHANGE_FULL 0
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    52
#define NETCONN_MAPCHANGE_MAP 1
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    53
#define NETCONN_MAPCHANGE_MAPGEN 2
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    54
#define NETCONN_MAPCHANGE_DRAWNMAP 3
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    55
#define NETCONN_MAPCHANGE_MAZE_SIZE 4
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    56
#define NETCONN_MAPCHANGE_TEMPLATE 5
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    57
#define NETCONN_MAPCHANGE_THEME 6
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    58
#define NETCONN_MAPCHANGE_SEED 7
7234
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    59
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    60
// TODO: Order of functions, and match the order in netconn.c
7234
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    61
typedef struct _flib_netconn flib_netconn;
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    62
7275
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
    63
/**
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
    64
 * Create a new netplay connection with these parameters.
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
    65
 * The path to the data directory must end with a path delimiter (e.g. C:\Games\Hedgewars\Data\)
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
    66
 */
7320
e704706008d4 frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
    67
flib_netconn *flib_netconn_create(const char *playerName, flib_metascheme *metacfg, const char *dataDirPath, const char *host, int port);
7234
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    68
void flib_netconn_destroy(flib_netconn *conn);
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    69
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    70
/**
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    71
 * Perform I/O operations and call callbacks if something interesting happens.
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    72
 * Should be called regularly.
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    73
 */
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    74
void flib_netconn_tick(flib_netconn *conn);
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    75
7269
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    76
/**
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    77
 * Are you currently the owner of this room? The return value only makes sense in
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    78
 * NETCONN_STATE_ROOM and NETCONN_STATE_INGAME states.
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    79
 */
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    80
bool flib_netconn_is_chief(flib_netconn *conn);
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    81
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    82
/**
7275
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
    83
 * Are you in the context of a room, i.e. either in room or ingame state?
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
    84
 */
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
    85
bool flib_netconn_is_in_room_context(flib_netconn *conn);
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
    86
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
    87
/**
7338
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7324
diff changeset
    88
 * Returns the playername. This is *probably* the one provided on creation, but
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7324
diff changeset
    89
 * if that name was already taken, a different one could have been set by the
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7324
diff changeset
    90
 * onNickTaken callback or its default implementation.
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7324
diff changeset
    91
 */
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7324
diff changeset
    92
const char *flib_netconn_get_playername(flib_netconn *conn);
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7324
diff changeset
    93
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7324
diff changeset
    94
/**
7275
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
    95
 * Generate a game setup from the current room state.
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
    96
 * Returns NULL if the room state does not contain enough information
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
    97
 * for a complete game setup, or if an error occurs.
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
    98
 *
7314
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
    99
 * The new gamesetup must be destroyed with flib_gamesetup_destroy().
7275
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
   100
 */
7314
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
   101
flib_gamesetup *flib_netconn_create_gamesetup(flib_netconn *conn);
7275
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
   102
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
   103
/**
7269
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   104
 * quitmsg may be null
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   105
 */
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   106
int flib_netconn_send_quit(flib_netconn *conn, const char *quitmsg);
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   107
int flib_netconn_send_chat(flib_netconn *conn, const char *chat);
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   108
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   109
/**
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   110
 * Send a teamchat message, forwarded from the engine. Only makes sense ingame.
7314
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
   111
 * The server does not send a reply. In contrast to a Chat message, the server
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
   112
 * automatically converts this into an engine message and passes it on to the other
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
   113
 * clients.
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   114
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   115
int flib_netconn_send_teamchat(flib_netconn *conn, const char *msg);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   116
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   117
/**
7314
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
   118
 * Send the password in reply to a password request.
7269
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   119
 */
7314
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
   120
int flib_netconn_send_password(flib_netconn *conn, const char *passwd);
7269
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   121
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   122
/**
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   123
 * Request a different nickname.
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   124
 * This function only makes sense in reaction to an onNickTaken callback, because the netconn automatically
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   125
 * requests the nickname you provide on creation, and once the server accepts the nickname it can no longer
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   126
 * be changed.
7269
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   127
 */
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   128
int flib_netconn_send_nick(flib_netconn *conn, const char *nick);
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   129
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   130
/**
7338
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7324
diff changeset
   131
 * Request an update of the room list. Only makes sense when in lobby state.
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7324
diff changeset
   132
 * If the action succeeds, you will receive an onRoomlist callback containing the current room data.
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7324
diff changeset
   133
 */
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7324
diff changeset
   134
int flib_netconn_send_request_roomlist(flib_netconn *conn);
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7324
diff changeset
   135
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7324
diff changeset
   136
/**
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   137
 * Join a room as guest (not chief). Only makes sense when in lobby state. If the action succeeds, you will
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   138
 * receive an onEnterRoom callback with chief=false.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   139
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   140
int flib_netconn_send_joinRoom(flib_netconn *conn, const char *room);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   141
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   142
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   143
 * Create and join a new room. Only makes sense when in lobby state. If the action succeeds, you will
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   144
 * receive an onEnterRoom callback with chief=true.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   145
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   146
int flib_netconn_send_createRoom(flib_netconn *conn, const char *room);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   147
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   148
/**
7314
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
   149
 * Rename the current room. Only makes sense in room state and if you are chief. If the action succeeds, you will
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
   150
 * receive an onRoomUpdate callback containing the change.
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   151
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   152
int flib_netconn_send_renameRoom(flib_netconn *conn, const char *roomName);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   153
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   154
/**
7314
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
   155
 * Leave the room for the lobby. Only makes sense in room state. msg can be NULL if you don't want to
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
   156
 * send a message. The server always accepts a part message, so once you send it off, you can just
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
   157
 * assume that you are back in the lobby.
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   158
 */
7314
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
   159
int flib_netconn_send_leaveRoom(flib_netconn *conn, const char *msg);
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   160
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   161
/**
7314
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
   162
 * Change your "ready" status in the room. Only makes sense when in room state. If the action succeeds, you will
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
   163
 * receive an onReadyState callback containing the change.
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   164
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   165
int flib_netconn_send_toggleReady(flib_netconn *conn);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   166
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   167
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   168
 * Add a team to the current room. The message includes the team color, but not
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   169
 * the number of hogs. Only makes sense when in room state. If the action succeeds, you will
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   170
 * receive an onTeamAccepted callback with the name of the team.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   171
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   172
int flib_netconn_send_addTeam(flib_netconn *conn, const flib_team *team);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   173
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   174
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   175
 * Remove the team with the name teamname. Only makes sense when in room state.
7314
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
   176
 * The server does not send a reply on success.
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   177
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   178
int flib_netconn_send_removeTeam(flib_netconn *conn, const char *teamname);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   179
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   180
/**
7314
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
   181
 * Send an engine message. Only makes sense when ingame. In a networked game, you have to
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
   182
 * pass all the engine messages from the engine here, and they will be spread to all other
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
   183
 * clients in the game to keep the game in sync.
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   184
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   185
int flib_netconn_send_engineMessage(flib_netconn *conn, const uint8_t *message, size_t size);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   186
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   187
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   188
 * Set the number of hogs for a team. Only makes sense in room state and if you are chief.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   189
 * The server does not send a reply.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   190
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   191
int flib_netconn_send_teamHogCount(flib_netconn *conn, const char *teamname, int hogcount);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   192
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   193
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   194
 * Set the teamcolor of a team. Only makes sense in room state and if you are chief.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   195
 * The server does not send a reply.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   196
 */
7275
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
   197
int flib_netconn_send_teamColor(flib_netconn *conn, const char *teamname, int colorIndex);
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   198
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   199
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   200
 * Set the weaponset for the room. Only makes sense in room state and if you are chief.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   201
 * The server does not send a reply.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   202
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   203
int flib_netconn_send_weaponset(flib_netconn *conn, const flib_weaponset *weaponset);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   204
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   205
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   206
 * Set the map for the room. Only makes sense in room state and if you are chief.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   207
 * The server does not send a reply.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   208
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   209
int flib_netconn_send_map(flib_netconn *conn, const flib_map *map);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   210
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   211
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   212
 * Set the mapname. Only makes sense in room state and if you are chief.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   213
 * The server does not send a reply.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   214
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   215
int flib_netconn_send_mapName(flib_netconn *conn, const char *mapName);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   216
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   217
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   218
 * Set the map generator. Only makes sense in room state and if you are chief.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   219
 * The server does not send a reply.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   220
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   221
int flib_netconn_send_mapGen(flib_netconn *conn, int mapGen);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   222
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   223
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   224
 * Set the map template for regular maps. Only makes sense in room state and if you are chief.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   225
 * The server does not send a reply.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   226
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   227
int flib_netconn_send_mapTemplate(flib_netconn *conn, int templateFilter);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   228
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   229
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   230
 * Set the maze template (maze size) for mazes. Only makes sense in room state and if you are chief.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   231
 * The server does not send a reply.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   232
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   233
int flib_netconn_send_mapMazeSize(flib_netconn *conn, int mazeSize);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   234
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   235
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   236
 * Set the seed for the map. Only makes sense in room state and if you are chief.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   237
 * The server does not send a reply.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   238
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   239
int flib_netconn_send_mapSeed(flib_netconn *conn, const char *seed);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   240
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   241
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   242
 * Set the theme for the map. Only makes sense in room state and if you are chief.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   243
 * The server does not send a reply.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   244
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   245
int flib_netconn_send_mapTheme(flib_netconn *conn, const char *theme);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   246
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   247
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   248
 * Set the draw data for the drawn map. Only makes sense in room state and if you are chief.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   249
 * The server does not send a reply.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   250
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   251
int flib_netconn_send_mapDrawdata(flib_netconn *conn, const uint8_t *drawData, size_t size);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   252
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   253
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   254
 * Set the script (game style). Only makes sense in room state and if you are chief.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   255
 * The server does not send a reply.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   256
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   257
int flib_netconn_send_script(flib_netconn *conn, const char *scriptName);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   258
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   259
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   260
 * Set the scheme. Only makes sense in room state and if you are chief.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   261
 * The server does not send a reply.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   262
 */
7320
e704706008d4 frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
   263
int flib_netconn_send_scheme(flib_netconn *conn, const flib_scheme *scheme);
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   264
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   265
/**
7314
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
   266
 * Inform the server that the round has ended. Call this when the engine
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
   267
 * has disconnected, passing 1 if the round ended normally, 0 otherwise.
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   268
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   269
int flib_netconn_send_roundfinished(flib_netconn *conn, bool withoutError);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   270
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   271
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   272
 * Ban a player. TODO: Figure out details
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   273
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   274
int flib_netconn_send_ban(flib_netconn *conn, const char *playerName);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   275
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   276
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   277
 * Kick a player. TODO: Figure out details
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   278
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   279
int flib_netconn_send_kick(flib_netconn *conn, const char *playerName);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   280
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   281
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   282
 * Request information about a player. If the action succeeds, you will
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   283
 * receive an onMessage callback with NETCONN_MSG_TYPE_PLAYERINFO containing
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   284
 * the requested information.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   285
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   286
int flib_netconn_send_playerInfo(flib_netconn *conn, const char *playerName);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   287
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   288
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   289
 * Follow a player. TODO figure out details
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   290
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   291
int flib_netconn_send_playerFollow(flib_netconn *conn, const char *playerName);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   292
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   293
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   294
 * Signal that you want to start the game. Only makes sense in room state and if you are chief.
7314
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
   295
 * TODO details
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   296
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   297
int flib_netconn_send_startGame(flib_netconn *conn);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   298
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   299
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   300
 * Allow/forbid players to join the room. Only makes sense in room state and if you are chief.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   301
 * The server does not send a reply.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   302
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   303
int flib_netconn_send_toggleRestrictJoins(flib_netconn *conn);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   304
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   305
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   306
 * Allow/forbid adding teams to the room. Only makes sense in room state and if you are chief.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   307
 * The server does not send a reply.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   308
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   309
int flib_netconn_send_toggleRestrictTeams(flib_netconn *conn);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   310
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   311
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   312
 * Probably does something administrator-y.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   313
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   314
int flib_netconn_send_clearAccountsCache(flib_netconn *conn);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   315
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   316
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   317
 * Sets a server variable to the indicated value. Only makes sense if you are server admin.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   318
 * Known variables are MOTD_NEW, MOTD_OLD and LATEST_PROTO.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   319
 * TODO reply?
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   320
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   321
int flib_netconn_send_setServerVar(flib_netconn *conn, const char *name, const char *value);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   322
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   323
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   324
 * Queries all server variables. Only makes sense if you are server admin. (TODO: try)
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   325
 * If the action succeeds, you will receive several onServerVar callbacks with the
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   326
 * current values of all server variables.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   327
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   328
int flib_netconn_send_getServerVars(flib_netconn *conn);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   329
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   330
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   331
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   332
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   333
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   334
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   335
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   336
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   337
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   338
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   339
/**
7269
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   340
 * Callback for several informational messages that should be displayed to the user
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   341
 * (e.g. in the chat window), but do not require a reaction. If a game is running, you might
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   342
 * want to redirect some of these messages to the engine as well so the user will see them.
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   343
 */
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   344
void flib_netconn_onMessage(flib_netconn *conn, void (*callback)(void *context, int msgtype, const char *msg), void* context);
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   345
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   346
/**
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   347
 * We received a chat message. Where this message belongs depends on the current state (lobby/room/game). In particular,
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   348
 * if a game is running the message should be passed to the engine.
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   349
 */
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   350
void flib_netconn_onChat(flib_netconn *conn, void (*callback)(void *context, const char *nick, const char *msg), void* context);
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   351
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   352
/**
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   353
 * This is called when we receive a CONNECTED message from the server, which should be the first
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   354
 * message arriving from the server.
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   355
 */
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   356
void flib_netconn_onConnected(flib_netconn *conn, void (*callback)(void *context), void* context);
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   357
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   358
/**
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   359
 * This is *always* the last callback (unless the netconn is destroyed early), and the netconn should be destroyed when it is received.
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   360
 * The reason is one of the NETCONN_DISCONNECT_ constants. Sometime a message is included as well, but that parameter might
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   361
 * also be NULL.
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   362
 */
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   363
void flib_netconn_onDisconnected(flib_netconn *conn, void (*callback)(void *context, int reason, const char *message), void* context);
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   364
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   365
/**
7338
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7324
diff changeset
   366
 * Callbacks for room list updates. The roomlist can be queried with flib_netconn_send_request_roomlist(), which will
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7324
diff changeset
   367
 * trigger flib_netconn_onRoomlist once the server replies. Additionally, the roomAdd/delete/update callbacks will fire
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7324
diff changeset
   368
 * whenever the server informs about these events, which can happen *before* the roomlist is first received - so be sure
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7324
diff changeset
   369
 * not to blindly reference your room list in these callbacks. The server currently only sends updates when a room changes
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7324
diff changeset
   370
 * its name, so in order to update other room information you need to query the roomlist again.
7269
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   371
 */
7338
1ed603a54ebd frontlib:
Medo <smaxein@googlemail.com>
parents: 7324
diff changeset
   372
void flib_netconn_onRoomlist(flib_netconn *conn, void (*callback)(void *context, const flib_room **rooms, int roomCount), void* context);
7275
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
   373
void flib_netconn_onRoomAdd(flib_netconn *conn, void (*callback)(void *context, const flib_room *room), void* context);
7269
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   374
void flib_netconn_onRoomDelete(flib_netconn *conn, void (*callback)(void *context, const char *name), void* context);
7275
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
   375
void flib_netconn_onRoomUpdate(flib_netconn *conn, void (*callback)(void *context, const char *oldName, const flib_room *room), void* context);
7269
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   376
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   377
/**
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   378
 * Callbacks for players joining or leaving the lobby. If join is true it's a join, otherwise a leave.
7269
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   379
 * NOTE: partMessage is null if no parting message was given.
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   380
 */
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   381
void flib_netconn_onLobbyJoin(flib_netconn *conn, void (*callback)(void *context, const char *nick), void* context);
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   382
void flib_netconn_onLobbyLeave(flib_netconn *conn, void (*callback)(void *context, const char *nick, const char *partMessage), void* context);
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   383
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   384
/**
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   385
 * onNickTaken is called on connecting to the server, if it turns out that there is already a player with the same nick.
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   386
 * In order to proceed, a new nickname needs to be sent to the server using flib_netconn_send_nick() (or of course you can
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   387
 * bail out and send a QUIT). If you don't set a callback, the netconn will automatically react by generating a new name.
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   388
 * Once the server accepts a name, you will be informed with an onNickAccept callback.
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   389
 */
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   390
void flib_netconn_onNickTaken(flib_netconn *conn, void (*callback)(void *context, const char *nick), void* context);
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   391
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   392
/**
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   393
 * When connecting with a registered nickname, the server will ask for a password before admitting you in.
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   394
 * This callback is called when that happens. As a reaction, you can send the password using
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   395
 * flib_netconn_send_password or choose a different nick. If you don't register a callback,
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   396
 * the default behavior is to just quit in a way that will cause a disconnect with NETCONN_DISCONNECT_AUTH_FAILED.
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   397
 */
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   398
void flib_netconn_onPasswordRequest(flib_netconn *conn, void (*callback)(void *context, const char *nick), void* context);
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   399
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   400
/**
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   401
 * You just left the lobby and entered a room.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   402
 * If chief is true, you can and should send a full configuration for the room now.
7314
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
   403
 * This consists of ammo, scheme, script and map, where map apparently has to come last.
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   404
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   405
void flib_netconn_onEnterRoom(flib_netconn *conn, void (*callback)(void *context, bool chief), void *context);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   406
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   407
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   408
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   409
 * The following callbacks are only relevant in room state.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   410
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   411
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   412
/**
7269
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   413
 * This callback informs about changes to your room chief status, i.e. whether you are allowed to
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   414
 * modify the current room. Generally when you create a room you start out being room chief, and
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   415
 * when you join an existing room you are not. However, in some situations room ownership can change,
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   416
 * and if that happens this callback is called with the new status.
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   417
 *
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   418
 * Note: This callback does not automatically fire when joining a room. You can always query the
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   419
 * current chief status using flib_netconn_is_chief().
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   420
 */
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   421
void flib_netconn_onRoomChiefStatus(flib_netconn *conn, void (*callback)(void *context, bool chief), void* context);
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   422
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   423
/**
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   424
 * One of the players in the room (possibly you!) changed their ready state.
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   425
 */
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   426
void flib_netconn_onReadyState(flib_netconn *conn, void (*callback)(void *context, const char *nick, bool ready), void* context);
7269
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   427
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   428
/**
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   429
 * You just left a room and entered the lobby again.
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   430
 * reason is one of the NETCONN_ROOMLEAVE_ constants.
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   431
 * This will not be called when you actively leave a room using PART.
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   432
 */
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   433
void flib_netconn_onLeaveRoom(flib_netconn *conn, void (*callback)(void *context, int reason, const char *message), void *context);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   434
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   435
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   436
 * A new team was added to the room. The person who adds a team does NOT receive this callback (he gets onTeamAccepted instead).
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   437
 * The team does not contain bindings, stats, weaponset, color or the number of hogs.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   438
 */
7320
e704706008d4 frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
   439
void flib_netconn_onTeamAdd(flib_netconn *conn, void (*callback)(void *context, const flib_team *team), void *context);
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   440
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   441
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   442
 * A team was removed from the room.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   443
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   444
void flib_netconn_onTeamDelete(flib_netconn *conn, void (*callback)(void *context, const char *teamname), void *context);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   445
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   446
void flib_netconn_onRoomJoin(flib_netconn *conn, void (*callback)(void *context, const char *nick), void* context);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   447
void flib_netconn_onRoomLeave(flib_netconn *conn, void (*callback)(void *context, const char *nick, const char *partMessage), void* context);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   448
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   449
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   450
 * The game is starting. Fire up the engine and join in!
7314
6171f0bad318 frontlib: Fixes and improvements. Added a GPLv2+ license header to all frontlib
Medo <smaxein@googlemail.com>
parents: 7275
diff changeset
   451
 * You can let the netconn generate the right game setup using flib_netconn_create_gamesetup
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   452
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   453
void flib_netconn_onRunGame(flib_netconn *conn, void (*callback)(void *context), void *context);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   454
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   455
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   456
 * When you ask for a team to be added, the server might reject it for several reasons, e.g. because it has the same name
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   457
 * as an existing team, or because the room chief restricted adding new teams. If the team is accepted by the server,
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   458
 * this callback is fired.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   459
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   460
void flib_netconn_onTeamAccepted(flib_netconn *conn, void (*callback)(void *context, const char *teamName), void *context);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   461
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   462
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   463
 * The number of hogs in a team has been changed by the room chief. If you are the chief and change the number of hogs yourself,
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   464
 * you will not receive this callback!
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   465
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   466
void flib_netconn_onHogCountChanged(flib_netconn *conn, void (*callback)(void *context, const char *teamName, int hogs), void *context);
7269
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   467
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   468
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   469
 * The color of a team has been changed by the room chief. If you are the chief and change the color yourself,
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   470
 * you will not receive this callback!
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   471
 */
7275
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
   472
void flib_netconn_onTeamColorChanged(flib_netconn *conn, void (*callback)(void *context, const char *teamName, int colorIndex), void *context);
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   473
7275
15f722e0b96f frontlib: Getting there :) Added commandline client for testing
Medo <smaxein@googlemail.com>
parents: 7271
diff changeset
   474
void flib_netconn_onEngineMessage(flib_netconn *conn, void (*callback)(void *context, const uint8_t *message, size_t size), void *context);
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   475
7320
e704706008d4 frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
   476
void flib_netconn_onCfgScheme(flib_netconn *conn, void (*callback)(void *context, const flib_scheme *scheme), void *context);
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   477
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   478
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   479
 * This is called when the map configuration in a room is changed (or first received). Only non-chiefs receive these messages.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   480
 * To reduce the number of callback functions, the netconn keeps track of the current map settings and always passes the entire
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   481
 * current map config, but informs the callee about what has changed (see the NETCONN_MAPCHANGE_ constants).
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   482
 * The map parameter passed to the callback is an internally held map config. If you want to keep it around, best make a copy
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   483
 * or it may or may not change while you are not looking.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   484
 *
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   485
 * Caution: Due to the way the protocol works, the map might not be complete at this point if it is a hand-drawn map, because
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   486
 * the "full" map config does not include the drawn map data.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   487
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   488
void flib_netconn_onMapChanged(flib_netconn *conn, void (*callback)(void *context, const flib_map *map, int changetype), void *context);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   489
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   490
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   491
 * The "game style" script has been changed by the room chief. If you are the chief and change the script yourself,
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   492
 * you will not receive this callback!
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   493
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   494
void flib_netconn_onScriptChanged(flib_netconn *conn, void (*callback)(void *context, const char *script), void *context);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   495
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   496
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   497
 * The weaponset has been changed by the room chief. If you are the chief and change the weaponset yourself,
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   498
 * you will not receive this callback!
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   499
 */
7320
e704706008d4 frontlib: Renamed cfg to scheme, Un-refcounted some types, small API adjustments
Medo <smaxein@googlemail.com>
parents: 7316
diff changeset
   500
void flib_netconn_onWeaponsetChanged(flib_netconn *conn, void (*callback)(void *context, const flib_weaponset *weaponset), void *context);
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   501
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   502
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   503
 * This callback is called if the server informs us that we have admin rights.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   504
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   505
void flib_netconn_onAdminAccess(flib_netconn *conn, void (*callback)(void *context), void *context);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   506
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   507
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   508
 * When you query the server vars with GET_SERVER_VAR (TODO probably only works as admin), the server
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   509
 * replies with a list of them. This callback is called for each entry in that list.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   510
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   511
void flib_netconn_onServerVar(flib_netconn *conn, void (*callback)(void *context, const char *name, const char *value), void *context);
7269
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   512
7234
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
   513
#endif