summaryrefslogtreecommitdiffstats
path: root/src/lib.rs
blob: 8bdb2271da3e3a490f8c581cf17296ce38c3c73f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use libc::{c_char, c_double, c_int, c_longlong};

// https://doc.rust-lang.org/nomicon/ffi.html#representing-opaque-structs
#[repr(C)]
pub struct TdLibRawPtr {
    _private: [u8; 0],
}

#[link(name = "tdjson")]
extern "C" {
    pub fn td_json_client_create() -> *mut TdLibRawPtr;
    pub fn td_json_client_send(client: *mut TdLibRawPtr, request: *const c_char);
    pub fn td_json_client_receive(client: *mut TdLibRawPtr, timeout: c_double) -> *mut c_char;
    pub fn td_json_client_execute(client: *mut TdLibRawPtr, request: *const c_char) -> *mut c_char;
    pub fn td_json_client_destroy(client: *mut TdLibRawPtr);

    pub fn td_set_log_verbosity_level(level: c_int);
    pub fn td_set_log_file_path(path: *const c_char) -> c_int;
    pub fn td_set_log_max_file_size(size: c_longlong);
}