summaryrefslogtreecommitdiff
path: root/toxcore/tox.c
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2016-08-29 20:57:25 +0100
committeriphydf <iphydf@users.noreply.github.com>2016-08-29 23:15:39 +0100
commit4692cea75e82d05c4facf97c8853819281f376cf (patch)
treea35ea42b1e3bf461f0444b4ab21afc990bfff6a1 /toxcore/tox.c
parent74ecb0c4606724edfbe977984e9e9d61aa501851 (diff)
Add getters/setters for options.
Diffstat (limited to 'toxcore/tox.c')
-rw-r--r--toxcore/tox.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/toxcore/tox.c b/toxcore/tox.c
index 1063f806..ab5ed439 100644
--- a/toxcore/tox.c
+++ b/toxcore/tox.c
@@ -114,6 +114,38 @@ CONST_FUNCTION(file_id_length, FILE_ID_LENGTH)
114CONST_FUNCTION(max_filename_length, MAX_FILENAME_LENGTH) 114CONST_FUNCTION(max_filename_length, MAX_FILENAME_LENGTH)
115 115
116 116
117#define ACCESSORS(type, name) \
118type tox_options_get_##name(const struct Tox_Options *options) \
119{ \
120 return options->name; \
121} \
122void tox_options_set_##name(struct Tox_Options *options, type name) \
123{ \
124 options->name = name; \
125}
126
127ACCESSORS(bool, ipv6_enabled)
128ACCESSORS(bool, udp_enabled)
129ACCESSORS(TOX_PROXY_TYPE, proxy_type)
130ACCESSORS(const char *, proxy_host)
131ACCESSORS(uint16_t, proxy_port)
132ACCESSORS(uint16_t, start_port)
133ACCESSORS(uint16_t, end_port)
134ACCESSORS(uint16_t, tcp_port)
135ACCESSORS(TOX_SAVEDATA_TYPE, savedata_type)
136ACCESSORS(size_t, savedata_length)
137
138const uint8_t *tox_options_get_savedata_data(const struct Tox_Options *options)
139{
140 return options->savedata_data;
141}
142
143void tox_options_set_savedata_data(struct Tox_Options *options, const uint8_t *savedata_data, size_t length)
144{
145 options->savedata_data = savedata_data;
146}
147
148
117void tox_options_default(struct Tox_Options *options) 149void tox_options_default(struct Tox_Options *options)
118{ 150{
119 if (options) { 151 if (options) {