protocol uint/magnolia / include / mcproto / mcproto.h
 1#ifndef MCPROTO_H
 2#define MCPROTO_H
 3
 4#include <stddef.h>
 5
 6#include "types.h"
 7
 8#define MC_PROTOCOL_1_8_9 47
 9
10typedef struct MCClient MCClient;
11
12typedef struct {
13	const char* username;
14	const char* profile_uuid;
15	const char* access_token;
16} MCAccount;
17
18typedef struct {
19	i32    id;
20	u8*    data;
21	size_t size;
22} MCPacket;
23
24int  mc_client_login(MCClient** out, const char* address, const MCAccount* account, char* error,
25                     size_t error_size);
26void mc_client_interrupt(MCClient* client);
27void mc_client_destroy(MCClient* client);
28
29int  mc_client_read(MCClient* client, MCPacket* packet, char* error, size_t error_size);
30int  mc_client_write(MCClient* client, i32 packet_id, const void* data, size_t size);
31void mc_packet_free(MCPacket* packet);
32
33const char* mc_client_username(const MCClient* client);
34const char* mc_client_uuid(const MCClient* client);
35
36#endif /* MCPROTO_H */