diff options
Diffstat (limited to 'toxencryptsave/toxencryptsave.h')
-rw-r--r-- | toxencryptsave/toxencryptsave.h | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/toxencryptsave/toxencryptsave.h b/toxencryptsave/toxencryptsave.h index 9e28b48e..cf191810 100644 --- a/toxencryptsave/toxencryptsave.h +++ b/toxencryptsave/toxencryptsave.h | |||
@@ -42,6 +42,87 @@ struct Tox_Options; | |||
42 | #define TOX_PASS_KEY_LENGTH 32 | 42 | #define TOX_PASS_KEY_LENGTH 32 |
43 | #define TOX_PASS_ENCRYPTION_EXTRA_LENGTH 80 | 43 | #define TOX_PASS_ENCRYPTION_EXTRA_LENGTH 80 |
44 | 44 | ||
45 | /** | ||
46 | * ToxEncryptSave. | ||
47 | */ | ||
48 | #ifndef TOXES_DEFINED | ||
49 | #define TOXES_DEFINED | ||
50 | #endif /* TOXES_DEFINED */ | ||
51 | |||
52 | |||
53 | /******************************************************************************* | ||
54 | * | ||
55 | * :: API version | ||
56 | * | ||
57 | ******************************************************************************/ | ||
58 | /** | ||
59 | * The major version number. Incremented when the API or ABI changes in an | ||
60 | * incompatible way. | ||
61 | */ | ||
62 | #define TOXES_VERSION_MAJOR 0u | ||
63 | |||
64 | /** | ||
65 | * The minor version number. Incremented when functionality is added without | ||
66 | * breaking the API or ABI. Set to 0 when the major version number is | ||
67 | * incremented. | ||
68 | */ | ||
69 | #define TOXES_VERSION_MINOR 0u | ||
70 | |||
71 | /** | ||
72 | * The patch or revision number. Incremented when bugfixes are applied without | ||
73 | * changing any functionality or API or ABI. | ||
74 | */ | ||
75 | #define TOXES_VERSION_PATCH 0u | ||
76 | |||
77 | /** | ||
78 | * A macro to check at preprocessing time whether the client code is compatible | ||
79 | * with the installed version of ToxAV. | ||
80 | */ | ||
81 | #define TOXES_VERSION_IS_API_COMPATIBLE(MAJOR, MINOR, PATCH) \ | ||
82 | (TOXES_VERSION_MAJOR == MAJOR && \ | ||
83 | (TOXES_VERSION_MINOR > MINOR || \ | ||
84 | (TOXES_VERSION_MINOR == MINOR && \ | ||
85 | TOXES_VERSION_PATCH >= PATCH))) | ||
86 | |||
87 | /** | ||
88 | * A macro to make compilation fail if the client code is not compatible with | ||
89 | * the installed version of ToxAV. | ||
90 | */ | ||
91 | #define TOXES_VERSION_REQUIRE(MAJOR, MINOR, PATCH) \ | ||
92 | typedef char toxes_required_version[TOXES_IS_COMPATIBLE(MAJOR, MINOR, PATCH) ? 1 : -1] | ||
93 | |||
94 | /** | ||
95 | * A convenience macro to call toxES_version_is_compatible with the currently | ||
96 | * compiling API version. | ||
97 | */ | ||
98 | #define TOXES_VERSION_IS_ABI_COMPATIBLE() \ | ||
99 | toxes_version_is_compatible(TOXES_VERSION_MAJOR, TOXES_VERSION_MINOR, TOXES_VERSION_PATCH) | ||
100 | |||
101 | /** | ||
102 | * Return the major version number of the library. Can be used to display the | ||
103 | * ToxAV library version or to check whether the client is compatible with the | ||
104 | * dynamically linked version of ToxAV. | ||
105 | */ | ||
106 | uint32_t toxes_version_major(void); | ||
107 | |||
108 | /** | ||
109 | * Return the minor version number of the library. | ||
110 | */ | ||
111 | uint32_t toxes_version_minor(void); | ||
112 | |||
113 | /** | ||
114 | * Return the patch number of the library. | ||
115 | */ | ||
116 | uint32_t toxes_version_patch(void); | ||
117 | |||
118 | /** | ||
119 | * Return whether the compiled library version is compatible with the passed | ||
120 | * version numbers. | ||
121 | */ | ||
122 | bool toxes_version_is_compatible(uint32_t major, uint32_t minor, uint32_t patch); | ||
123 | |||
124 | |||
125 | |||
45 | /* This module is conceptually organized into two parts. The first part are the functions | 126 | /* This module is conceptually organized into two parts. The first part are the functions |
46 | * with "key" in the name. To use these functions, first derive an encryption key | 127 | * with "key" in the name. To use these functions, first derive an encryption key |
47 | * from a password with tox_derive_key_from_pass, and use the returned key to | 128 | * from a password with tox_derive_key_from_pass, and use the returned key to |