summaryrefslogtreecommitdiff
path: root/toxcore/state.h
diff options
context:
space:
mode:
authorzugz (tox) <mbays+tox@sdf.org>2018-09-09 23:21:20 +0200
committerzugz (tox) <mbays+tox@sdf.org>2018-10-20 11:03:10 +0200
commit744dc2f5da2c54ad1e4d7d6ce229bc1756d81263 (patch)
tree35f6590fe3150118bc6b1336fbb0a7db06543668 /toxcore/state.h
parentaa5c7828802b3fcaedfd8d6fe9a08ca714b9aa2b (diff)
Make saving and loading the responsibility of Tox rather than Messenger
Diffstat (limited to 'toxcore/state.h')
-rw-r--r--toxcore/state.h25
1 files changed, 22 insertions, 3 deletions
diff --git a/toxcore/state.h b/toxcore/state.h
index 2d1f62c3..872b1e9d 100644
--- a/toxcore/state.h
+++ b/toxcore/state.h
@@ -18,6 +18,22 @@
18extern "C" { 18extern "C" {
19#endif 19#endif
20 20
21#define STATE_COOKIE_GLOBAL 0x15ed1b1f
22
23#define STATE_COOKIE_TYPE 0x01ce
24
25typedef enum State_Type {
26 STATE_TYPE_NOSPAMKEYS = 1,
27 STATE_TYPE_DHT = 2,
28 STATE_TYPE_FRIENDS = 3,
29 STATE_TYPE_NAME = 4,
30 STATE_TYPE_STATUSMESSAGE = 5,
31 STATE_TYPE_STATUS = 6,
32 STATE_TYPE_TCP_RELAY = 10,
33 STATE_TYPE_PATH_NODE = 11,
34 STATE_TYPE_END = 255,
35} State_Type;
36
21// Returned by the state_load_cb to instruct the loader on what to do next. 37// Returned by the state_load_cb to instruct the loader on what to do next.
22typedef enum State_Load_Status { 38typedef enum State_Load_Status {
23 // Continue loading state data sections. 39 // Continue loading state data sections.
@@ -39,10 +55,13 @@ uint8_t *state_write_section_header(uint8_t *data, uint16_t cookie_type, uint32_
39// Utilities for state data serialisation. 55// Utilities for state data serialisation.
40 56
41uint16_t lendian_to_host16(uint16_t lendian); 57uint16_t lendian_to_host16(uint16_t lendian);
42uint16_t host_tolendian16(uint16_t host); 58uint16_t host_to_lendian16(uint16_t host);
59
60void host_to_lendian_bytes32(uint8_t *dest, uint32_t num);
61void lendian_bytes_to_host32(uint32_t *dest, const uint8_t *lendian);
43 62
44void host_to_lendian32(uint8_t *dest, uint32_t num); 63void host_to_lendian_bytes16(uint8_t *dest, uint16_t num);
45void lendian_to_host32(uint32_t *dest, const uint8_t *lendian); 64void lendian_bytes_to_host16(uint16_t *dest, const uint8_t *lendian);
46 65
47#ifdef __cplusplus 66#ifdef __cplusplus
48} // extern "C" 67} // extern "C"