-
Notifications
You must be signed in to change notification settings - Fork 5
/
aergo-int.h
74 lines (57 loc) · 1.5 KB
/
aergo-int.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
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
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#ifdef WIN32
#include <windows.h>
#elif _POSIX_C_SOURCE >= 199309L
#include <time.h> // for nanosleep
#else
#include <unistd.h> // for usleep
#endif
#include <curl/curl.h>
#include "secp256k1-vrf.h"
#ifdef _WIN32
#define EXPORTED __declspec(dllexport)
#else
#define EXPORTED __attribute__((visibility("default")))
#endif
typedef struct request request;
typedef bool (*process_response_cb)(aergo *instance, request *request);
struct request {
struct request *next;
aergo *instance;
void *data;
int size;
struct aergo_account *account;
char txn_hash[32];
void *callback;
void *arg;
void *return_ptr;
int return_size;
process_response_cb process_response;
process_response_cb process_error;
char *response;
int response_size;
int remaining_size;
int received;
bool processed;
bool success;
char *error_msg;
bool keep_active;
};
// Aergo connection instance
struct aergo {
char host[32];
int port;
secp256k1_context *ecdsa;
uint8_t blockchain_id_hash[32];
int timeout;
request *requests;
CURLM *multi;
int transfers; // num_requests
};
static request * new_request(aergo *instance);
void free_request(aergo *instance, struct request *request);
uint32_t encode_http2_data_frame(uint8_t *buffer, uint32_t content_size);
static bool aergo_get_receipt__int(aergo *instance, const char *txn_hash, transaction_receipt_cb cb, void *arg, struct transaction_receipt *receipt, bool retry_on_failure);