about summary refs log tree commit diff stats
path: root/include/umumble/umumble.h
diff options
context:
space:
mode:
authorlatex <latex@disroot.org>2023-02-11 02:01:21 +0100
committerlatex <latex@disroot.org>2023-02-11 02:01:21 +0100
commit82ca959ff701832e96c869161adc5e179c2201dd (patch)
tree3a819f5b26cfd3703a229eaf2ea187c3fa60a0ef /include/umumble/umumble.h
parent79c59f93b7461082cf4aec3025257560fc788c69 (diff)
downloadlibumumble-82ca959ff701832e96c869161adc5e179c2201dd.tar.gz
restructure include and fix makefiles HEAD master
* restructed include/ to have a umumble folder
* fix the makefile to use the new include structure
* tests makefile now builds inside root build folder
* added TODO list for shit I gotta do
* laid groundwork for packet parsing/packing: mumble_packet_gen_header
Diffstat (limited to 'include/umumble/umumble.h')
-rw-r--r--include/umumble/umumble.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/include/umumble/umumble.h b/include/umumble/umumble.h
new file mode 100644
index 0000000..755be59
--- /dev/null
+++ b/include/umumble/umumble.h
@@ -0,0 +1,49 @@
+#ifndef UMUMBLE_UMUMBLE_H
+#define UMUMBLE_UMUMBLE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include "constants.h"
+
+#include <uv.h>
+#include <tlsuv/tlsuv.h>
+
+typedef struct mumble_ctx_s {
+	int status;
+	int error;
+	uv_loop_t uv_loop;
+	uv_getaddrinfo_t uv_resolver;
+	uv_connect_t uv_connect_req;
+	tlsuv_stream_t tls_stream;
+	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_ctx_close() when you're done!
+ *
+ * \param ctx pointer to the context object to initialize
+ * \return int indicating success
+ * \retval 1 error
+ */
+int mumble_ctx_init(mumble_ctx_t *ctx);
+
+/* 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 close
+*/
+void mumble_ctx_close(mumble_ctx_t *ctx);
+
+int mumble_connect(mumble_ctx_t *ctx, const char *host, int port);
+
+int mumble_run(mumble_ctx_t *ctx);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* UMUMBLE_UMUMBLE_H */