X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=metacube2.h;fp=metacube2.h;h=43de8b7480de172fe621d5865df053cb8ebf1e68;hp=0000000000000000000000000000000000000000;hb=979a284b4039b0ea74525b700b9f1089b8c4248d;hpb=70c0baf4bcec3a77f0626d5a7bfde87fc7339698 diff --git a/metacube2.h b/metacube2.h new file mode 100644 index 0000000..43de8b7 --- /dev/null +++ b/metacube2.h @@ -0,0 +1,26 @@ +#ifndef _METACUBE2_H +#define _METACUBE2_H + +/* + * Definitions for the Metacube2 protocol, used to communicate with Cubemap. + * + * Note: This file is meant to compile as both C and C++, for easier inclusion + * in other projects. + */ + +#include + +#define METACUBE2_SYNC "cube!map" /* 8 bytes long. */ +#define METACUBE_FLAGS_HEADER 0x1 +#define METACUBE_FLAGS_NOT_SUITABLE_FOR_STREAM_START 0x2 + +struct metacube2_block_header { + char sync[8]; /* METACUBE2_SYNC */ + uint32_t size; /* Network byte order. Does not include header. */ + uint16_t flags; /* Network byte order. METACUBE_FLAGS_*. */ + uint16_t csum; /* Network byte order. CRC16 of size and flags. */ +}; + +uint16_t metacube2_compute_crc(const struct metacube2_block_header *hdr); + +#endif /* !defined(_METACUBE_H) */