diff options
Diffstat (limited to 'other/apidsl/tox.in.h')
-rw-r--r-- | other/apidsl/tox.in.h | 57 |
1 files changed, 42 insertions, 15 deletions
diff --git a/other/apidsl/tox.in.h b/other/apidsl/tox.in.h index dd47df23..30c78e44 100644 --- a/other/apidsl/tox.in.h +++ b/other/apidsl/tox.in.h | |||
@@ -340,6 +340,24 @@ enum class PROXY_TYPE { | |||
340 | SOCKS5, | 340 | SOCKS5, |
341 | } | 341 | } |
342 | 342 | ||
343 | /** | ||
344 | * Type of savedata to create the Tox instance from. | ||
345 | */ | ||
346 | enum class SAVEDATA_TYPE { | ||
347 | /** | ||
348 | * No savedata. | ||
349 | */ | ||
350 | NONE, | ||
351 | /** | ||
352 | * Savedata is one that was obtained from ${savedata.get} | ||
353 | */ | ||
354 | TOX_SAVE, | ||
355 | /** | ||
356 | * Savedata is a secret key of length ${SECRET_KEY_SIZE} | ||
357 | */ | ||
358 | SECRET_KEY, | ||
359 | } | ||
360 | |||
343 | 361 | ||
344 | static class options { | 362 | static class options { |
345 | /** | 363 | /** |
@@ -416,6 +434,23 @@ static class options { | |||
416 | * The port to use for the TCP server. If 0, the tcp server is disabled. | 434 | * The port to use for the TCP server. If 0, the tcp server is disabled. |
417 | */ | 435 | */ |
418 | uint16_t tcp_port; | 436 | uint16_t tcp_port; |
437 | |||
438 | namespace savedata { | ||
439 | /** | ||
440 | * The type of savedata to load from. | ||
441 | */ | ||
442 | SAVEDATA_TYPE type; | ||
443 | |||
444 | /** | ||
445 | * The savedata. | ||
446 | */ | ||
447 | const uint8_t[length] data; | ||
448 | |||
449 | /** | ||
450 | * The length of the savedata. | ||
451 | */ | ||
452 | size_t length; | ||
453 | } | ||
419 | } | 454 | } |
420 | 455 | ||
421 | 456 | ||
@@ -474,21 +509,17 @@ static class options { | |||
474 | * This function will bring the instance into a valid state. Running the event | 509 | * This function will bring the instance into a valid state. Running the event |
475 | * loop with a new instance will operate correctly. | 510 | * loop with a new instance will operate correctly. |
476 | * | 511 | * |
477 | * If the data parameter is not NULL, this function will load the Tox instance | ||
478 | * from a byte array previously filled by ${savedata.get}. | ||
479 | * | ||
480 | * If loading failed or succeeded only partially, the new or partially loaded | 512 | * If loading failed or succeeded only partially, the new or partially loaded |
481 | * instance is returned and an error code is set. | 513 | * instance is returned and an error code is set. |
482 | * | 514 | * |
483 | * @param options An options object as described above. If this parameter is | 515 | * @param options An options object as described above. If this parameter is |
484 | * NULL, the default options are used. | 516 | * NULL, the default options are used. |
485 | * @param data A byte array containing data previously stored by ${savedata.get}. | ||
486 | * @param length The length of the byte array data. If this parameter is 0, the | ||
487 | * data parameter is ignored. | ||
488 | * | 517 | * |
489 | * @see $iterate for the event loop. | 518 | * @see $iterate for the event loop. |
519 | * | ||
520 | * @return A new Tox instance pointer on success or NULL on failure. | ||
490 | */ | 521 | */ |
491 | static this new(const options_t *options, const uint8_t[length] data) { | 522 | static this new(const options_t *options) { |
492 | NULL, | 523 | NULL, |
493 | /** | 524 | /** |
494 | * The function was unable to allocate enough memory to store the internal | 525 | * The function was unable to allocate enough memory to store the internal |
@@ -580,13 +611,8 @@ uint8_t[size] savedata { | |||
580 | * Sends a "get nodes" request to the given bootstrap node with IP, port, and | 611 | * Sends a "get nodes" request to the given bootstrap node with IP, port, and |
581 | * public key to setup connections. | 612 | * public key to setup connections. |
582 | * | 613 | * |
583 | * This function will attempt to connect to the node using UDP and TCP at the | 614 | * This function will attempt to connect to the node using UDP. You must use |
584 | * same time. | 615 | * this function even if ${options.this.udp_enabled} was set to false. |
585 | * | ||
586 | * Tox will use the node as a TCP relay in case ${options.this.udp_enabled} was | ||
587 | * false, and also to connect to friends that are in TCP-only mode. Tox will | ||
588 | * also use the TCP connection when NAT hole punching is slow, and later switch | ||
589 | * to UDP if hole punching succeeds. | ||
590 | * | 616 | * |
591 | * @param address The hostname or IP address (IPv4 or IPv6) of the node. | 617 | * @param address The hostname or IP address (IPv4 or IPv6) of the node. |
592 | * @param port The port on the host on which the bootstrap Tox instance is | 618 | * @param port The port on the host on which the bootstrap Tox instance is |
@@ -1481,7 +1507,7 @@ namespace file { | |||
1481 | */ | 1507 | */ |
1482 | DATA, | 1508 | DATA, |
1483 | /** | 1509 | /** |
1484 | * Avatar filename. This consists of $hash(image). | 1510 | * Avatar file_id. This consists of $hash(image). |
1485 | * Avatar data. This consists of the image data. | 1511 | * Avatar data. This consists of the image data. |
1486 | * | 1512 | * |
1487 | * Avatars can be sent at any time the client wishes. Generally, a client will | 1513 | * Avatars can be sent at any time the client wishes. Generally, a client will |
@@ -1625,6 +1651,7 @@ namespace file { | |||
1625 | 1651 | ||
1626 | 1652 | ||
1627 | error for get { | 1653 | error for get { |
1654 | NULL, | ||
1628 | /** | 1655 | /** |
1629 | * The friend_number passed did not designate a valid friend. | 1656 | * The friend_number passed did not designate a valid friend. |
1630 | */ | 1657 | */ |