aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorlatex <latex@disroot.org>2023-01-29 18:17:44 +0100
committerlatex <latex@disroot.org>2023-01-29 18:17:44 +0100
commit2ed3e247d3e5040eedb8a845e1d5ca8744a65436 (patch)
tree4fa8b06c12e6521b8e57e2e2b4954427bb63a585 /include
parent00ab224d50784df9672b7947b48ef7a9f46f0066 (diff)
downloadlibumumble-2ed3e247d3e5040eedb8a845e1d5ca8744a65436.tar.gz
add mumble_connect to connect to TCP
Diffstat (limited to 'include')
-rw-r--r--include/libumumble.h31
1 files changed, 24 insertions, 7 deletions
diff --git a/include/libumumble.h b/include/libumumble.h
index 3a66099..7bd03b3 100644
--- a/include/libumumble.h
+++ b/include/libumumble.h
@@ -7,25 +7,42 @@ extern "C" {
#include <uv.h>
+enum mumble_ctx_status {
+ UNINITIALIZED = 0,
+ READY,
+ CONNECTING,
+ CONNECTED,
+ DISCONNECTED
+};
+
typedef struct mumble_ctx {
+ enum mumble_ctx_status status;
+ int error;
uv_loop_t uv_loop;
+ uv_getaddrinfo_t uv_resolver;
+ uv_connect_t uv_connect_req;
+ uv_tcp_t uv_tcp_socket;
} mumble_ctx_t;
/* Initializes a mumble context object.
* This function will allocate initial memory needed for storing e.g. the channel layout.
- * Make sure to call mumble_free_ctx() when you're done!
+ * Make sure to call mumble_ctx_close() when you're done!
*
- * \param ctx pointer to the context object to initialize.
+ * \param ctx pointer to the context object to initialize
* \return int indicating success
* \retval 1 error
*/
-int mumble_init_ctx(mumble_ctx_t *ctx);
+int mumble_ctx_init(mumble_ctx_t *ctx);
-/* Free a mumble context.
+/* Closes a mumble context, deallocating internal objects used by the context.
+ * This function does not free the memory possibly used to allocate the ctx object.
+ * If you stored ctx in dynamic memory, make sure to call free(ctx) after calling this function.
*
- * \param ctx pointer to the context object to free.
- */
-void mumble_free_ctx(mumble_ctx_t *ctx);
+ * \param ctx pointer to the context object to close
+*/
+void mumble_ctx_close(mumble_ctx_t *ctx);
+
+int mumble_connect(mumble_ctx_t *ctx, const char *address, const unsigned short port);
#ifdef __cplusplus
}