aboutsummaryrefslogtreecommitdiff
path: root/external/unbound/util/netevent.h
diff options
context:
space:
mode:
Diffstat (limited to 'external/unbound/util/netevent.h')
-rw-r--r--external/unbound/util/netevent.h64
1 files changed, 45 insertions, 19 deletions
diff --git a/external/unbound/util/netevent.h b/external/unbound/util/netevent.h
index 4b87cdba9..cb8eb86b9 100644
--- a/external/unbound/util/netevent.h
+++ b/external/unbound/util/netevent.h
@@ -60,18 +60,20 @@
#ifndef NET_EVENT_H
#define NET_EVENT_H
+#include "dnscrypt/dnscrypt.h"
+
struct sldns_buffer;
struct comm_point;
struct comm_reply;
-struct event_base;
+struct ub_event_base;
/* internal event notification data storage structure. */
struct internal_event;
struct internal_base;
-struct internal_timer;
+struct internal_timer; /* A sub struct of the comm_timer super struct */
/** callback from communication point function type */
-typedef int comm_point_callback_t(struct comm_point*, void*, int,
+typedef int comm_point_callback_type(struct comm_point*, void*, int,
struct comm_reply*);
/** to pass no_error to callback function */
@@ -114,6 +116,13 @@ struct comm_reply {
socklen_t addrlen;
/** return type 0 (none), 4(IP4), 6(IP6) */
int srctype;
+ /* DnsCrypt context */
+#ifdef USE_DNSCRYPT
+ uint8_t client_nonce[crypto_box_HALF_NONCEBYTES];
+ uint8_t nmkey[crypto_box_BEFORENMBYTES];
+ const KeyPair *keypair;
+ int is_dnscrypted;
+#endif
/** the return source interface data */
union {
#ifdef IPV6_PKTINFO
@@ -127,6 +136,8 @@ struct comm_reply {
}
/** variable with return source data */
pktinfo;
+ /** max udp size for udp packets */
+ size_t max_udp_size;
};
/**
@@ -225,9 +236,23 @@ struct comm_point {
So that when that is done the callback is called. */
int tcp_do_toggle_rw;
+ /** timeout in msec for TCP wait times for this connection */
+ int tcp_timeout_msec;
+
/** if set, checks for pending error from nonblocking connect() call.*/
int tcp_check_nb_connect;
+#ifdef USE_MSG_FASTOPEN
+ /** used to track if the sendto() call should be done when using TFO. */
+ int tcp_do_fastopen;
+#endif
+
+#ifdef USE_DNSCRYPT
+ /** Is this a dnscrypt channel */
+ int dnscrypt;
+ /** encrypted buffer pointer. Either to perthread, or own buffer or NULL */
+ struct sldns_buffer* dnscrypt_buffer;
+#endif
/** number of queries outstanding on this socket, used by
* outside network for udp ports */
int inuse;
@@ -256,7 +281,7 @@ struct comm_point {
For UDP this is done without changing the commpoint.
In TCP it sets write state.
*/
- comm_point_callback_t* callback;
+ comm_point_callback_type* callback;
/** argument to pass to callback. */
void *cb_arg;
};
@@ -265,7 +290,7 @@ struct comm_point {
* Structure only for making timeout events.
*/
struct comm_timer {
- /** the internal event stuff */
+ /** the internal event stuff (derived) */
struct internal_timer* ev_timer;
/** callback function, takes user arg only */
@@ -301,12 +326,12 @@ struct comm_signal {
struct comm_base* comm_base_create(int sigs);
/**
- * Create comm base that uses the given event_base (underlying event
- * mechanism pointer).
- * @param base: underlying lib event base.
+ * Create comm base that uses the given ub_event_base (underlying pluggable
+ * event mechanism pointer).
+ * @param base: underlying pluggable event base.
* @return: the new comm base. NULL on error.
*/
-struct comm_base* comm_base_create_event(struct event_base* base);
+struct comm_base* comm_base_create_event(struct ub_event_base* base);
/**
* Delete comm base structure but not the underlying lib event base.
@@ -357,9 +382,9 @@ void comm_base_set_slow_accept_handlers(struct comm_base* b,
/**
* Access internal data structure (for util/tube.c on windows)
* @param b: comm base
- * @return event_base. Could be libevent, or internal event handler.
+ * @return ub_event_base.
*/
-struct event_base* comm_base_internal(struct comm_base* b);
+struct ub_event_base* comm_base_internal(struct comm_base* b);
/**
* Create an UDP comm point. Calls malloc.
@@ -374,7 +399,7 @@ struct event_base* comm_base_internal(struct comm_base* b);
*/
struct comm_point* comm_point_create_udp(struct comm_base* base,
int fd, struct sldns_buffer* buffer,
- comm_point_callback_t* callback, void* callback_arg);
+ comm_point_callback_type* callback, void* callback_arg);
/**
* Create an UDP with ancillary data comm point. Calls malloc.
@@ -390,7 +415,7 @@ struct comm_point* comm_point_create_udp(struct comm_base* base,
*/
struct comm_point* comm_point_create_udp_ancil(struct comm_base* base,
int fd, struct sldns_buffer* buffer,
- comm_point_callback_t* callback, void* callback_arg);
+ comm_point_callback_type* callback, void* callback_arg);
/**
* Create a TCP listener comm point. Calls malloc.
@@ -411,7 +436,7 @@ struct comm_point* comm_point_create_udp_ancil(struct comm_base* base,
*/
struct comm_point* comm_point_create_tcp(struct comm_base* base,
int fd, int num, size_t bufsize,
- comm_point_callback_t* callback, void* callback_arg);
+ comm_point_callback_type* callback, void* callback_arg);
/**
* Create an outgoing TCP commpoint. No file descriptor is opened, left at -1.
@@ -422,7 +447,7 @@ struct comm_point* comm_point_create_tcp(struct comm_base* base,
* @return: the commpoint or NULL on error.
*/
struct comm_point* comm_point_create_tcp_out(struct comm_base* base,
- size_t bufsize, comm_point_callback_t* callback, void* callback_arg);
+ size_t bufsize, comm_point_callback_type* callback, void* callback_arg);
/**
* Create commpoint to listen to a local domain file descriptor.
@@ -435,7 +460,7 @@ struct comm_point* comm_point_create_tcp_out(struct comm_base* base,
*/
struct comm_point* comm_point_create_local(struct comm_base* base,
int fd, size_t bufsize,
- comm_point_callback_t* callback, void* callback_arg);
+ comm_point_callback_type* callback, void* callback_arg);
/**
* Create commpoint to listen to a local domain pipe descriptor.
@@ -448,7 +473,7 @@ struct comm_point* comm_point_create_local(struct comm_base* base,
*/
struct comm_point* comm_point_create_raw(struct comm_base* base,
int fd, int writing,
- comm_point_callback_t* callback, void* callback_arg);
+ comm_point_callback_type* callback, void* callback_arg);
/**
* Close a comm point fd.
@@ -496,9 +521,10 @@ void comm_point_stop_listening(struct comm_point* c);
* Start listening again for input on the comm point.
* @param c: commpoint to enable again.
* @param newfd: new fd, or -1 to leave fd be.
- * @param sec: timeout in seconds, or -1 for no (change to the) timeout.
+ * @param msec: timeout in milliseconds, or -1 for no (change to the) timeout.
+ * So seconds*1000.
*/
-void comm_point_start_listening(struct comm_point* c, int newfd, int sec);
+void comm_point_start_listening(struct comm_point* c, int newfd, int msec);
/**
* Stop listening and start listening again for reading or writing.