OpenDNSSEC-signer 2.1.10
query.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011 NLNet Labs. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
19 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
21 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
22 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
23 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *
25 */
26
32#ifndef WIRE_QUERY_H
33#define WIRE_QUERY_H
34
35#include "config.h"
36#include "status.h"
37#include "signer/zone.h"
38#include "wire/buffer.h"
39#include "wire/edns.h"
40#include "wire/tsig.h"
41
42#define UDP_MAX_MESSAGE_LEN 512
43#define TCP_MAX_MESSAGE_LEN 65535
44#define QUERY_RESPONSE_MAX_RRSET 10 /* should be enough */
45
51};
53
58typedef struct query_struct query_type;
60 /* Query from addres */
61 struct sockaddr_storage addr;
62 socklen_t addrlen;
63 /* Maximum supported query size */
64 size_t maxlen;
66 /* TSIG */
68 /* EDNS */
70 /* TCP */
71 int tcp;
72 uint16_t tcplen;
74 /* QNAME, QTYPE, QCLASS */
75
76 /* Zone */
78 /* Compression */
79
80 /* AXFR IXFR */
81 FILE* axfr_fd;
82 uint32_t serial;
83 size_t startpos;
84 /* Bits */
85 unsigned axfr_is_done : 1;
86 unsigned tsig_prepare_it : 1;
87 unsigned tsig_update_it : 1;
88 unsigned tsig_sign_it : 1;
89};
90
100};
101
107extern query_type* query_create(void);
108
114extern void query_prepare(query_type* q);
115
124
132extern void query_reset(query_type* q, size_t maxlen, int is_tcp);
133
140extern void query_add_optional(query_type* q, engine_type* engine);
141
149extern int query_add_rr(query_type* q, ldns_rr* rr);
150
156extern void query_cleanup(query_type* q);
157
158#endif /* WIRE_QUERY_H */
void query_prepare(query_type *q)
Definition: query.c:612
query_type * query_create(void)
Definition: query.c:48
void query_reset(query_type *q, size_t maxlen, int is_tcp)
Definition: query.c:80
query_enum
Definition: query.h:46
@ QUERY_IXFR
Definition: query.h:50
@ QUERY_AXFR
Definition: query.h:49
@ QUERY_DISCARDED
Definition: query.h:48
@ QUERY_PROCESSED
Definition: query.h:47
void query_add_optional(query_type *q, engine_type *engine)
Definition: query.c:962
void query_cleanup(query_type *q)
Definition: query.c:1098
query_state query_process(query_type *q, engine_type *engine)
Definition: query.c:842
int query_add_rr(query_type *q, ldns_rr *rr)
Definition: query.c:1041
#define QUERY_RESPONSE_MAX_RRSET
Definition: query.h:44
enum query_enum query_state
Definition: query.h:52
size_t startpos
Definition: query.h:83
int tcp
Definition: query.h:71
size_t maxlen
Definition: query.h:64
buffer_type * buffer
Definition: query.h:73
edns_rr_type * edns_rr
Definition: query.h:69
unsigned tsig_sign_it
Definition: query.h:88
struct sockaddr_storage addr
Definition: query.h:61
FILE * axfr_fd
Definition: query.h:81
uint32_t serial
Definition: query.h:82
unsigned axfr_is_done
Definition: query.h:85
uint16_t tcplen
Definition: query.h:72
socklen_t addrlen
Definition: query.h:62
unsigned tsig_update_it
Definition: query.h:87
unsigned tsig_prepare_it
Definition: query.h:86
zone_type * zone
Definition: query.h:77
tsig_rr_type * tsig_rr
Definition: query.h:67
size_t reserved_space
Definition: query.h:65
ldns_pkt_section sections[QUERY_RESPONSE_MAX_RRSET]
Definition: query.h:98
size_t rrset_count
Definition: query.h:97
rrset_type * rrsets[QUERY_RESPONSE_MAX_RRSET]
Definition: query.h:99