"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xfrd-tcp.h" between
nsd-4.3.6.tar.gz and nsd-4.3.7.tar.gz

About: NSD is an authoritative only, high performance, simple name server daemon.

xfrd-tcp.h  (nsd-4.3.6):xfrd-tcp.h  (nsd-4.3.7)
skipping to change at line 14 skipping to change at line 14
* Copyright (c) 2001-2006, NLnet Labs. All rights reserved. * Copyright (c) 2001-2006, NLnet Labs. All rights reserved.
* *
* See LICENSE for the license. * See LICENSE for the license.
* *
*/ */
#ifndef XFRD_TCP_H #ifndef XFRD_TCP_H
#define XFRD_TCP_H #define XFRD_TCP_H
#include "xfrd.h" #include "xfrd.h"
#ifdef HAVE_TLS_1_3
#include <openssl/ssl.h>
#endif
struct buffer; struct buffer;
struct xfrd_zone; struct xfrd_zone;
struct xfrd_soa; struct xfrd_soa;
struct xfrd_state; struct xfrd_state;
struct region; struct region;
struct dname; struct dname;
struct acl_options; struct acl_options;
struct xfrd_tcp_pipeline; struct xfrd_tcp_pipeline;
skipping to change at line 38 skipping to change at line 41
*/ */
struct xfrd_tcp_set { struct xfrd_tcp_set {
/* tcp connections, each has packet and read/wr state */ /* tcp connections, each has packet and read/wr state */
struct xfrd_tcp_pipeline *tcp_state[XFRD_MAX_TCP]; struct xfrd_tcp_pipeline *tcp_state[XFRD_MAX_TCP];
/* number of TCP connections in use. */ /* number of TCP connections in use. */
int tcp_count; int tcp_count;
/* TCP timeout. */ /* TCP timeout. */
int tcp_timeout; int tcp_timeout;
/* rbtree with pipelines sorted by master */ /* rbtree with pipelines sorted by master */
rbtree_type* pipetree; rbtree_type* pipetree;
#ifdef HAVE_TLS_1_3
/* XoT: SSL context */
SSL_CTX* ssl_ctx;
#endif
/* double linked list of zones waiting for a TCP connection */ /* double linked list of zones waiting for a TCP connection */
struct xfrd_zone *tcp_waiting_first, *tcp_waiting_last; struct xfrd_zone *tcp_waiting_first, *tcp_waiting_last;
}; };
/* /*
* Structure to keep track of an open tcp connection * Structure to keep track of an open tcp connection
* The xfrd tcp connection is used to first make a request * The xfrd tcp connection is used to first make a request
* Then to receive the answer packet(s). * Then to receive the answer packet(s).
*/ */
struct xfrd_tcp { struct xfrd_tcp {
skipping to change at line 73 skipping to change at line 80
struct buffer* packet; struct buffer* packet;
}; };
/* use illegal pointer value to denote skipped ID number. /* use illegal pointer value to denote skipped ID number.
* if this does not work, we can allocate with malloc */ * if this does not work, we can allocate with malloc */
#define TCP_NULL_SKIP ((struct xfrd_zone*)-1) #define TCP_NULL_SKIP ((struct xfrd_zone*)-1)
/* the number of ID values (16 bits) for a pipeline */ /* the number of ID values (16 bits) for a pipeline */
#define ID_PIPE_NUM 65536 #define ID_PIPE_NUM 65536
/** /**
* Structure to keep track of a pipelined set of queries on * The tcp pipeline key structure. By ip_len, ip, num_unused and unique by
* an open tcp connection. The queries may be answered with * pointer value.
* interleaved answer packets, the ID number disambiguates.
* Sorted by the master IP address so you can use lookup with
* smaller-or-equal to find the tcp connection most suitable.
*/ */
struct xfrd_tcp_pipeline { struct xfrd_tcp_pipeline_key {
/* the rbtree node, sorted by IP and nr of unused queries */ /* the rbtree node, sorted by IP and nr of unused queries */
rbnode_type node; rbnode_type node;
/* destination IP address */ /* destination IP address */
#ifdef INET6 #ifdef INET6
struct sockaddr_storage ip; struct sockaddr_storage ip;
#else #else
struct sockaddr_in ip; struct sockaddr_in ip;
#endif /* INET6 */ #endif /* INET6 */
socklen_t ip_len; socklen_t ip_len;
/* number of unused IDs. used IDs are waiting to send their query, /* number of unused IDs. used IDs are waiting to send their query,
* or have been sent but not not all answer packets have been received. * or have been sent but not not all answer packets have been received.
* Sorted by num_unused, so a lookup smaller-equal for 65536 finds the * Sorted by num_unused, so a lookup smaller-equal for 65536 finds the
* connection to that master that has the most free IDs. */ * connection to that master that has the most free IDs. */
int num_unused; int num_unused;
/* number of skip-set IDs (these are 'in-use') */ /* number of skip-set IDs (these are 'in-use') */
int num_skip; int num_skip;
};
/**
* Structure to keep track of a pipelined set of queries on
* an open tcp connection. The queries may be answered with
* interleaved answer packets, the ID number disambiguates.
* Sorted by the master IP address so you can use lookup with
* smaller-or-equal to find the tcp connection most suitable.
*/
struct xfrd_tcp_pipeline {
/* the key information for the tcp pipeline, in its own
* struct so it can be referenced on its own for comparison funcs */
struct xfrd_tcp_pipeline_key key;
int handler_added; int handler_added;
/* the event handler for this pipe (it'll disambiguate by ID) */ /* the event handler for this pipe (it'll disambiguate by ID) */
struct event handler; struct event handler;
/* the tcp connection to use for reading */ /* the tcp connection to use for reading */
struct xfrd_tcp* tcp_r; struct xfrd_tcp* tcp_r;
/* the tcp connection to use for writing, if it is done successfully, /* the tcp connection to use for writing, if it is done successfully,
* then the first zone from the sendlist can be removed. */ * then the first zone from the sendlist can be removed. */
struct xfrd_tcp* tcp_w; struct xfrd_tcp* tcp_w;
/* once a byte has been written, handshake complete */ /* once a byte has been written, handshake complete */
int connection_established; int connection_established;
#ifdef HAVE_TLS_1_3
/* XoT: SSL object */
SSL *ssl;
/* XoT: if SSL handshake is not done, handshake_want indicates the
* last error. This may be SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE
* when the handshake is still in progress.
*/
int handshake_want;
/* XoT: 1 if the SSL handshake has succeeded, 0 otherwise */
int handshake_done;
#endif
/* list of queries that want to send, first to get write event, /* list of queries that want to send, first to get write event,
* if NULL, no write event interest */ * if NULL, no write event interest */
struct xfrd_zone* tcp_send_first, *tcp_send_last; struct xfrd_zone* tcp_send_first, *tcp_send_last;
/* the unused and id arrays must be last in the structure */ /* the unused and id arrays must be last in the structure */
/* per-ID number the queries that have this ID number, every /* per-ID number the queries that have this ID number, every
* query owns one ID numbers (until it is done). NULL: unused * query owns one ID numbers (until it is done). NULL: unused
* When a query is done but not all answer-packets have been * When a query is done but not all answer-packets have been
* consumed for that ID number, the rest is skipped, this * consumed for that ID number, the rest is skipped, this
* is denoted with the pointer-value TCP_NULL_SKIP, the ids that * is denoted with the pointer-value TCP_NULL_SKIP, the ids that
* are skipped are not on the unused list. They may be * are skipped are not on the unused list. They may be
* removed once the last answer packet is skipped. * removed once the last answer packet is skipped.
* ID_PIPE_NUM-num_unused values in the id array are nonNULL (either * ID_PIPE_NUM-num_unused values in the id array are nonNULL (either
* a zone pointer or SKIP) */ * a zone pointer or SKIP) */
struct xfrd_zone* id[ID_PIPE_NUM]; struct xfrd_zone* id[ID_PIPE_NUM];
/* unused ID numbers; the first part of the array contains the IDs */ /* unused ID numbers; the first part of the array contains the IDs */
uint16_t unused[ID_PIPE_NUM]; uint16_t unused[ID_PIPE_NUM];
}; };
/* create set of tcp connections */ /* create set of tcp connections */
struct xfrd_tcp_set* xfrd_tcp_set_create(struct region* region); struct xfrd_tcp_set* xfrd_tcp_set_create(struct region* region, const char *tls_ cert_bundle);
/* init tcp state */ /* init tcp state */
struct xfrd_tcp* xfrd_tcp_create(struct region* region, size_t bufsize); struct xfrd_tcp* xfrd_tcp_create(struct region* region, size_t bufsize);
/* obtain tcp connection for a zone (or wait) */ /* obtain tcp connection for a zone (or wait) */
void xfrd_tcp_obtain(struct xfrd_tcp_set* set, struct xfrd_zone* zone); void xfrd_tcp_obtain(struct xfrd_tcp_set* set, struct xfrd_zone* zone);
/* release tcp connection for a zone (starts waiting) */ /* release tcp connection for a zone (starts waiting) */
void xfrd_tcp_release(struct xfrd_tcp_set* set, struct xfrd_zone* zone); void xfrd_tcp_release(struct xfrd_tcp_set* set, struct xfrd_zone* zone);
/* release tcp pipe entirely (does not stop the zones inside it) */ /* release tcp pipe entirely (does not stop the zones inside it) */
void xfrd_tcp_pipe_release(struct xfrd_tcp_set* set, void xfrd_tcp_pipe_release(struct xfrd_tcp_set* set,
struct xfrd_tcp_pipeline* tp, int conn); struct xfrd_tcp_pipeline* tp, int conn);
 End of changes. 7 change blocks. 
7 lines changed or deleted 35 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)