project_files/frontlib/net/netprotocol.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 :)

#ifndef NETPROTOCOL_H_
#define NETPROTOCOL_H_

#include "../model/team.h"
#include "../model/cfg.h"
#include "../model/map.h"

#include <stddef.h>

/**
 * Create a new team from this 23-part net message
 */
flib_team *flib_team_from_netmsg(char **parts);

/**
 * Create a new scheme from this net message, which must have
 * meta->modCount+meta->settingCount+1 parts.
 */
flib_cfg *flib_netmsg_to_cfg(flib_cfg_meta *meta, char **parts);

/**
 * Create a new map from this five-part netmsg
 */
flib_map *flib_netmsg_to_map(char **parts);

/**
 * Decode the drawn map data from this netmessage line.
 *
 * The data is first base64 decoded and then quncompress()ed.
 * The return value is a newly allocated byte buffer, the length
 * is written to the variable pointed to by outlen.
 * Returns NULL on error.
 */
uint8_t *flib_netmsg_to_drawnmapdata(size_t *outlen, char *netmsg);

#endif /* NETPROTOCOL_H_ */