17 #include <boost/shared_ptr.hpp> 89 void setName(
const std::string& name);
105 return (trust_anchor_);
141 return (tls_context_);
149 std::string getLogLabel()
const;
165 void setRole(
const std::string& role);
172 static Role stringToRole(
const std::string& role);
185 return (auto_failover_);
193 auto_failover_ = auto_failover;
198 return (basic_auth_);
203 return (basic_auth_);
257 void setPausing(
const std::string& pausing);
303 StateConfigPtr getStateConfig(
const int state);
308 std::map<int, StateConfigPtr> states_;
327 PeerConfigPtr selectNextPeerConfig(
const std::string& name);
331 return (this_server_name_);
338 void setThisServerName(
const std::string& this_server_name);
353 void setHAMode(
const std::string& ha_mode);
360 static HAMode stringToHAMode(
const std::string& ha_mode);
366 static std::string HAModeToString(
const HAMode& ha_mode);
371 return (send_lease_updates_);
384 send_lease_updates_ = send_lease_updates;
390 return (sync_leases_);
403 sync_leases_ = sync_leases;
410 return (sync_timeout_);
417 sync_timeout_ = sync_timeout;
425 return (sync_page_limit_);
433 sync_page_limit_ = sync_page_limit;
449 return (delayed_updates_limit_);
465 delayed_updates_limit_ = delayed_updates_limit;
476 return (delayed_updates_limit_ > 0);
487 return (heartbeat_delay_);
498 heartbeat_delay_ = heartbeat_delay;
507 return (max_response_delay_);
518 max_response_delay_ = max_response_delay;
526 return (max_ack_delay_);
534 max_ack_delay_ = max_ack_delay;
542 return (max_unacked_clients_);
550 max_unacked_clients_ = max_unacked_clients;
569 return (max_rejected_lease_updates_);
583 max_rejected_lease_updates_ = max_rejected_lease_updates;
593 wait_backup_ack_ = wait_backup_ack;
602 return (wait_backup_ack_);
609 return (enable_multi_threading_);
617 enable_multi_threading_ = enable_multi_threading;
628 return (http_dedicated_listener_);
637 http_dedicated_listener_ = http_dedicated_listener;
644 return (http_listener_threads_);
651 http_listener_threads_ = http_listener_threads;
658 return (http_client_threads_);
665 http_client_threads_ = http_client_threads;
670 return (trust_anchor_);
706 return (require_client_certs_);
713 require_client_certs_ = flag;
718 return (restrict_commands_);
725 restrict_commands_ = flag;
734 PeerConfigPtr getPeerConfig(
const std::string& name)
const;
746 PeerConfigPtr getFailoverPeerConfig()
const;
751 PeerConfigPtr getThisServerConfig()
const;
759 PeerConfigMap getOtherServersConfig()
const;
772 return (state_machine_);
797 uint32_t delayed_updates_limit_;
799 uint32_t heartbeat_delay_;
void setSyncLeases(const bool sync_leases)
Sets boolean flag indicating whether the active servers should synchronize their lease databases upon...
StateMachineConfig()
Constructor.
void setHttpClientThreads(uint32_t http_client_threads)
Sets the number of threads the HTTP client should use.
uint32_t max_unacked_clients_
Maximum number of unacked clients.
Configuration specific to a single HA state.
StatePausing
State machine pausing modes.
void setEnableMultiThreading(bool enable_multi_threading)
Sets whether or not server is configured for multi-threaded operation.
void setTrustAnchor(const util::Optional< std::string > &ca)
Sets server's trust-anchor.
void setAutoFailover(const bool auto_failover)
Enables/disables auto-failover function for the server.
void setMaxUnackedClients(const uint32_t max_unacked_clients)
Set maximum number of clients which may fail to communicate with the DHCP server before entering part...
PeerConfigMap peers_
Map of peers' configurations.
HAMode getHAMode() const
Returns mode of operation.
bool getRequireClientCerts() const
Returns require-client-certs.
util::StatePausing getPausing() const
Returns pausing mode for the given state.
State machine configuration information.
bool enable_multi_threading_
Enable multi-threading.
std::map< std::string, PeerConfigPtr > PeerConfigMap
Map of the servers' configurations.
void setCertFile(const util::Optional< std::string > &cert)
Sets server's cert-file.
std::string this_server_name_
This server name.
void setMaxResponseDelay(const uint32_t max_response_delay)
Sets new max response delay.
uint32_t getSyncTimeout() const
Returns timeout for lease database synchronization.
void setDelayedUpdatesLimit(const uint32_t delayed_updates_limit)
Sets new limit for the number of lease updates to be held unsent in the communication-recovery state...
void setRequireClientCerts(bool flag)
Sets require-client-certs.
util::Optional< std::string > key_file_
Private key file.
void setWaitBackupAck(const bool wait_backup_ack)
Configures the server to wait/not wait for the lease update acknowledgments from the backup servers...
util::Optional< std::string > cert_file_
Certificate file.
uint32_t max_response_delay_
Max delay in response to heartbeats.
Role getRole() const
Returns server's role.
uint32_t getMaxResponseDelay() const
Returns max response delay.
bool getEnableMultiThreading()
Checks if the server is configured for multi-threaded operation.
PeerConfigMap getAllServersConfig() const
Returns configurations of all servers.
const http::BasicHttpAuthPtr & getBasicAuth() const
Returns const basic HTTP authentication.
bool sync_leases_
Synchronize databases on startup?
bool http_dedicated_listener_
Enable use of own HTTP listener.
bool wait_backup_ack_
Wait for lease update ack from backup?
bool amSendingLeaseUpdates() const
Returns boolean flag indicating whether lease updates should be sent to the partner.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
util::Optional< std::string > trust_anchor_
Trust anchor.
StateMachineConfigPtr state_machine_
State machine configuration.
void setSyncTimeout(const uint32_t sync_timeout)
Sets new lease database syncing timeout in milliseconds.
http::BasicHttpAuthPtr & getBasicAuth()
Returns non-const basic HTTP authentication.
uint32_t getMaxAckDelay() const
Returns maximum time for a client trying to communicate with DHCP server to complete the transaction...
uint32_t getDelayedUpdatesLimit() const
Returns the maximum number of lease updates which can be held unsent in the communication-recovery st...
uint32_t sync_page_limit_
Page size limit while synchronizing leases.
boost::shared_ptr< TlsContext > TlsContextPtr
The type of shared pointers to TlsContext objects.
uint32_t max_ack_delay_
Maximum DHCP message ack delay.
uint32_t getHeartbeatDelay() const
Returns heartbeat delay in milliseconds.
void setKeyFile(const util::Optional< std::string > &key)
Sets server's key-file.
Exception thrown when configuration validation fails.
util::Optional< std::string > getCertFile() const
Returns global cert-file.
boost::shared_ptr< PostHttpRequestJson > PostHttpRequestJsonPtr
Pointer to PostHttpRequestJson.
std::string getThisServerName() const
Returns name of this server.
uint32_t sync_timeout_
Timeout for syncing lease database (ms)
asiolink::TlsContextPtr tls_context_
Server TLS context.
void setHeartbeatDelay(const uint32_t heartbeat_delay)
Sets new heartbeat delay in milliseconds.
asiolink::TlsContextPtr getTlsContext() const
Returns a pointer to the server's TLS context.
void setSendLeaseUpdates(const bool send_lease_updates)
Sets boolean flag indicating whether lease updates should be sent to the partner. ...
void setRestrictCommands(bool flag)
Sets restrict-commands.
bool require_client_certs_
Require client certs flag.
boost::shared_ptr< StateConfig > StateConfigPtr
Pointer to the state configuration.
util::Optional< std::string > getKeyFile() const
Returns server's key-file.
util::Optional< std::string > getTrustAnchor() const
Returns server's trust-anchor.
void setHttpDedicatedListener(bool http_dedicated_listener)
Sets whether or not the server is configured to use its own HTTP listener.
bool restrict_commands_
Restrict commands to HA flag.
uint32_t getHttpClientThreads()
Fetches the number of threads the HTTP client should use.
void setMaxAckDelay(const uint32_t max_ack_delay)
Sets maximum time for a client trying to communicate with DHCP server to completed the transaction...
uint32_t max_rejected_lease_updates_
Limit of rejected lease updates before termination.
bool send_lease_updates_
Send lease updates to partner?
This is a base class for exceptions thrown from the DNS library module.
void setHttpListenerThreads(uint32_t http_listener_threads)
Sets the number of threads the HTTP listener should use.
Defines the logger used by the top-level component of kea-lfc.
bool amAllowingCommRecovery() const
Convenience function checking if communication recovery is allowed.
bool getRestrictCommands() const
Returns restrict-commands.
void setKeyFile(const util::Optional< std::string > &key)
Sets global key-file.
uint32_t getMaxRejectedLeaseUpdates() const
Returns a maximum number of clients for whom lease updates failed due to other than general error...
void setTrustAnchor(const util::Optional< std::string > &ca)
Sets global trust-anchor.
bool getHttpDedicatedListener()
Checks if the server is configured to use its own HTTP listener.
void setCertFile(const util::Optional< std::string > &cert)
Sets global cert-file.
void setMaxRejectedLeaseUpdates(const uint32_t max_rejected_lease_updates)
Sets the maximum number of clients for which lease updates can fail due to other than general error...
util::Optional< std::string > getKeyFile() const
Returns global key-file.
uint32_t getSyncPageLimit() const
Returns maximum number of leases per page to be fetched during database synchronization.
bool isAutoFailover() const
Checks if the auto-failover function is enabled for the server.
boost::shared_ptr< BasicHttpAuth > BasicHttpAuthPtr
Type of pointers to basic HTTP authentication objects.
util::Optional< std::string > getCertFile() const
Returns server's cert-file.
HAConfigValidationError(const char *file, size_t line, const char *what)
Role
Server's role in the High Availability setup.
boost::shared_ptr< StateMachineConfig > StateMachineConfigPtr
Pointer to a state machine configuration.
uint32_t getMaxUnackedClients() const
Returns maximum number of clients which may fail to communicate with the DHCP server before entering ...
uint32_t getHttpListenerThreads()
Fetches the number of threads the HTTP listener should use.
std::string getName() const
Returns server name.
This file defines the class StateModel.
uint32_t http_listener_threads_
Number of HTTP listener threads.
int getState() const
Returns identifier of the state.
bool amSyncingLeases() const
Returns boolean flag indicating whether the active servers should synchronize their lease databases u...
uint32_t http_client_threads_
Number of HTTP client threads.
void setSyncPageLimit(const uint32_t sync_page_limit)
Sets new page limit size for leases fetched from the partner during database synchronization.
bool amWaitingBackupAck() const
Checks if the server is configured to wait for the acknowledgments to the lease updates from the back...
http::Url getUrl() const
Returns URL of the server's control channel.
void setUrl(const http::Url &url)
Sets server's URL.
StateMachineConfigPtr getStateMachineConfig() const
Returns state machine configuration.
boost::shared_ptr< HAConfig > HAConfigPtr
Pointer to the High Availability configuration structure.
util::Optional< std::string > getTrustAnchor() const
Returns global trust-anchor.
HAMode ha_mode_
Mode of operation.
Storage for High Availability configuration.
boost::shared_ptr< PeerConfig > PeerConfigPtr
Pointer to the server's configuration.