]> git.meshlink.io Git - meshlink/blobdiff - src/meshlink++.h
Add meshlink_get_submesh API
[meshlink] / src / meshlink++.h
index 37ca7e8b4d799281bcf0c86eeb0da1b60a3507af..8f4a9b003427f0c1e13f8c232ec38b60887fb21f 100644 (file)
@@ -327,6 +327,18 @@ public:
                return (node *)meshlink_get_node(handle, name);
        }
 
+       /// Get a handle for a specific submesh.
+       /** This function returns a handle for the submesh with the given name.
+        *
+        *  @param name         The name of the submesh for which a handle is requested.
+        *
+        *  @return             A pointer to a meshlink::submesh which represents the requested submesh,
+        *                      or NULL if the requested submesh does not exist.
+        */
+       submesh *get_submesh(const char *name) {
+               return (submesh *)meshlink_get_submesh(handle, name);
+       }
+
        /// Get a handle for our own node.
        /** This function returns a handle for the local node.
         *
@@ -691,6 +703,30 @@ public:
                return meshlink_channel_send(handle, channel, data, len);
        }
 
+       /// Get the amount of bytes in the send buffer.
+       /** This returns the amount of bytes in the send buffer.
+        *  These bytes have not been received by the peer yet.
+        *
+        *  @param channel      A handle for the channel.
+        *
+        *  @return             The amount of un-ACKed bytes in the send buffer.
+        */
+       size_t channel_get_sendq(channel *channel) {
+               return meshlink_channel_get_sendq(handle, channel);
+       }
+
+       /// Get the amount of bytes in the receive buffer.
+       /** This returns the amount of bytes in the receive buffer.
+        *  These bytes have not been processed by the application yet.
+        *
+        *  @param channel      A handle for the channel.
+        *
+        *  @return             The amount of bytes in the receive buffer.
+        */
+       size_t channel_get_recvq(channel *channel) {
+               return meshlink_channel_get_recvq(handle, channel);
+       }
+
        /// Enable or disable zeroconf discovery of local peers
        /** This controls whether zeroconf discovery using the Catta library will be
         *  enabled to search for peers on the local network. By default, it is enabled.