-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtonclient.h
36 lines (28 loc) · 1004 Bytes
/
tonclient.h
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
#pragma once
#include <stdint.h>
typedef struct {
const char* content;
uint32_t len;
} tc_string_data_t;
typedef struct tc_string_handle_t tc_string_handle_t;
enum tc_response_types_t {
tc_response_success = 0,
tc_response_error = 1,
tc_response_nop = 2,
tc_response_custom = 100,
};
typedef void (*tc_response_handler_t)(uint32_t request_id, tc_string_data_t params_json, uint32_t response_type, bool finished);
tc_string_handle_t* tc_create_context(tc_string_data_t config);
void tc_destroy_context(uint32_t context);
void tc_request(
uint32_t context,
tc_string_data_t function_name,
tc_string_data_t function_params_json,
uint32_t request_id,
tc_response_handler_t response_handler);
tc_string_handle_t* tc_request_sync(
uint32_t context,
tc_string_data_t function_name,
tc_string_data_t function_params_json);
tc_string_data_t tc_read_string(const tc_string_handle_t* handle);
void tc_destroy_string(const tc_string_handle_t* handle);