OpenDNSSEC-signer
1.4.1
Main Page
Data Structures
Files
File List
Globals
signer
src
wire
xfrd.h
Go to the documentation of this file.
1
/*
2
* $Id: xfrd.h 4958 2011-04-18 07:11:09Z matthijs $
3
*
4
* Copyright (c) 2011 NLNet Labs. All rights reserved.
5
*
6
* Redistribution and use in source and binary forms, with or without
7
* modification, are permitted provided that the following conditions
8
* are met:
9
* 1. Redistributions of source code must retain the above copyright
10
* notice, this list of conditions and the following disclaimer.
11
* 2. Redistributions in binary form must reproduce the above copyright
12
* notice, this list of conditions and the following disclaimer in the
13
* documentation and/or other materials provided with the distribution.
14
*
15
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
21
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
23
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
25
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
*
27
*/
28
34
#ifndef WIRE_XFRD_H
35
#define WIRE_XFRD_H
36
37
#include "config.h"
38
#include "
shared/allocator.h
"
39
#include "
shared/locks.h
"
40
#include "
shared/status.h
"
41
#include "
wire/acl.h
"
42
#include "
wire/buffer.h
"
43
#include "
wire/netio.h
"
44
#include "
wire/tsig.h
"
45
46
#include <stdint.h>
47
#include <time.h>
48
49
#define XFRD_MAX_ROUNDS 3
/* max number of rounds along the masters */
50
#define XFRD_MAX_UDP 100
/* max number of udp sockets at a time for ixfr */
51
#define XFRD_NO_IXFR_CACHE 172800
/* 48h before retrying ixfr after notimpl */
52
#define XFRD_TCP_TIMEOUT 120
/* seconds, before a tcp request times out */
53
#define XFRD_UDP_TIMEOUT 5
/* seconds, before a udp request times out */
54
59
enum
xfrd_pkt_enum
{
60
XFRD_PKT_BAD
,
/* drop the packet/connection */
61
XFRD_PKT_MORE
,
/* more packets to follow on tcp */
62
XFRD_PKT_NOTIMPL
,
/* server responded with NOTIMPL or FORMATERR */
63
XFRD_PKT_TC
,
/* try tcp connection */
64
XFRD_PKT_XFR
,
/* server responded with transfer*/
65
XFRD_PKT_NEWLEASE
/* no changes, soa OK */
66
};
67
typedef
enum
xfrd_pkt_enum
xfrd_pkt_status
;
68
69
/*
70
* Zone transfer SOA information.
71
*/
72
typedef
struct
soa_struct
soa_type
;
73
struct
soa_struct
{
74
/* owner equals zone apex */
75
/* class equals zone klass */
76
/* type is SOA */
77
uint32_t
ttl
;
78
/* rdata count = 7 */
79
uint8_t
mname
[
MAXDOMAINLEN
+ 2];
80
uint8_t
rname
[
MAXDOMAINLEN
+ 2];
81
uint32_t
serial
;
82
uint32_t
refresh
;
83
uint32_t
retry
;
84
uint32_t
expire
;
85
uint32_t
minimum
;
86
};
87
92
typedef
struct
xfrd_struct
xfrd_type
;
93
struct
xfrd_struct
94
{
95
allocator_type
*
allocator
;
96
void
*
xfrhandler
;
97
void
*
zone
;
98
lock_basic_type
serial_lock
;
/* mutexes soa serial management */
99
lock_basic_type
rw_lock
;
/* mutexes <zone>.xfrd file */
100
101
/* transfer request handling */
102
int
tcp_conn
;
103
int
round_num
;
104
int
master_num
;
105
int
next_master
;
106
acl_type
*
master
;
107
108
/* soa serial management */
109
uint32_t
serial_xfr
;
110
uint32_t
serial_notify
;
111
uint32_t
serial_disk
;
112
time_t
serial_xfr_acquired
;
113
time_t
serial_notify_acquired
;
114
time_t
serial_disk_acquired
;
115
soa_type
soa
;
116
117
/* timeout and event handling */
118
struct
timespec
timeout
;
119
netio_handler_type
handler
;
120
121
/* packet handling */
122
uint16_t
query_id
;
123
uint32_t
msg_seq_nr
;
124
uint32_t
msg_old_serial
;
125
uint32_t
msg_new_serial
;
126
size_t
msg_rr_count
;
127
uint8_t
msg_is_ixfr
;
128
tsig_rr_type
*
tsig_rr
;
129
130
xfrd_type
*
tcp_waiting_next
;
131
xfrd_type
*
udp_waiting_next
;
132
unsigned
tcp_waiting
: 1;
133
unsigned
udp_waiting
: 1;
134
135
};
136
144
xfrd_type
*
xfrd_create
(
void
* xfrhandler,
void
* zone);
145
151
void
xfrd_set_timer_now
(
xfrd_type
* xfrd);
152
158
void
xfrd_set_timer_retry
(
xfrd_type
* xfrd);
159
165
void
xfrd_set_timer_refresh
(
xfrd_type
* xfrd);
166
174
socklen_t
xfrd_acl_sockaddr_to
(
acl_type
* acl,
175
struct
sockaddr_storage* to);
176
182
void
xfrd_cleanup
(
xfrd_type
* xfrd);
183
184
#endif
/* WIRE_XFRD_H */
Generated on Wed Jul 17 2013 07:14:23 for OpenDNSSEC-signer by
1.8.4