diff options
Diffstat (limited to 'include/libumumble.h')
-rw-r--r-- | include/libumumble.h | 31 |
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 } |