@@ -136,53 +136,135 @@ uint32_t tox_dht_node_public_key_size(void)
136136 return TOX_DHT_NODE_PUBLIC_KEY_SIZE ;
137137}
138138
139- //!TOKSTYLE-
140-
141- #define ACCESSORS (type , name ) \
142- type tox_options_get_##name(const struct Tox_Options *options) \
143- { \
144- return options->name; \
145- } \
146- void tox_options_set_##name(struct Tox_Options *options, type name) \
147- { \
148- options->name = name; \
149- }
150-
151- ACCESSORS (bool , ipv6_enabled )
152- ACCESSORS (bool , udp_enabled )
153- ACCESSORS (Tox_Proxy_Type , proxy_type )
154- ACCESSORS (const char * , proxy_host )
155- ACCESSORS (uint16_t , proxy_port )
156- ACCESSORS (uint16_t , start_port )
157- ACCESSORS (uint16_t , end_port )
158- ACCESSORS (uint16_t , tcp_port )
159- ACCESSORS (bool , hole_punching_enabled )
160- ACCESSORS (Tox_Savedata_Type , savedata_type )
161- ACCESSORS (size_t , savedata_length )
162- ACCESSORS (tox_log_cb * , log_callback )
163- ACCESSORS (void * , log_user_data )
164- ACCESSORS (bool , local_discovery_enabled )
165- ACCESSORS (bool , dht_announcements_enabled )
166- ACCESSORS (bool , experimental_thread_safety )
167- ACCESSORS (const Tox_System * , operating_system )
168-
169- //!TOKSTYLE+
170-
171- const uint8_t * tox_options_get_savedata_data (const struct Tox_Options * options )
139+ bool tox_options_get_ipv6_enabled (const Tox_Options * options ) { return options -> ipv6_enabled ; }
140+ void tox_options_set_ipv6_enabled (Tox_Options * options , bool ipv6_enabled )
141+ {
142+ options -> ipv6_enabled = ipv6_enabled ;
143+ }
144+ bool tox_options_get_udp_enabled (const Tox_Options * options ) { return options -> udp_enabled ; }
145+ void tox_options_set_udp_enabled (Tox_Options * options , bool udp_enabled )
146+ {
147+ options -> udp_enabled = udp_enabled ;
148+ }
149+ Tox_Proxy_Type tox_options_get_proxy_type (const Tox_Options * options )
150+ {
151+ return options -> proxy_type ;
152+ }
153+ void tox_options_set_proxy_type (Tox_Options * options , Tox_Proxy_Type proxy_type )
154+ {
155+ options -> proxy_type = proxy_type ;
156+ }
157+ const char * tox_options_get_proxy_host (const Tox_Options * options ) { return options -> proxy_host ; }
158+ void tox_options_set_proxy_host (Tox_Options * options , const char * proxy_host )
159+ {
160+ options -> proxy_host = proxy_host ;
161+ }
162+ uint16_t tox_options_get_proxy_port (const Tox_Options * options ) { return options -> proxy_port ; }
163+ void tox_options_set_proxy_port (Tox_Options * options , uint16_t proxy_port )
164+ {
165+ options -> proxy_port = proxy_port ;
166+ }
167+ uint16_t tox_options_get_start_port (const Tox_Options * options ) { return options -> start_port ; }
168+ void tox_options_set_start_port (Tox_Options * options , uint16_t start_port )
169+ {
170+ options -> start_port = start_port ;
171+ }
172+ uint16_t tox_options_get_end_port (const Tox_Options * options ) { return options -> end_port ; }
173+ void tox_options_set_end_port (Tox_Options * options , uint16_t end_port )
174+ {
175+ options -> end_port = end_port ;
176+ }
177+ uint16_t tox_options_get_tcp_port (const Tox_Options * options ) { return options -> tcp_port ; }
178+ void tox_options_set_tcp_port (Tox_Options * options , uint16_t tcp_port )
179+ {
180+ options -> tcp_port = tcp_port ;
181+ }
182+ bool tox_options_get_hole_punching_enabled (const Tox_Options * options )
183+ {
184+ return options -> hole_punching_enabled ;
185+ }
186+ void tox_options_set_hole_punching_enabled (Tox_Options * options , bool hole_punching_enabled )
187+ {
188+ options -> hole_punching_enabled = hole_punching_enabled ;
189+ }
190+ Tox_Savedata_Type tox_options_get_savedata_type (const Tox_Options * options )
191+ {
192+ return options -> savedata_type ;
193+ }
194+ void tox_options_set_savedata_type (Tox_Options * options , Tox_Savedata_Type savedata_type )
195+ {
196+ options -> savedata_type = savedata_type ;
197+ }
198+ size_t tox_options_get_savedata_length (const Tox_Options * options )
199+ {
200+ return options -> savedata_length ;
201+ }
202+ void tox_options_set_savedata_length (Tox_Options * options , size_t savedata_length )
203+ {
204+ options -> savedata_length = savedata_length ;
205+ }
206+ tox_log_cb * tox_options_get_log_callback (const Tox_Options * options )
207+ {
208+ return options -> log_callback ;
209+ }
210+ void tox_options_set_log_callback (Tox_Options * options , tox_log_cb * log_callback )
211+ {
212+ options -> log_callback = log_callback ;
213+ }
214+ void * tox_options_get_log_user_data (const Tox_Options * options ) { return options -> log_user_data ; }
215+ void tox_options_set_log_user_data (Tox_Options * options , void * log_user_data )
216+ {
217+ options -> log_user_data = log_user_data ;
218+ }
219+ bool tox_options_get_local_discovery_enabled (const Tox_Options * options )
220+ {
221+ return options -> local_discovery_enabled ;
222+ }
223+ void tox_options_set_local_discovery_enabled (Tox_Options * options , bool local_discovery_enabled )
224+ {
225+ options -> local_discovery_enabled = local_discovery_enabled ;
226+ }
227+ bool tox_options_get_dht_announcements_enabled (const Tox_Options * options )
228+ {
229+ return options -> dht_announcements_enabled ;
230+ }
231+ void tox_options_set_dht_announcements_enabled (Tox_Options * options , bool dht_announcements_enabled )
232+ {
233+ options -> dht_announcements_enabled = dht_announcements_enabled ;
234+ }
235+ bool tox_options_get_experimental_thread_safety (const Tox_Options * options )
236+ {
237+ return options -> experimental_thread_safety ;
238+ }
239+ void tox_options_set_experimental_thread_safety (
240+ Tox_Options * options , bool experimental_thread_safety )
241+ {
242+ options -> experimental_thread_safety = experimental_thread_safety ;
243+ }
244+ const Tox_System * tox_options_get_operating_system (const Tox_Options * options )
245+ {
246+ return options -> operating_system ;
247+ }
248+ void tox_options_set_operating_system (Tox_Options * options , const Tox_System * operating_system )
249+ {
250+ options -> operating_system = operating_system ;
251+ }
252+
253+ const uint8_t * tox_options_get_savedata_data (const Tox_Options * options )
172254{
173255 return options -> savedata_data ;
174256}
175257
176- void tox_options_set_savedata_data (struct Tox_Options * options , const uint8_t * savedata_data , size_t length )
258+ void tox_options_set_savedata_data (Tox_Options * options , const uint8_t * savedata_data , size_t length )
177259{
178260 options -> savedata_data = savedata_data ;
179261 options -> savedata_length = length ;
180262}
181263
182- void tox_options_default (struct Tox_Options * options )
264+ void tox_options_default (Tox_Options * options )
183265{
184266 if (options != nullptr ) {
185- const struct Tox_Options default_options = {0 };
267+ const Tox_Options default_options = {0 };
186268 * options = default_options ;
187269 tox_options_set_ipv6_enabled (options , true);
188270 tox_options_set_udp_enabled (options , true);
@@ -194,9 +276,9 @@ void tox_options_default(struct Tox_Options *options)
194276 }
195277}
196278
197- struct Tox_Options * tox_options_new (Tox_Err_Options_New * error )
279+ Tox_Options * tox_options_new (Tox_Err_Options_New * error )
198280{
199- struct Tox_Options * options = (struct Tox_Options * )calloc (1 , sizeof (struct Tox_Options ));
281+ Tox_Options * options = (Tox_Options * )calloc (1 , sizeof (Tox_Options ));
200282
201283 if (options != nullptr ) {
202284 tox_options_default (options );
@@ -208,7 +290,7 @@ struct Tox_Options *tox_options_new(Tox_Err_Options_New *error)
208290 return nullptr ;
209291}
210292
211- void tox_options_free (struct Tox_Options * options )
293+ void tox_options_free (Tox_Options * options )
212294{
213295 free (options );
214296}
0 commit comments