project_files/frontlib/ipc.h
changeset 7179 f84805e6df03
parent 7177 bf6cf4dd847a
child 7182 076aba32abd3
equal deleted inserted replaced
7177:bf6cf4dd847a 7179:f84805e6df03
     1 #ifndef IPC_H_
       
     2 #define IPC_H_
       
     3 
       
     4 #include "buffer.h"
       
     5 #include "model/weapon.h"
       
     6 
       
     7 #include <stddef.h>
       
     8 #include <stdint.h>
       
     9 #include <stdbool.h>
       
    10 
       
    11 struct _flib_ipc;
       
    12 typedef struct _flib_ipc *flib_ipc;
       
    13 
       
    14 typedef enum {
       
    15 	GAME_END_FINISHED,
       
    16 	GAME_END_INTERRUPTED,
       
    17 	GAME_END_HALTED
       
    18 } flib_GameEndType;
       
    19 
       
    20 flib_ipc flib_ipc_create(bool recordDemo, const char *localPlayerName);
       
    21 void flib_ipc_destroy(flib_ipc *ipcptr);
       
    22 
       
    23 void flib_ipc_onConnect(flib_ipc ipc, void (*callback)(void* context), void* context);
       
    24 void flib_ipc_onDisconnect(flib_ipc ipc, void (*callback)(void* context), void* context);
       
    25 void flib_ipc_onConfigQuery(flib_ipc ipc, void (*callback)(void* context), void* context);
       
    26 void flib_ipc_onEngineError(flib_ipc ipc, void (*callback)(void* context, const uint8_t *error), void* context);
       
    27 void flib_ipc_onGameEnd(flib_ipc ipc, void (*callback)(void* context, int gameEndType), void* context);
       
    28 void flib_ipc_onChat(flib_ipc ipc, void (*callback)(void* context, const uint8_t *messagestr, int teamchat), void* context);
       
    29 void flib_ipc_onEngineMessage(flib_ipc ipc, void (*callback)(void* context, const uint8_t *message, int len), void* context);
       
    30 
       
    31 int flib_ipc_send_raw(flib_ipc ipc, void *data, size_t len);
       
    32 int flib_ipc_send_message(flib_ipc ipc, void *data, size_t len);
       
    33 int flib_ipc_send_messagestr(flib_ipc ipc, char *data);
       
    34 
       
    35 // Configuration
       
    36 int flib_ipc_send_seed(flib_ipc ipc, const char *seed);
       
    37 int flib_ipc_send_script(flib_ipc ipc, const char *scriptpath);
       
    38 int flib_ipc_send_map_regular(flib_ipc ipc, const char *theme, int templateFilter);
       
    39 int flib_ipc_send_map_maze(flib_ipc ipc, const char *theme, int mazeType);
       
    40 int flib_ipc_send_map_drawn(flib_ipc ipc, const char *theme, void *drawnMapData, size_t drawnMapDataLen);
       
    41 int flib_ipc_send_map_named(flib_ipc ipc, const char *mappath);
       
    42 int flib_ipc_send_gamemods(flib_ipc ipc, uint32_t modflags);
       
    43 int flib_ipc_send_gamesetting(flib_ipc ipc, const char *settingname, int modflags);
       
    44 int flib_ipc_send_weaponset(flib_ipc ipc, flib_weaponset *set);
       
    45 
       
    46 int flib_ipc_send_conf_end(flib_ipc ipc);
       
    47 
       
    48 
       
    49 uint16_t flib_ipc_port(flib_ipc ipc);
       
    50 flib_constbuffer flib_ipc_getdemo(flib_ipc ipc);
       
    51 
       
    52 void flib_ipc_tick(flib_ipc ipc);
       
    53 
       
    54 #endif /* IPC_H_ */