-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathclient.h
50 lines (41 loc) · 1.34 KB
/
client.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
//
// Created by s.fionov on 02.04.18.
//
#ifndef DNS_OVER_HTTPS_CLIENT_DOH_CLIENT_H
#define DNS_OVER_HTTPS_CLIENT_DOH_CLIENT_H
#include <netinet/in.h>
#include <arpa/inet.h>
#include <nghttp2/nghttp2.h>
#include <mbedtls/ssl.h>
#include <mbedtls/entropy.h>
#include <mbedtls/ctr_drbg.h>
#include "stamp.h"
typedef ssize_t (*send_reply_fn)(void *arg, const void *msg, size_t msglen, const struct sockaddr *sa, socklen_t salen);
typedef struct doh_request doh_request_t;
typedef struct {
int fd;
int ssl_connected;
int ssl_pin_verified;
mbedtls_ssl_context ssl;
mbedtls_entropy_context entropy;
mbedtls_ctr_drbg_context ctr_drbg;
mbedtls_ssl_config conf;
mbedtls_x509_crt crt;
short events;
nghttp2_session *session;
doh_request_t *deferred_req;
dns_stamp_t *dns_stamp;
send_reply_fn send_reply;
void *send_reply_arg;
} doh_client_t;
int doh_client_init(doh_client_t *client, dns_stamp_t *dns_stamp, send_reply_fn send, void *arg);
int doh_client_connect(doh_client_t *client);
void doh_client_reset_session(doh_client_t *client);
void doh_client_deinit(doh_client_t *cctx);
//
//void doh_client_init(doh_client_ctx_t *cctx);
//
//void doh_client_ctx_deinit(doh_client_ctx_t *cctx);
//
//void doh_client_connect(doh_client_ctx_t *cctx, char *url, char *path);
#endif //DNS_OVER_HTTPS_CLIENT_DOH_CLIENT_H