diff options
author | Cy Schubert <cy@FreeBSD.org> | 2020-11-28 18:09:16 +0000 |
---|---|---|
committer | Cy Schubert <cy@FreeBSD.org> | 2020-11-28 18:09:16 +0000 |
commit | 2f0116b4bf0637b99f27a2b5c2bc3e9dedd931cf (patch) | |
tree | 001ea9ecba2ab8a879b5ad83779271dcab9b01ce /contrib/unbound/util/edns.h | |
parent | 78fc4e72413bbbffd5963e953e33f1e374318c01 (diff) | |
download | src-test2-2f0116b4bf0637b99f27a2b5c2bc3e9dedd931cf.tar.gz src-test2-2f0116b4bf0637b99f27a2b5c2bc3e9dedd931cf.zip |
Notes
Diffstat (limited to 'contrib/unbound/util/edns.h')
-rw-r--r-- | contrib/unbound/util/edns.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/contrib/unbound/util/edns.h b/contrib/unbound/util/edns.h index a4ee7def634c..cf9f8707e808 100644 --- a/contrib/unbound/util/edns.h +++ b/contrib/unbound/util/edns.h @@ -42,12 +42,69 @@ #ifndef UTIL_EDNS_H #define UTIL_EDNS_H +#include "util/storage/dnstree.h" + struct edns_data; struct config_file; struct comm_point; struct regional; /** + * Structure containing all EDNS tags. + */ +struct edns_tags { + /** Tree of EDNS client tags to use in upstream queries, per address + * prefix. Contains nodes of type edns_tag_addr. */ + rbtree_type client_tags; + /** EDNS opcode to use for client tags */ + uint16_t client_tag_opcode; + /** region to allocate tree nodes in */ + struct regional* region; +}; + +/** + * EDNS tag. Node of rbtree, containing tag and prefix. + */ +struct edns_tag_addr { + /** node in address tree, used for tree lookups. Need to be the first + * member of this struct. */ + struct addr_tree_node node; + /** tag data, in host byte ordering */ + uint16_t tag_data; +}; + +/** + * Create structure to hold EDNS tags + * @return: newly created edns_tags, NULL on alloc failure. + */ +struct edns_tags* edns_tags_create(void); + +/** Delete EDNS tags structure + * @param edns_tags: struct to delete + */ +void edns_tags_delete(struct edns_tags* edns_tags); + +/** + * Add configured EDNS tags + * @param edns_tags: edns tags to apply config to + * @param config: struct containing EDNS tags configuration + * @return 0 on error + */ +int edns_tags_apply_cfg(struct edns_tags* edns_tags, + struct config_file* config); + +/** + * Find tag for address. + * @param tree: tree containing EDNS tags per address prefix. + * @param addr: address to use for tree lookup + * @param addrlen: length of address + * @return: matching tree node, NULL otherwise + */ +struct edns_tag_addr* +edns_tag_addr_lookup(rbtree_type* tree, struct sockaddr_storage* addr, + socklen_t addrlen); + +/** * Apply common EDNS options. * * @param edns_out: initialised edns information with outbound edns. |