2 * rrdns - Rapid Reverse DNS lookup plugin for the UBUS RPC server
4 * Copyright (C) 2016-2017 Jo-Philipp Wich <jo@mein.io>
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 #include <libubox/avl.h>
21 #include <libubox/uloop.h>
23 #define RRDNS_MAX_TIMEOUT 5000
24 #define RRDNS_DEF_TIMEOUT 250
26 #define RRDNS_MAX_LIMIT 1000
27 #define RRDNS_DEF_LIMIT 10
30 struct rrdns_request {
31 struct avl_node by_id;
32 struct avl_node by_addr;
41 struct rrdns_context {
42 struct ubus_context *context;
43 struct ubus_request_data request;
44 struct uloop_timeout timeout;
45 struct blob_attr *addr_cur;
47 struct uloop_fd socket;
49 struct avl_tree request_ids;
50 struct avl_tree request_addrs;