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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
typedef enum LogLevel LogLevel;
typedef struct ProviderHandle ProviderHandle;
void ;
/**
* Start message listening and stabilization.
*
* # Safety
*
* `provider_ptr` must be NULL or a live ProviderHandle returned by
* `rings_node_new_provider_with_callback`. NULL is logged and ignored. Using a
* handle after `rings_node_provider_destroy` is undefined behavior.
*/
void ;
/**
* Request internal rpc api.
*
* # Safety
*
* `provider_ptr` must be NULL or a live ProviderHandle returned by
* `rings_node_new_provider_with_callback`; `method` and `params` must be valid
* null-terminated UTF-8 strings. Returns NULL when request validation or
* execution fails. Every non-NULL returned string must be released exactly once
* with `rings_node_string_free`.
*/
char *;
/**
* Free a string returned by `rings_node_request`.
*
* Passing NULL is a no-op. Passing any pointer not returned by
* `rings_node_request`, or freeing the same pointer twice, is undefined
* behavior.
*/
void ;
/**
* Destroy a ProviderHandle returned by `rings_node_new_provider_with_callback`.
*
* Passing NULL is a no-op. The pointer is invalid after this call. Do not call
* concurrently with other functions that use the same handle.
*/
void ;
/**
* Craft a new Provider with signer, keeping its stores under `storage_path`.
*
* `storage_path` is a directory the provider owns: it opens the node's stores
* under it as the native daemon does (the DHT data store, the authoritative
* transaction replay store, the retained relay inbox, the onion entry guards
* and the measurement stores). Reusing the path across runs keeps the replay
* windows, held mail and entry guards; a fresh path is a fresh node state.
*
* The provider owns its stores exclusively while it lives: each store locks
* its directory at open (#1039), so a second provider, or a native daemon,
* given a store this provider holds fails to open it, and creation returns
* NULL, instead of interleaving writes with it. The lock is per store:
* providers with distinct roots never conflict.
*
* # Safety
*
* String pointers, `storage_path` included, must be valid null-terminated
* UTF-8 strings, and `signer` must be non-NULL. `signer` receives `(proof,
* out, out_cap)` where `out_cap` is the byte capacity of `out` (96 bytes, the
* widest supported signature). It must write at most `out_cap` signature bytes
* matching `account_type` (65 for `eip191`/`secp256k1`/`bip137`, 64 for
* `ed25519`/`secp256r1`, 96 for `bls12-381`) into `out` and return the number
* of bytes written, or `0` on failure. Returns NULL when provider creation
* fails, a store that cannot be opened or an invalid signature length
* included. The returned handle must be released exactly once with
* `rings_node_provider_destroy`.
*/
struct ProviderHandle *;
/**
* Create a new ProviderHandle from a serialized YAML or JSON ProcessorConfig
* document (including optional `network: { kind, params }` transport
* configuration) and a durable `storage_path`.
*
* # Safety
*
* `serialized_config` and `storage_path` must be valid null-terminated UTF-8
* strings. Returns NULL when configuration parsing or provider creation fails.
* The returned handle must be released exactly once with
* `rings_node_provider_destroy`.
*/
struct ProviderHandle *;