irungentoo/ProjectTox-Core — pull request #810 by stal888 (2014-03-19 23:13:18+00:00)
Title: revamp data format

***Note***: the old saving/loading functions haven't been removed yet.

This PR changes the data format used by tox_save and co. to a new format that's completely independent of internal structs. It should be safe to use across endians + be backward/forward compatible[1].

Current API isn't broken by this pull, but it is more inefficient than using the new ``txd_`` API.

### Friend extensions (FEx) ###

The FEx mini-protocol is used for file-compatibility in the wire format when adding new values to the Friend struct, such as avatars, personal bio, etc. There isn't any more information needed to be saved right now, so the parser just skips over them.

* At the end of the required ``FRNd`` block data, there is a field specifying the number of FEx key-value pairs that follow.
* A FEx key-value pair consists of a two-byte (``txd_twocc_t``) key, a 4-byte value length, and the value. It should be trivial to add code to read them and add to ``txd_intermediate_t`` fields.

[1]: Friend entries only.