blob: 43ba3ece8f1d8e357ccc517f1ddb8c24cc21c37b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#ifndef LIBUMUMBLE_H
#define LIBUMUMBLE_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <uv.h>
#include <tlsuv/tlsuv.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;
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 /* LIBUMUMBLE_H */
|