Deleted Added
full compact
context.h (256281) context.h (269257)
1/*
2 * libunbound/context.h - validating context for unbound internal use
3 *
4 * Copyright (c) 2007, NLnet Labs. All rights reserved.
5 *
6 * This software is open source.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 7 unchanged lines hidden (view full) ---

16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 *
19 * Neither the name of the NLNET LABS nor the names of its contributors may
20 * be used to endorse or promote products derived from this software without
21 * specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1/*
2 * libunbound/context.h - validating context for unbound internal use
3 *
4 * Copyright (c) 2007, NLnet Labs. All rights reserved.
5 *
6 * This software is open source.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 7 unchanged lines hidden (view full) ---

16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 *
19 * Neither the name of the NLNET LABS nor the names of its contributors may
20 * be used to endorse or promote products derived from this software without
21 * specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
29 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 */
35
36/**
37 * \file
38 *
39 * This file contains the validator context structure.
40 */
41#ifndef LIBUNBOUND_CONTEXT_H
42#define LIBUNBOUND_CONTEXT_H
43#include "util/locks.h"
44#include "util/alloc.h"
45#include "util/rbtree.h"
46#include "services/modstack.h"
47#include "libunbound/unbound.h"
48#include "util/data/packed_rrset.h"
49struct libworker;
50struct tube;
34 */
35
36/**
37 * \file
38 *
39 * This file contains the validator context structure.
40 */
41#ifndef LIBUNBOUND_CONTEXT_H
42#define LIBUNBOUND_CONTEXT_H
43#include "util/locks.h"
44#include "util/alloc.h"
45#include "util/rbtree.h"
46#include "services/modstack.h"
47#include "libunbound/unbound.h"
48#include "util/data/packed_rrset.h"
49struct libworker;
50struct tube;
51struct sldns_buffer;
52struct event_base;
51
52/**
53 * The context structure
54 *
55 * Contains two pipes for async service
56 * qq : write queries to the async service pid/tid.
57 * rr : read results from the async service pid/tid.
58 */

--- 47 unchanged lines hidden (view full) ---

106 struct module_env* env;
107 /** module stack */
108 struct module_stack mods;
109 /** local authority zones */
110 struct local_zones* local_zones;
111 /** random state used to seed new random state structures */
112 struct ub_randstate* seed_rnd;
113
53
54/**
55 * The context structure
56 *
57 * Contains two pipes for async service
58 * qq : write queries to the async service pid/tid.
59 * rr : read results from the async service pid/tid.
60 */

--- 47 unchanged lines hidden (view full) ---

108 struct module_env* env;
109 /** module stack */
110 struct module_stack mods;
111 /** local authority zones */
112 struct local_zones* local_zones;
113 /** random state used to seed new random state structures */
114 struct ub_randstate* seed_rnd;
115
116 /** event base for event oriented interface */
117 struct event_base* event_base;
118 /** libworker for event based interface */
119 struct libworker* event_worker;
120
114 /** next query number (to try) to use */
115 int next_querynum;
116 /** number of async queries outstanding */
117 size_t num_async;
118 /**
119 * Tree of outstanding queries. Indexed by querynum
120 * Used when results come in for async to lookup.
121 * Used when cancel is done for lookup (and delete).

--- 107 unchanged lines hidden (view full) ---

229 * @param ctx: context
230 * @param name: query name
231 * @param rrtype: type
232 * @param rrclass: class
233 * @param cb: callback for async, or NULL for sync.
234 * @param cbarg: user arg for async queries.
235 * @return new ctx_query or NULL for malloc failure.
236 */
121 /** next query number (to try) to use */
122 int next_querynum;
123 /** number of async queries outstanding */
124 size_t num_async;
125 /**
126 * Tree of outstanding queries. Indexed by querynum
127 * Used when results come in for async to lookup.
128 * Used when cancel is done for lookup (and delete).

--- 107 unchanged lines hidden (view full) ---

236 * @param ctx: context
237 * @param name: query name
238 * @param rrtype: type
239 * @param rrclass: class
240 * @param cb: callback for async, or NULL for sync.
241 * @param cbarg: user arg for async queries.
242 * @return new ctx_query or NULL for malloc failure.
243 */
237struct ctx_query* context_new(struct ub_ctx* ctx, const char* name,
238 int rrtype, int rrclass, ub_callback_t cb, void* cbarg);
244struct ctx_query* context_new(struct ub_ctx* ctx, const char* name, int rrtype,
245 int rrclass, ub_callback_t cb, void* cbarg);
239
240/**
241 * Get a new alloc. Creates a new one or uses a cached one.
242 * @param ctx: context
243 * @param locking: if true, cfglock is locked while getting alloc.
244 * @return an alloc, or NULL on mem error.
245 */
246struct alloc_cache* context_obtain_alloc(struct ub_ctx* ctx, int locking);

--- 23 unchanged lines hidden (view full) ---

270 * As well as command code 'answer'.
271 * @param q: context query
272 * @param err: error code to pass to client.
273 * @param pkt: the packet to add, can be NULL.
274 * @param len: the length of the allocation is returned.
275 * @return: an alloc, or NULL on mem error.
276 */
277uint8_t* context_serialize_answer(struct ctx_query* q, int err,
246
247/**
248 * Get a new alloc. Creates a new one or uses a cached one.
249 * @param ctx: context
250 * @param locking: if true, cfglock is locked while getting alloc.
251 * @return an alloc, or NULL on mem error.
252 */
253struct alloc_cache* context_obtain_alloc(struct ub_ctx* ctx, int locking);

--- 23 unchanged lines hidden (view full) ---

277 * As well as command code 'answer'.
278 * @param q: context query
279 * @param err: error code to pass to client.
280 * @param pkt: the packet to add, can be NULL.
281 * @param len: the length of the allocation is returned.
282 * @return: an alloc, or NULL on mem error.
283 */
284uint8_t* context_serialize_answer(struct ctx_query* q, int err,
278 ldns_buffer* pkt, uint32_t* len);
285 struct sldns_buffer* pkt, uint32_t* len);
279
280/**
281 * Serialize a query cancellation. Serializes query async id
282 * as well as command code 'cancel'
283 * @param q: context query
284 * @param len: the length of the allocation is returned.
285 * @return: an alloc, or NULL on mem error.
286 */

--- 59 unchanged lines hidden ---
286
287/**
288 * Serialize a query cancellation. Serializes query async id
289 * as well as command code 'cancel'
290 * @param q: context query
291 * @param len: the length of the allocation is returned.
292 * @return: an alloc, or NULL on mem error.
293 */

--- 59 unchanged lines hidden ---