3 Definitions for address trees... */
6 * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC")
7 * Copyright (c) 2000-2003 by Internet Software Consortium
9 * Permission to use, copy, modify, and distribute this software for any
10 * purpose with or without fee is hereby granted, provided that the above
11 * copyright notice and this permission notice appear in all copies.
13 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
14 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
16 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
19 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 * Internet Systems Consortium, Inc.
23 * Redwood City, CA 94063
27 * This software has been written for Internet Systems Consortium
28 * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
29 * To learn more about Internet Systems Consortium, see
30 * ``http://www.isc.org/''. To learn more about Vixie Enterprises,
31 * see ``http://www.vix.com''. To learn more about Nominum, Inc., see
32 * ``http://www.nominum.com''.
35 #if defined (FAILOVER_PROTOCOL)
36 struct failover_option_info
{
39 enum { FT_UINT8
, FT_IPADDR
, FT_UINT32
, FT_BYTES
, FT_TEXT_OR_BYTES
,
40 FT_DDNS
, FT_DDNS1
, FT_UINT16
, FT_TEXT
,
41 FT_UNDEF
, FT_DIGEST
} type
;
52 #define FM_OFFSET(x) (long)(&(((failover_message_t *)0) -> x))
54 /* Failover message options: */
55 #define FTO_BINDING_STATUS 1
56 #define FTB_BINDING_STATUS 0x00000002
57 #define FTO_ASSIGNED_IP_ADDRESS 2
58 #define FTB_ASSIGNED_IP_ADDRESS 0x00000004
59 #define FTO_SERVER_ADDR 3
60 #define FTB_SERVER_ADDR 0x00000008
61 #define FTO_ADDRESSES_TRANSFERRED 4
62 #define FTB_ADDRESSES_TRANSFERRED 0x00000010
63 #define FTO_CLIENT_IDENTIFIER 5
64 #define FTB_CLIENT_IDENTIFIER 0x00000020
66 #define FTB_CHADDR 0x00000040
68 #define FTB_DDNS 0x00000080
69 #define FTO_REJECT_REASON 8
70 #define FTB_REJECT_REASON 0x00000100
72 #define FTB_MESSAGE 0x00000200
74 #define FTB_MCLT 0x00000400
75 #define FTO_VENDOR_CLASS 11
76 #define FTB_VENDOR_CLASS 0x00000800
77 #define FTO_LEASE_EXPIRY 13
78 #define FTB_LEASE_EXPIRY 0x00002000
79 #define FTO_POTENTIAL_EXPIRY 14
80 #define FTB_POTENTIAL_EXPIRY 0x00004000
81 #define FTO_GRACE_EXPIRY 15
82 #define FTB_GRACE_EXPIRY 0x00008000
84 #define FTB_CLTT 0x00010000
86 #define FTB_STOS 0x00020000
87 #define FTO_SERVER_STATE 18
88 #define FTB_SERVER_STATE 0x00040000
89 #define FTO_SERVER_FLAGS 19
90 #define FTB_SERVER_FLAGS 0x00080000
91 #define FTO_VENDOR_OPTIONS 20
92 #define FTB_VENDOR_OPTIONS 0x00100000
93 #define FTO_MAX_UNACKED 21
94 #define FTB_MAX_UNACKED 0x00200000
95 #define FTO_RECEIVE_TIMER 23
96 #define FTB_RECEIVE_TIMER 0x00800000
98 #define FTB_HBA 0x01000000
99 #define FTO_MESSAGE_DIGEST 25
100 #define FTB_MESSAGE_DIGEST 0x02000000
101 #define FTO_PROTOCOL_VERSION 26
102 #define FTB_PROTOCOL_VERSION 0x04000000
103 #define FTO_TLS_REQUEST 27
104 #define FTB_TLS_REQUEST 0x08000000
105 #define FTO_TLS_REPLY 28
106 #define FTB_TLS_REPLY 0x10000000
107 #define FTO_REQUEST_OPTIONS 29
108 #define FTB_REQUEST_OPTIONS 0x20000000
109 #define FTO_REPLY_OPTIONS 30
110 #define FTB_REPLY_OPTIONS 0x40000000
111 #define FTO_MAX FTO_REPLY_OPTIONS
113 /* Failover protocol message types: */
114 #define FTM_POOLREQ 1
115 #define FTM_POOLRESP 2
118 #define FTM_CONNECT 5
119 #define FTM_CONNECTACK 6
121 #define FTM_UPDDONE 8
122 #define FTM_UPDREQALL 9
124 #define FTM_CONTACT 11
125 #define FTM_DISCONNECT 12
127 /* Reject reasons: */
129 #define FTR_ILLEGAL_IP_ADDR 1
130 #define FTR_FATAL_CONFLICT 2
131 #define FTR_MISSING_BINDINFO 3
132 #define FTR_TIMEMISMATCH 4
133 #define FTR_INVALID_MCLT 5
134 #define FTR_MISC_REJECT 6
135 #define FTR_DUP_CONNECTION 7
136 #define FTR_INVALID_PARTNER 8
137 #define FTR_TLS_UNSUPPORTED 9
138 #define FTR_TLS_UNCONFIGURED 10
139 #define FTR_TLS_REQUIRED 11
140 #define FTR_DIGEST_UNSUPPORTED 12
141 #define FTR_DIGEST_UNCONFIGURED 13
142 #define FTR_VERSION_MISMATCH 14
143 #define FTR_MISSING_BIND_INFO 15
144 #define FTR_OUTDATED_BIND_INFO 16
145 #define FTR_LESS_CRIT_BIND_INFO 17
146 #define FTR_NO_TRAFFIC 18
147 #define FTR_HBA_CONFLICT 19
148 #define FTR_UNKNOWN 254
150 #define DHCP_FAILOVER_MAX_MESSAGE_SIZE 2048
152 /* Failover server flags. */
153 #define FTF_STARTUP 1
155 typedef struct failover_message
{
157 struct failover_message
*next
;
161 u_int8_t binding_status
;
162 u_int8_t protocol_version
;
163 u_int8_t reject_reason
;
164 u_int8_t server_flags
;
165 u_int8_t server_state
;
167 u_int8_t tls_request
;
171 u_int32_t addresses_transferred
;
172 u_int32_t assigned_addr
;
173 u_int32_t client_ltt
;
175 u_int32_t grace_expiry
;
176 u_int32_t max_unacked
;
178 u_int32_t potential_expiry
;
179 u_int32_t receive_timer
;
180 u_int32_t server_addr
;
181 failover_option_t chaddr
;
182 failover_option_t client_identifier
;
183 failover_option_t hba
;
184 failover_option_t message
;
185 failover_option_t reply_options
;
186 failover_option_t request_options
;
188 failover_option_t vendor_class
;
189 failover_option_t vendor_options
;
192 } failover_message_t
;
195 OMAPI_OBJECT_PREAMBLE
;
196 struct option_cache
*peer_address
;
199 enum dhcp_flink_state
{
201 dhcp_flink_message_length_wait
,
202 dhcp_flink_message_wait
,
203 dhcp_flink_disconnected
,
206 failover_message_t
*imsg
;
207 struct _dhcp_failover_state
*state_object
;
210 u_int8_t imsg_payoff
; /* Pay*load* offset. :') */
212 } dhcp_failover_link_t
;
214 typedef struct _dhcp_failover_listener
{
215 OMAPI_OBJECT_PREAMBLE
;
216 struct _dhcp_failover_listener
*next
;
217 omapi_addr_t address
;
218 } dhcp_failover_listener_t
;
219 #endif /* FAILOVER_PROTOCOL */
221 /* A failover peer. */
222 enum failover_state
{
226 communications_interrupted
,
227 resolution_interrupted
,
237 /* Service states are simplifications of failover states, particularly
238 useful because the startup state isn't actually implementable as a
239 seperate failover state without maintaining a state stack. */
242 unknown_service_state
,
245 service_partner_down
,
250 #if defined (FAILOVER_PROTOCOL)
251 typedef struct _dhcp_failover_config
{
252 struct option_cache
*address
;
254 u_int32_t max_flying_updates
;
255 enum failover_state state
;
257 u_int32_t max_response_delay
;
258 } dhcp_failover_config_t
;
260 typedef struct _dhcp_failover_state
{
261 OMAPI_OBJECT_PREAMBLE
;
262 struct _dhcp_failover_state
*next
;
263 char *name
; /* Name of this failover instance. */
264 dhcp_failover_config_t me
; /* My configuration. */
265 dhcp_failover_config_t partner
; /* Partner's configuration. */
266 enum failover_state saved_state
; /* Saved state during startup. */
267 struct data_string server_identifier
; /* Server identifier (IP addr) */
270 u_int8_t
*hba
; /* Hash bucket array for load balancing. */
271 int load_balance_max_secs
;
273 enum service_state service_state
;
274 const char *nrr
; /* Printable reason why we're in the
275 not_responding service state (empty
276 string if we are responding. */
278 dhcp_failover_link_t
*link_to_peer
; /* Currently-established link
283 } i_am
; /* We are primary or secondary in this relationship. */
285 TIME last_packet_sent
; /* Timestamp on last packet we sent. */
286 TIME last_timestamp_received
; /* The last timestamp we sent that
287 has been returned by our partner. */
288 TIME skew
; /* The skew between our clock and our partner's. */
289 struct lease
*update_queue_head
; /* List of leases we haven't sent
291 struct lease
*update_queue_tail
;
293 struct lease
*ack_queue_head
; /* List of lease updates the peer
295 struct lease
*ack_queue_tail
;
297 struct lease
*send_update_done
; /* When we get a BNDACK for this
298 lease, send an UPDDONE message. */
299 int cur_unacked_updates
; /* Number of updates we've sent
300 that have not yet been acked. */
302 /* List of messages which we haven't
304 failover_message_t
*toack_queue_head
;
305 failover_message_t
*toack_queue_tail
;
306 int pending_acks
; /* Number of messages in the toack
308 int pool_count
; /* Number of pools referencing this
309 failover state object. */
310 int curUPD
; /* If an UPDREQ* message is in motion,
311 this value indicates which one. */
312 } dhcp_failover_state_t
;
314 #define DHCP_FAILOVER_VERSION 1
315 #endif /* FAILOVER_PROTOCOL */