summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorTed Lemon <source@isc.org>1999-11-20 18:36:32 +0000
committerTed Lemon <source@isc.org>1999-11-20 18:36:32 +0000
commitd9eefc5dec0bd2986d1465276363f7b97d92b69a (patch)
tree5c8396c6474892bf2cb030ac6d4c88d9a63429fd /includes
parentb3677620b6bebff760d40ab7d73f918bfe66260a (diff)
downloadisc-dhcp-d9eefc5dec0bd2986d1465276363f7b97d92b69a.tar.gz
Mass commit for Brian Murrell.
Diffstat (limited to 'includes')
-rw-r--r--includes/cf/sunos5-5.h2
-rw-r--r--includes/dhcpd.h81
-rw-r--r--includes/failover.h55
-rw-r--r--includes/omapip/omapip.h10
-rw-r--r--includes/site.h6
-rw-r--r--includes/tree.h4
6 files changed, 141 insertions, 17 deletions
diff --git a/includes/cf/sunos5-5.h b/includes/cf/sunos5-5.h
index ec01e597..b5f3df2a 100644
--- a/includes/cf/sunos5-5.h
+++ b/includes/cf/sunos5-5.h
@@ -118,6 +118,8 @@ extern int h_errno;
#define TIME time_t
#define GET_TIME(x) time ((x))
+#define HAVE_MKSTEMP
+
/* Solaris prior to 2.5 didn't have random(). Rather than being clever and
using random() only on versions >2.5, always use rand() and srand(). */
diff --git a/includes/dhcpd.h b/includes/dhcpd.h
index 74686faa..6d38680f 100644
--- a/includes/dhcpd.h
+++ b/includes/dhcpd.h
@@ -58,13 +58,14 @@
#include "inet.h"
#include "auth.h"
#include "dhctoken.h"
-#if defined (FAILOVER_PROTOCOL)
-# include "failover.h"
-#endif
#include <isc/result.h>
#include <omapip/omapip.h>
+#if defined (FAILOVER_PROTOCOL)
+# include "failover.h"
+#endif
+
#if !defined (OPTION_HASH_SIZE)
# define OPTION_HASH_SIZE 17
#endif
@@ -102,6 +103,13 @@ struct parse {
unsigned bufsiz;
};
+/* Client FQDN option, failover FQDN option, etc. */
+typedef struct {
+ u_int8_t codes [2];
+ unsigned length;
+ u_int8_t *data;
+} ddns_fqdn_t;
+
/* Variable-length array of data. */
struct string_list {
@@ -1417,6 +1425,12 @@ extern struct hash_table universe_hash;
void initialize_common_option_spaces PROTO ((void));
/* stables.c */
+#if defined (FAILOVER_PROTOCOL)
+struct failover_option_info ft_options [0];
+u_int32_t fto_allowed [0];
+int ft_sizes [0];
+char *dhcp_failover_link_state_names [0];
+#endif
extern struct universe agent_universe;
extern struct option agent_options [256];
extern struct universe server_universe;
@@ -1685,6 +1699,11 @@ extern omapi_object_type_t *dhcp_type_pool;
extern omapi_object_type_t *dhcp_type_shared_network;
extern omapi_object_type_t *dhcp_type_subnet;
extern omapi_object_type_t *dhcp_type_class;
+#if defined (FAILOVER_PROTOCOL)
+extern omapi_object_type_t *dhcp_type_failover_state;
+extern omapi_object_type_t *dhcp_type_failover_link;
+extern omapi_object_type_t *dhcp_type_failover_listener;
+#endif
void dhcp_db_objects_setup (void);
@@ -1875,3 +1894,59 @@ int deleteA (const struct data_string *, const struct data_string *,
struct lease *);
int deletePTR (const struct data_string *, const struct data_string *,
struct lease *);
+
+/* failover.c */
+#if defined (FAILOVER_PROTOCOL)
+void enter_failover_peer PROTO ((struct failover_peer *));
+struct failover_peer *find_failover_peer PROTO ((char *));
+isc_result_t dhcp_failover_link_initiate PROTO ((omapi_object_t *));
+isc_result_t dhcp_failover_link_signal PROTO ((omapi_object_t *,
+ const char *, va_list));
+isc_result_t dhcp_failover_link_set_value PROTO ((omapi_object_t *,
+ omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_typed_data_t *));
+isc_result_t dhcp_failover_link_get_value PROTO ((omapi_object_t *,
+ omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_value_t **));
+isc_result_t dhcp_failover_link_destroy PROTO ((omapi_object_t *,
+ const char *));
+isc_result_t dhcp_failover_link_stuff_values PROTO ((omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *));
+isc_result_t dhcp_failover_listen PROTO ((omapi_object_t *));
+
+isc_result_t dhcp_failover_listener_signal PROTO ((omapi_object_t *,
+ const char *,
+ va_list));
+isc_result_t dhcp_failover_listener_set_value PROTO ((omapi_object_t *,
+ omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_typed_data_t *));
+isc_result_t dhcp_failover_listener_get_value PROTO ((omapi_object_t *,
+ omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_value_t **));
+isc_result_t dhcp_failover_listener_destroy PROTO ((omapi_object_t *,
+ const char *));
+isc_result_t dhcp_failover_listener_stuff PROTO ((omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *));
+isc_result_t dhcp_failover_register PROTO ((omapi_object_t *));
+isc_result_t dhcp_failover_state_signal PROTO ((omapi_object_t *,
+ const char *, va_list));
+isc_result_t dhcp_failover_state_set_value PROTO ((omapi_object_t *,
+ omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_typed_data_t *));
+isc_result_t dhcp_failover_state_get_value PROTO ((omapi_object_t *,
+ omapi_object_t *,
+ omapi_data_string_t *,
+ omapi_value_t **));
+isc_result_t dhcp_failover_state_destroy PROTO ((omapi_object_t *,
+ const char *));
+isc_result_t dhcp_failover_state_stuff PROTO ((omapi_object_t *,
+ omapi_object_t *,
+ omapi_object_t *));
+#endif /* FAILOVER_PROTOCOL */
diff --git a/includes/failover.h b/includes/failover.h
index e10abd9f..4432d0fa 100644
--- a/includes/failover.h
+++ b/includes/failover.h
@@ -20,15 +20,21 @@
* http://www.isc.org for more information.
*/
-struct failover_option {
+struct failover_option_info {
int code;
char *name;
- enum { FT_UINT8, FT_IPADDR, FT_UINT32, FT_BYTES, FT_DDNS,
- FT_UINT16, FT_TEXT, FT_UNDEF, FT_DIGEST } data_type;
+ enum { FT_UINT8, FT_IPADDR, FT_UINT32, FT_BYTES, FT_DDNS, FT_DDNS1,
+ FT_UINT16, FT_TEXT, FT_UNDEF, FT_DIGEST } type;
int num_present;
- int data_offset;
+ int offset;
+ u_int32_t bit;
};
+typedef struct {
+ int count;
+ u_int8_t *data;
+} failover_option_t;
+
#define FM_OFFSET(x) ((char *)(((struct failover_message *)0).x) - \
(char *)(((struct failover_message *)0)))
@@ -102,3 +108,44 @@ struct failover_option {
#define FTM_STATE 10
#define FTM_CONTACT 11
#define FTM_DISCONNECT 12
+
+#define DHCP_FAILOVER_MAX_MESSAGE_SIZE 2048
+
+typedef struct {
+ u_int8_t type;
+ u_int32_t time;
+ u_int32_t xid;
+ int options_present;
+} failover_message_t;
+
+typedef struct {
+ OMAPI_OBJECT_PREAMBLE;
+ char *peer_name;
+ unsigned peer_port;
+ int options_present;
+ enum dhcp_flink_state {
+ dhcp_flink_start,
+ dhcp_flink_message_length_wait,
+ dhcp_flink_message_wait,
+ dhcp_flink_disconnected,
+ dhcp_flink_state_max
+ } state;
+ failover_message_t *imsg;
+ u_int16_t imsg_len;
+ unsigned imsg_count;
+ u_int8_t imsg_payoff; /* Pay*load* offset. :') */
+} dhcp_failover_link_t;
+
+typedef struct {
+ OMAPI_OBJECT_PREAMBLE;
+ unsigned local_port;
+ char *peer_name;
+} dhcp_failover_listener_t;
+
+typedef struct _dhcp_failover_state {
+ OMAPI_OBJECT_PREAMBLE;
+ struct _dhcp_failover_state *next;
+ char *remote_peer;
+ int listen_port;
+} dhcp_failover_state_t;
+
diff --git a/includes/omapip/omapip.h b/includes/omapip/omapip.h
index b69f3fe6..233db8e7 100644
--- a/includes/omapip/omapip.h
+++ b/includes/omapip/omapip.h
@@ -116,8 +116,8 @@ struct __omapi_object {
#define OMAPI_PROTOCOL_PORT 7911
isc_result_t omapi_protocol_connect (omapi_object_t *,
- const char *, int, omapi_object_t *);
-isc_result_t omapi_protocol_listen (omapi_object_t *, int, int);
+ const char *, unsigned, omapi_object_t *);
+isc_result_t omapi_protocol_listen (omapi_object_t *, unsigned, int);
isc_result_t omapi_protocol_accept (omapi_object_t *);
isc_result_t omapi_protocol_send_intro (omapi_object_t *, unsigned, unsigned);
isc_result_t omapi_protocol_ready (omapi_object_t *);
@@ -157,7 +157,7 @@ isc_result_t omapi_protocol_send_status (omapi_object_t *, omapi_object_t *,
isc_result_t omapi_protocol_send_update (omapi_object_t *, omapi_object_t *,
unsigned, omapi_object_t *);
-isc_result_t omapi_connect (omapi_object_t *, const char *, int);
+isc_result_t omapi_connect (omapi_object_t *, const char *, unsigned);
isc_result_t omapi_disconnect (omapi_object_t *, int);
int omapi_connection_readfd (omapi_object_t *);
int omapi_connection_writefd (omapi_object_t *);
@@ -184,7 +184,7 @@ isc_result_t omapi_connection_put_handle (omapi_object_t *c,
omapi_object_t *h);
-isc_result_t omapi_listen (omapi_object_t *, int, int);
+isc_result_t omapi_listen (omapi_object_t *, unsigned, int);
isc_result_t omapi_listener_accept (omapi_object_t *);
int omapi_listener_readfd (omapi_object_t *);
isc_result_t omapi_accept (omapi_object_t *);
@@ -334,7 +334,7 @@ isc_result_t omapi_make_int_value (omapi_value_t **, omapi_data_string_t *,
isc_result_t omapi_make_handle_value (omapi_value_t **, omapi_data_string_t *,
omapi_object_t *, const char *);
isc_result_t omapi_make_string_value (omapi_value_t **, omapi_data_string_t *,
- char *, const char *);
+ const char *, const char *);
isc_result_t omapi_get_int_value (unsigned long *, omapi_typed_data_t *);
isc_result_t omapi_object_handle (omapi_handle_t *, omapi_object_t *);
diff --git a/includes/site.h b/includes/site.h
index 7ef206d2..b823cb50 100644
--- a/includes/site.h
+++ b/includes/site.h
@@ -51,17 +51,17 @@
/* Define this if you want debugging output for DHCP failover protocol
messages. */
-/* #define DEBUG_FAILOVER_MESSAGES */
+#define DEBUG_FAILOVER_MESSAGES
/* Define this if you want debugging output for DHCP failover protocol
lease assignment timing. */
-/* #define DEBUG_FAILOVER_TIMING */
+#define DEBUG_FAILOVER_TIMING
/* Define this if you want DHCP failover protocol support in the DHCP
server. */
-/* #define FAILOVER_PROTOCOL */
+#define FAILOVER_PROTOCOL
/* Define this if you want the dhcpd.pid file to go somewhere other than
the default (which varies from system to system, but is usually either
diff --git a/includes/tree.h b/includes/tree.h
index 416248a0..d5e6fd6d 100644
--- a/includes/tree.h
+++ b/includes/tree.h
@@ -145,8 +145,8 @@ struct expression {
} pick_first_value;
struct {
struct expression *type;
- struct expression *expr1;
- struct expression *expr2;
+ struct expression *rrname;
+ struct expression *rrdata;
struct expression *ttl;
} dns_update;
struct expression *updated_dns_rr;