project_files/frontlib/net/netconn.h
author Medo <smaxein@googlemail.com>
Mon, 25 Jun 2012 00:42:07 +0200
changeset 7271 5608ac657362
parent 7269 5b0aeef8ba2a
child 7275 15f722e0b96f
permissions -rw-r--r--
frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7234
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
     1
#ifndef NETCONN_H_
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
     2
#define NETCONN_H_
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
     3
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
     4
#include "../model/gamesetup.h"
7269
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
     5
#include "../model/cfg.h"
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
     6
#include "../model/roomlist.h"
7234
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
     7
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
     8
#include <stddef.h>
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
     9
#include <stdint.h>
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    10
#include <stdbool.h>
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    11
7269
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    12
#define NETCONN_STATE_CONNECTING 0
7234
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    13
#define NETCONN_STATE_LOBBY 1
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    14
#define NETCONN_STATE_ROOM 2
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    15
#define NETCONN_STATE_INGAME 3
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    16
#define NETCONN_STATE_DISCONNECTED 10
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    17
7269
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    18
#define NETCONN_DISCONNECT_NORMAL 0
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    19
#define NETCONN_DISCONNECT_SERVER_TOO_OLD 1
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    20
#define NETCONN_DISCONNECT_AUTH_FAILED 2
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    21
#define NETCONN_DISCONNECT_INTERNAL_ERROR 100
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    22
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    23
#define NETCONN_ROOMLEAVE_ABANDONED 0
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    24
#define NETCONN_ROOMLEAVE_KICKED 1
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    25
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    26
#define NETCONN_MSG_TYPE_PLAYERINFO 0
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    27
#define NETCONN_MSG_TYPE_SERVERMESSAGE 1
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    28
#define NETCONN_MSG_TYPE_WARNING 2
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    29
#define NETCONN_MSG_TYPE_ERROR 3
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    30
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    31
#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
    32
#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
    33
#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
    34
#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
    35
#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
    36
#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
    37
#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
    38
#define NETCONN_MAPCHANGE_SEED 7
7234
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    39
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    40
// 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
    41
typedef struct _flib_netconn flib_netconn;
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    42
7269
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    43
flib_netconn *flib_netconn_create(const char *playerName, flib_cfg_meta *metacfg, const char *host, uint16_t port);
7234
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    44
void flib_netconn_destroy(flib_netconn *conn);
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    45
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    46
/**
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    47
 * 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
    48
 * Should be called regularly.
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    49
 */
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    50
void flib_netconn_tick(flib_netconn *conn);
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
    51
7269
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    52
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    53
/**
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    54
 * Return the current roomlist. Don't free or modify.
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    55
 */
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    56
const flib_roomlist *flib_netconn_get_roomlist(flib_netconn *conn);
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    57
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    58
/**
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    59
 * 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
    60
 * 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
    61
 */
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    62
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
    63
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    64
/**
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    65
 * quitmsg may be null
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    66
 */
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    67
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
    68
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
    69
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    70
/**
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    71
 * Send a teamchat message, forwarded from the engine. Only makes sense ingame.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    72
 * The server does not send a reply. 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
    73
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    74
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
    75
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    76
/**
7269
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    77
 * Note: Most other functions in this lib accept UTF-8, but the password needs to be
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    78
 * sent as latin1
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
int flib_netconn_send_password(flib_netconn *conn, const char *latin1Passwd);
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
/**
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    83
 * Request a different nickname.
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    84
 * 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
    85
 * 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
    86
 * be changed.
7269
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    87
 */
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    88
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
    89
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
    90
/**
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    91
 * 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
    92
 * 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
    93
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    94
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
    95
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    96
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
    97
 * 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
    98
 * 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
    99
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   100
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
   101
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   102
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   103
 * Rename the current 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
   104
 * TODO: reply
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   105
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   106
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
   107
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   108
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   109
 * Leave the room for the lobby. Only makes sense 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
   110
 * TODO: reply, TODO can you send a message?
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   111
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   112
int flib_netconn_send_leaveRoom(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
   113
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
 * Change your "ready" status in the room. Only makes sense when 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
   116
 * TODO: reply
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   117
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   118
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
   119
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   120
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   121
 * 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
   122
 * 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
   123
 * 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
   124
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   125
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
   126
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   127
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   128
 * Remove the team with the name teamname. Only makes sense when 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
   129
 * TODO: reply
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   130
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   131
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
   132
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   133
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   134
 * Send an engine message. Only makes sense when ingame.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   135
 * TODO: reply
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   136
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   137
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
   138
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
 * 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
   141
 * 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
   142
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   143
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
   144
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
 * 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
   147
 * 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
   148
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   149
int flib_netconn_send_teamColor(flib_netconn *conn, const char *teamname, uint32_t colorRGB);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   150
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
 * 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
   153
 * 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
   154
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   155
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
   156
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   157
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   158
 * 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
   159
 * 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
   160
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   161
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
   162
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   163
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   164
 * 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
   165
 * 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
   166
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   167
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
   168
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   169
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   170
 * 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
   171
 * 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
   172
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   173
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
   174
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   175
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   176
 * 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
   177
 * 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
   178
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   179
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
   180
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   181
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   182
 * 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
   183
 * 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
   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_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
   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 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
   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_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
   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 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
   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
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   197
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
   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 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
   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_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
   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 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
   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_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
   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 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
   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_scheme(flib_netconn *conn, const flib_cfg *scheme);
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
 * Inform the server that the round has ended. 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
   219
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   220
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
   221
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
 * 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
   224
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   225
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
   226
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   227
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   228
 * 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
   229
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   230
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
   231
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
 * 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
   234
 * 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
   235
 * 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
   236
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   237
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
   238
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   239
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   240
 * 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
   241
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   242
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
   243
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
 * Signal that you want to start the game. 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
   246
 * 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
   247
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   248
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
   249
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
 * 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
   252
 * 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
   253
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   254
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
   255
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
 * 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
   258
 * 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
   259
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   260
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
   261
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   262
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   263
 * 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
   264
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   265
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
   266
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   267
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   268
 * 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
   269
 * 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
   270
 * TODO reply?
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
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
   273
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   274
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   275
 * 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
   276
 * 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
   277
 * 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
   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_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
   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
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   283
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   284
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
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
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   290
/**
7269
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   291
 * 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
   292
 * (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
   293
 * 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
   294
 */
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   295
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
   296
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   297
/**
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   298
 * 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
   299
 * 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
   300
 */
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   301
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
   302
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   303
/**
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   304
 * 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
   305
 * message arriving from the server.
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   306
 */
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   307
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
   308
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   309
/**
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   310
 * 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
   311
 * 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
   312
 * also be NULL.
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   313
 */
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   314
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
   315
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   316
/**
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   317
 * Callbacks for room list updates. The room list is managed automatically and can be queried with
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   318
 * flib_netconn_get_roomlist() as soon as the onConnected callback is fired. These callbacks
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   319
 * provide notification about changes.
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   320
 */
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   321
void flib_netconn_onRoomAdd(flib_netconn *conn, void (*callback)(void *context, const flib_roomlist_room *room), void* context);
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   322
void flib_netconn_onRoomDelete(flib_netconn *conn, void (*callback)(void *context, const char *name), void* context);
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   323
void flib_netconn_onRoomUpdate(flib_netconn *conn, void (*callback)(void *context, const char *oldName, const flib_roomlist_room *room), void* context);
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   324
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   325
/**
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   326
 * 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
   327
 * 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
   328
 */
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   329
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
   330
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
   331
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   332
/**
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   333
 * 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
   334
 * 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
   335
 * 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
   336
 * 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
   337
 */
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   338
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
   339
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   340
/**
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   341
 * 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
   342
 * 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
   343
 * 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
   344
 * 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
   345
 */
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   346
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
   347
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   348
/**
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   349
 * 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
   350
 * If chief is true, you can and should send a full configuration for the room now.
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   351
 * This consists of TODO
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   352
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   353
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
   354
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   355
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   356
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   357
 * 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
   358
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   359
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   360
/**
7269
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   361
 * 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
   362
 * 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
   363
 * 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
   364
 * 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
   365
 *
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   366
 * 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
   367
 * 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
   368
 */
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   369
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
   370
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   371
/**
5b0aeef8ba2a More progress on the netplay part of the frontlib
Medo <smaxein@googlemail.com>
parents: 7234
diff changeset
   372
 * 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
   373
 */
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   374
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
   375
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
 * 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
   378
 * 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
   379
 * 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
   380
 */
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   381
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
   382
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   383
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   384
 * 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
   385
 * 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
   386
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   387
void flib_netconn_onTeamAdd(flib_netconn *conn, void (*callback)(void *context, flib_team *team), void *context);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   388
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   389
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   390
 * 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
   391
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   392
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
   393
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   394
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
   395
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
   396
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   397
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   398
 * The game is starting. Fire up the engine and join in!
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   399
 * TODO: How?
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   400
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   401
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
   402
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   403
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   404
 * 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
   405
 * 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
   406
 * 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
   407
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   408
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
   409
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
 * 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
   412
 * 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
   413
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   414
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
   415
7271
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   416
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   417
 * 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
   418
 * 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
   419
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   420
void flib_netconn_onTeamColorChanged(flib_netconn *conn, void (*callback)(void *context, const char *teamName, uint32_t colorARGB), void *context);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   421
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   422
void flib_netconn_onEngineMessage(flib_netconn *conn, void (*callback)(void *context, const char *message, int size), void *context);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   423
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   424
void flib_netconn_onCfgScheme(flib_netconn *conn, void (*callback)(void *context, flib_cfg *scheme), void *context);
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   425
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   426
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   427
 * 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
   428
 * 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
   429
 * 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
   430
 * 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
   431
 * 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
   432
 *
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   433
 * 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
   434
 * 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
   435
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   436
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
   437
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   438
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   439
 * 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
   440
 * 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
   441
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   442
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
   443
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   444
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   445
 * 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
   446
 * 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
   447
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   448
void flib_netconn_onWeaponsetChanged(flib_netconn *conn, void (*callback)(void *context, flib_weaponset *weaponset), void *context);
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
/**
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   451
 * 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
   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_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
   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 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
   457
 * 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
   458
 */
5608ac657362 frontlib: Intermittent commit. Things are still in flux but we're getting there :)
Medo <smaxein@googlemail.com>
parents: 7269
diff changeset
   459
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
   460
7234
613998625a3c frontlib: Started work on the server connection code
Medo <smaxein@googlemail.com>
parents:
diff changeset
   461
#endif