dnscrypto-proxy: Update to release 1.3.0
[tomato.git] / release / src / router / dnscrypt / src / proxy / udp_request_p.h
blobb3125da44472a8cfc4ab181eca8b807db0981cea
2 #ifndef __UDP_REQUEST_H_P__
3 #define __UDP_REQUEST_H_P__ 1
5 #include <sys/types.h>
7 #include <stdint.h>
9 #include <event2/event.h>
11 #include "dnscrypt.h"
12 #include "queue.h"
14 typedef struct UDPRequestStatus_ {
15 _Bool is_dying : 1;
16 _Bool is_in_queue : 1;
17 } UDPRequestStatus;
19 typedef struct UDPRequest_ {
20 uint8_t client_nonce[crypto_box_HALF_NONCEBYTES];
21 TAILQ_ENTRY(UDPRequest_) queue;
22 struct sockaddr_storage client_sockaddr;
23 ProxyContext *proxy_context;
24 struct event *sendto_retry_timer;
25 struct event *timeout_timer;
26 evutil_socket_t client_proxy_handle;
27 ev_socklen_t client_sockaddr_len;
28 UDPRequestStatus status;
29 unsigned char retries;
30 } UDPRequest;
32 typedef struct SendtoWithRetryCtx_ {
33 void (*cb) (UDPRequest *udp_request);
34 const void *buffer;
35 UDPRequest *udp_request;
36 const struct sockaddr *dest_addr;
37 evutil_socket_t handle;
38 size_t length;
39 ev_socklen_t dest_len;
40 int flags;
41 } SendtoWithRetryCtx;
43 #endif