]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Move state information common to both peers into a common structure.
authorTed Lemon <source@isc.org>
Thu, 31 Aug 2000 04:40:05 +0000 (04:40 +0000)
committerTed Lemon <source@isc.org>
Thu, 31 Aug 2000 04:40:05 +0000 (04:40 +0000)
includes/failover.h
server/db.c

index b2c0957e1396b80709a8f9a7b126839d3c4ee46c..36b7ffbd59558e0b4fbe19f1fa8817649192671b 100644 (file)
@@ -217,9 +217,10 @@ typedef struct {
        u_int32_t xid;
 } dhcp_failover_link_t;
 
-typedef struct {
+typedef struct _dhcp_failover_listener {
        OMAPI_OBJECT_PREAMBLE;
-       unsigned local_port;
+       struct _dhcp_failover_listener *next;
+       omapi_addr_t address;
 } dhcp_failover_listener_t;
 #endif /* FAILOVER_PROTOCOL */
 
@@ -234,7 +235,8 @@ enum failover_state {
        recover,
        recover_done,
        shut_down,
-       paused
+       paused,
+       startup
 };
 
 /* Service states are simplifications of failover states, particularly
@@ -251,25 +253,28 @@ enum service_state {
 };
 
 #if defined (FAILOVER_PROTOCOL)
+typedef struct _dhcp_failover_config {
+       struct option_cache *address;
+       int port;
+       u_int32_t max_flying_updates;
+       enum failover_state state;
+       TIME stos;
+       u_int32_t max_response_delay;
+} dhcp_failover_config_t;
+
 typedef struct _dhcp_failover_state {
        OMAPI_OBJECT_PREAMBLE;
        struct _dhcp_failover_state *next;
        char *name;                     /* Name of this failover instance. */
-       struct option_cache *address;   /* Partner's IP address or hostname. */
-       int port;                       /* Partner's TCP port. */
-       struct option_cache *server_addr; /* IP address on which to listen. */
+       dhcp_failover_config_t me;      /* My configuration. */
+       dhcp_failover_config_t partner; /* Partner's configuration. */
+       enum failover_state saved_state; /* Saved state during startup. */
        struct data_string server_identifier; /* Server identifier (IP addr) */
-       int listen_port;                /* Port on which to listen. */
-       u_int32_t max_flying_updates;
        u_int32_t mclt;
 
        u_int8_t *hba;  /* Hash bucket array for load balancing. */
        int load_balance_max_secs;
 
-       enum failover_state partner_state;
-       TIME partner_stos;
-       enum failover_state my_state;
-       TIME my_stos;
        enum service_state service_state;
        const char *nrr;        /* Printable reason why we're in the
                                   not_responding service state (empty
@@ -286,13 +291,6 @@ typedef struct _dhcp_failover_state {
        TIME last_timestamp_received;   /* The last timestamp we sent that
                                           has been returned by our partner. */
        TIME skew;      /* The skew between our clock and our partner's. */
-       u_int32_t max_transmit_idle; /* Always send a poll if we haven't sent
-                                       some other packet more recently than
-                                       this. */
-       u_int32_t max_response_delay;   /* If the returned timestamp on the
-                                          last packet we received is older
-                                          than this, communications have been
-                                          interrupted. */
        struct lease *update_queue_head; /* List of leases we haven't sent
                                            to peer. */
        struct lease *update_queue_tail;
index f10109f3df2e24f943df975ccab22e77df205e5d..8a96054f64fe11a6fe18df0cda3fa40293472b12 100644 (file)
@@ -43,7 +43,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: db.c,v 1.56 2000/08/11 01:26:08 neild Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: db.c,v 1.57 2000/08/31 04:40:05 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -516,21 +516,21 @@ int write_failover_state (dhcp_failover_state_t *state)
        if (errno)
                ++errors;
 
-       t = gmtime (&state -> my_stos);
+       t = gmtime (&state -> me.stos);
        errno = 0;
        fprintf (db_file, "\n  my state %s at %d %d/%02d/%02d %02d:%02d:%02d;",
-                dhcp_failover_state_name_print (state -> my_state),
+                dhcp_failover_state_name_print (state -> me.state),
                 t -> tm_wday, t -> tm_year + 1900,
                 t -> tm_mon + 1, t -> tm_mday,
                 t -> tm_hour, t -> tm_min, t -> tm_sec);
        if (errno)
                ++errors;
 
-       t = gmtime (&state -> partner_stos);
+       t = gmtime (&state -> partner.stos);
        errno = 0;
        fprintf (db_file,
                 "\n  partner state %s at %d %d/%02d/%02d %02d:%02d:%02d;",
-                dhcp_failover_state_name_print (state -> my_state),
+                dhcp_failover_state_name_print (state -> partner.state),
                 t -> tm_wday, t -> tm_year + 1900,
                 t -> tm_mon + 1, t -> tm_mday,
                 t -> tm_hour, t -> tm_min, t -> tm_sec);