diff options
author | zugz (tox) <mbays+tox@sdf.org> | 2018-09-09 23:21:20 +0200 |
---|---|---|
committer | zugz (tox) <mbays+tox@sdf.org> | 2018-10-20 11:03:10 +0200 |
commit | 744dc2f5da2c54ad1e4d7d6ce229bc1756d81263 (patch) | |
tree | 35f6590fe3150118bc6b1336fbb0a7db06543668 /toxcore/state.h | |
parent | aa5c7828802b3fcaedfd8d6fe9a08ca714b9aa2b (diff) |
Make saving and loading the responsibility of Tox rather than Messenger
Diffstat (limited to 'toxcore/state.h')
-rw-r--r-- | toxcore/state.h | 25 |
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 @@ | |||
18 | extern "C" { | 18 | extern "C" { |
19 | #endif | 19 | #endif |
20 | 20 | ||
21 | #define STATE_COOKIE_GLOBAL 0x15ed1b1f | ||
22 | |||
23 | #define STATE_COOKIE_TYPE 0x01ce | ||
24 | |||
25 | typedef 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. |
22 | typedef enum State_Load_Status { | 38 | typedef 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 | ||
41 | uint16_t lendian_to_host16(uint16_t lendian); | 57 | uint16_t lendian_to_host16(uint16_t lendian); |
42 | uint16_t host_tolendian16(uint16_t host); | 58 | uint16_t host_to_lendian16(uint16_t host); |
59 | |||
60 | void host_to_lendian_bytes32(uint8_t *dest, uint32_t num); | ||
61 | void lendian_bytes_to_host32(uint32_t *dest, const uint8_t *lendian); | ||
43 | 62 | ||
44 | void host_to_lendian32(uint8_t *dest, uint32_t num); | 63 | void host_to_lendian_bytes16(uint8_t *dest, uint16_t num); |
45 | void lendian_to_host32(uint32_t *dest, const uint8_t *lendian); | 64 | void 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" |