summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2020-04-09 21:33:34 +0000
committeriphydf <iphydf@users.noreply.github.com>2020-04-09 21:33:34 +0000
commitb816c6f8e3ced0f65f3f749e9e6ecb0edd313628 (patch)
treee7765cdf813ced8ab7629ec60c58b264826c5caa
parentaf6e27bbf1b447e6e85520b965f009b7ece81004 (diff)
Stop using the "inline namespace" feature of apidsl.
This adds complexity for very little value.
-rw-r--r--toxcore/tox.api.h97
-rw-r--r--toxcore/tox.h28
2 files changed, 63 insertions, 62 deletions
diff --git a/toxcore/tox.api.h b/toxcore/tox.api.h
index 87c3219a..fcd43f7a 100644
--- a/toxcore/tox.api.h
+++ b/toxcore/tox.api.h
@@ -854,7 +854,7 @@ enum class CONNECTION {
854} 854}
855 855
856 856
857inline namespace self { 857namespace self {
858 858
859 CONNECTION connection_status { 859 CONNECTION connection_status {
860 /** 860 /**
@@ -908,7 +908,7 @@ void iterate(any user_data);
908 ******************************************************************************/ 908 ******************************************************************************/
909 909
910 910
911inline namespace self { 911namespace self {
912 912
913 uint8_t[ADDRESS_SIZE] address { 913 uint8_t[ADDRESS_SIZE] address {
914 /** 914 /**
@@ -986,7 +986,7 @@ error for set_info {
986} 986}
987 987
988 988
989inline namespace self { 989namespace self {
990 990
991 uint8_t[length <= MAX_NAME_LENGTH] name { 991 uint8_t[length <= MAX_NAME_LENGTH] name {
992 /** 992 /**
@@ -1226,7 +1226,7 @@ namespace friend {
1226 1226
1227} 1227}
1228 1228
1229inline namespace self { 1229namespace self {
1230 1230
1231 uint32_t[size] friend_list { 1231 uint32_t[size] friend_list {
1232 /** 1232 /**
@@ -1514,8 +1514,14 @@ namespace friend {
1514 * 1514 *
1515 ******************************************************************************/ 1515 ******************************************************************************/
1516 1516
1517error for set_typing {
1518 /**
1519 * The friend number did not designate a valid friend.
1520 */
1521 FRIEND_NOT_FOUND,
1522}
1517 1523
1518inline namespace self { 1524namespace self {
1519 1525
1520 bool typing { 1526 bool typing {
1521 /** 1527 /**
@@ -1528,12 +1534,7 @@ inline namespace self {
1528 * 1534 *
1529 * @return true on success. 1535 * @return true on success.
1530 */ 1536 */
1531 set(uint32_t friend_number) { 1537 set(uint32_t friend_number) with error for set_typing;
1532 /**
1533 * The friend number did not designate a valid friend.
1534 */
1535 FRIEND_NOT_FOUND,
1536 }
1537 } 1538 }
1538 1539
1539} 1540}
@@ -2655,36 +2656,36 @@ namespace conference {
2655 2656
2656namespace friend { 2657namespace friend {
2657 2658
2658 inline namespace send { 2659 error for custom_packet {
2660 NULL,
2661 /**
2662 * The friend number did not designate a valid friend.
2663 */
2664 FRIEND_NOT_FOUND,
2665 /**
2666 * This client is currently not connected to the friend.
2667 */
2668 FRIEND_NOT_CONNECTED,
2669 /**
2670 * The first byte of data was not in the specified range for the packet type.
2671 * This range is 200-254 for lossy, and 160-191 for lossless packets.
2672 */
2673 INVALID,
2674 /**
2675 * Attempted to send an empty packet.
2676 */
2677 EMPTY,
2678 /**
2679 * Packet data length exceeded $MAX_CUSTOM_PACKET_SIZE.
2680 */
2681 TOO_LONG,
2682 /**
2683 * Packet queue is full.
2684 */
2685 SENDQ,
2686 }
2659 2687
2660 error for custom_packet { 2688 namespace send {
2661 NULL,
2662 /**
2663 * The friend number did not designate a valid friend.
2664 */
2665 FRIEND_NOT_FOUND,
2666 /**
2667 * This client is currently not connected to the friend.
2668 */
2669 FRIEND_NOT_CONNECTED,
2670 /**
2671 * The first byte of data was not in the specified range for the packet type.
2672 * This range is 200-254 for lossy, and 160-191 for lossless packets.
2673 */
2674 INVALID,
2675 /**
2676 * Attempted to send an empty packet.
2677 */
2678 EMPTY,
2679 /**
2680 * Packet data length exceeded $MAX_CUSTOM_PACKET_SIZE.
2681 */
2682 TOO_LONG,
2683 /**
2684 * Packet queue is full.
2685 */
2686 SENDQ,
2687 }
2688 2689
2689 /** 2690 /**
2690 * Send a custom lossy packet to a friend. 2691 * Send a custom lossy packet to a friend.
@@ -2762,7 +2763,14 @@ namespace friend {
2762 ******************************************************************************/ 2763 ******************************************************************************/
2763 2764
2764 2765
2765inline namespace self { 2766error for get_port {
2767 /**
2768 * The instance was not bound to any port.
2769 */
2770 NOT_BOUND,
2771}
2772
2773namespace self {
2766 2774
2767 uint8_t[PUBLIC_KEY_SIZE] dht_id { 2775 uint8_t[PUBLIC_KEY_SIZE] dht_id {
2768 /** 2776 /**
@@ -2781,13 +2789,6 @@ inline namespace self {
2781 } 2789 }
2782 2790
2783 2791
2784 error for get_port {
2785 /**
2786 * The instance was not bound to any port.
2787 */
2788 NOT_BOUND,
2789 }
2790
2791 2792
2792 uint16_t udp_port { 2793 uint16_t udp_port {
2793 /** 2794 /**
diff --git a/toxcore/tox.h b/toxcore/tox.h
index fd57e20d..dc873f3b 100644
--- a/toxcore/tox.h
+++ b/toxcore/tox.h
@@ -3168,20 +3168,6 @@ void tox_callback_friend_lossless_packet(Tox *tox, tox_friend_lossless_packet_cb
3168 3168
3169 3169
3170 3170
3171/**
3172 * Writes the temporary DHT public key of this instance to a byte array.
3173 *
3174 * This can be used in combination with an externally accessible IP address and
3175 * the bound port (from tox_self_get_udp_port) to run a temporary bootstrap node.
3176 *
3177 * Be aware that every time a new instance is created, the DHT public key
3178 * changes, meaning this cannot be used to run a permanent bootstrap node.
3179 *
3180 * @param dht_id A memory region of at least TOX_PUBLIC_KEY_SIZE bytes. If this
3181 * parameter is NULL, this function has no effect.
3182 */
3183void tox_self_get_dht_id(const Tox *tox, uint8_t *dht_id);
3184
3185typedef enum TOX_ERR_GET_PORT { 3171typedef enum TOX_ERR_GET_PORT {
3186 3172
3187 /** 3173 /**
@@ -3198,6 +3184,20 @@ typedef enum TOX_ERR_GET_PORT {
3198 3184
3199 3185
3200/** 3186/**
3187 * Writes the temporary DHT public key of this instance to a byte array.
3188 *
3189 * This can be used in combination with an externally accessible IP address and
3190 * the bound port (from tox_self_get_udp_port) to run a temporary bootstrap node.
3191 *
3192 * Be aware that every time a new instance is created, the DHT public key
3193 * changes, meaning this cannot be used to run a permanent bootstrap node.
3194 *
3195 * @param dht_id A memory region of at least TOX_PUBLIC_KEY_SIZE bytes. If this
3196 * parameter is NULL, this function has no effect.
3197 */
3198void tox_self_get_dht_id(const Tox *tox, uint8_t *dht_id);
3199
3200/**
3201 * Return the UDP port this Tox instance is bound to. 3201 * Return the UDP port this Tox instance is bound to.
3202 */ 3202 */
3203uint16_t tox_self_get_udp_port(const Tox *tox, TOX_ERR_GET_PORT *error); 3203uint16_t tox_self_get_udp_port(const Tox *tox, TOX_ERR_GET_PORT *error);