project_files/frontlib/net/netconn_internal.h
changeset 7271 5608ac657362
child 7273 8eed495fd8da
equal deleted inserted replaced
7269:5b0aeef8ba2a 7271:5608ac657362
       
     1 /**
       
     2  * Common definitions needed by netconn functions, to allow splitting them into several files.
       
     3  */
       
     4 
       
     5 #ifndef NETCONN_INTERNAL_H_
       
     6 #define NETCONN_INTERNAL_H_
       
     7 
       
     8 #include "netconn.h"
       
     9 #include "netbase.h"
       
    10 #include "../model/cfg.h"
       
    11 #include "../model/roomlist.h"
       
    12 #include "../model/map.h"
       
    13 #include "../model/team.h"
       
    14 #include "../model/weapon.h"
       
    15 
       
    16 #include <stdbool.h>
       
    17 #include <stdint.h>
       
    18 #include <stddef.h>
       
    19 
       
    20 struct _flib_netconn {
       
    21 	flib_netbase *netBase;
       
    22 	char *playerName;
       
    23 	flib_cfg_meta *metaCfg;
       
    24 	flib_roomlist *roomList;
       
    25 
       
    26 	int netconnState;	// One of the NETCONN_STATE constants
       
    27 
       
    28 	bool isAdmin;			// Player is server administrator
       
    29 	bool isChief;			// Player can modify the current room
       
    30 	flib_map *map;			// Map settings in the current room.
       
    31 
       
    32 	void (*onMessageCb)(void *context, int msgtype, const char *msg);
       
    33 	void *onMessageCtx;
       
    34 
       
    35 	void (*onConnectedCb)(void *context);
       
    36 	void *onConnectedCtx;
       
    37 
       
    38 	void (*onDisconnectedCb)(void *context, int reason, const char *message);
       
    39 	void *onDisconnectedCtx;
       
    40 
       
    41 	void (*onRoomAddCb)(void *context, const flib_roomlist_room *room);
       
    42 	void *onRoomAddCtx;
       
    43 
       
    44 	void (*onRoomDeleteCb)(void *context, const char *name);
       
    45 	void *onRoomDeleteCtx;
       
    46 
       
    47 	void (*onRoomUpdateCb)(void *context, const char *oldName, const flib_roomlist_room *room);
       
    48 	void *onRoomUpdateCtx;
       
    49 
       
    50 	void (*onChatCb)(void *context, const char *nick, const char *msg);
       
    51 	void *onChatCtx;
       
    52 
       
    53 	void (*onLobbyJoinCb)(void *context, const char *nick);
       
    54 	void *onLobbyJoinCtx;
       
    55 
       
    56 	void (*onLobbyLeaveCb)(void *context, const char *nick, const char *partMessage);
       
    57 	void *onLobbyLeaveCtx;
       
    58 
       
    59 	void (*onRoomJoinCb)(void *context, const char *nick);
       
    60 	void *onRoomJoinCtx;
       
    61 
       
    62 	void (*onRoomLeaveCb)(void *context, const char *nick, const char *partMessage);
       
    63 	void *onRoomLeaveCtx;
       
    64 
       
    65 	void (*onNickTakenCb)(void *context, const char *nick);
       
    66 	void *onNickTakenCtx;
       
    67 
       
    68 	void (*onPasswordRequestCb)(void *context, const char *nick);
       
    69 	void *onPasswordRequestCtx;
       
    70 
       
    71 	void (*onRoomChiefStatusCb)(void *context, bool isChief);
       
    72 	void *onRoomChiefStatusCtx;
       
    73 
       
    74 	void (*onReadyStateCb)(void *context, const char *nick, bool ready);
       
    75 	void *onReadyStateCtx;
       
    76 
       
    77 	void (*onEnterRoomCb)(void *context, bool chief);
       
    78 	void *onEnterRoomCtx;
       
    79 
       
    80 	void (*onLeaveRoomCb)(void *context, int reason, const char *message);
       
    81 	void *onLeaveRoomCtx;
       
    82 
       
    83 	void (*onTeamAddCb)(void *context, flib_team *team);
       
    84 	void *onTeamAddCtx;
       
    85 
       
    86 	void (*onTeamDeleteCb)(void *context, const char *teamname);
       
    87 	void *onTeamDeleteCtx;
       
    88 
       
    89 	void (*onRunGameCb)(void *context);
       
    90 	void *onRunGameCtx;
       
    91 
       
    92 	void (*onTeamAcceptedCb)(void *context, const char *teamName);
       
    93 	void *onTeamAcceptedCtx;
       
    94 
       
    95 	void (*onHogCountChangedCb)(void *context, const char *teamName, int hogs);
       
    96 	void *onHogCountChangedCtx;
       
    97 
       
    98 	void (*onTeamColorChangedCb)(void *context, const char *teamName, uint32_t colorRGB);
       
    99 	void *onTeamColorChangedCtx;
       
   100 
       
   101 	void (*onEngineMessageCb)(void *context, const char *message, int size);
       
   102 	void *onEngineMessageCtx;
       
   103 
       
   104 	void (*onCfgSchemeCb)(void *context, flib_cfg *scheme);
       
   105 	void *onCfgSchemeCtx;
       
   106 
       
   107 	void (*onMapChangedCb)(void *context, const flib_map *map, int changetype);
       
   108 	void *onMapChangedCtx;
       
   109 
       
   110 	void (*onScriptChangedCb)(void *context, const char *script);
       
   111 	void *onScriptChangedCtx;
       
   112 
       
   113 	void (*onWeaponsetChangedCb)(void *context, flib_weaponset *weaponset);
       
   114 	void *onWeaponsetChangedCtx;
       
   115 
       
   116 	void (*onAdminAccessCb)(void *context);
       
   117 	void *onAdminAccessCtx;
       
   118 
       
   119 	void (*onServerVarCb)(void *context, const char *name, const char *value);
       
   120 	void *onServerVarCtx;
       
   121 
       
   122 	bool running;
       
   123 	bool destroyRequested;
       
   124 };
       
   125 
       
   126 #endif