19#include <boost/shared_ptr.hpp>
102 void setName(
const std::string& name);
118 return (trust_anchor_);
178 void setRole(
const std::string& role);
198 return (auto_failover_);
206 auto_failover_ = auto_failover;
211 return (basic_auth_);
216 return (basic_auth_);
321 std::map<int, StateConfigPtr> states_;
369 void setHAMode(
const std::string& ha_mode);
This is a base class for exceptions thrown from the DNS library module.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Exception thrown when configuration validation fails.
HAConfigValidationError(const char *file, size_t line, const char *what)
std::string getLogLabel() const
Returns a string identifying a server used in logging.
Role getRole() const
Returns server's role.
util::Optional< std::string > getTrustAnchor() const
Returns server's trust-anchor.
void setKeyFile(const util::Optional< std::string > &key)
Sets server's key-file.
void setAutoFailover(const bool auto_failover)
Enables/disables auto-failover function for the server.
void setUrl(const http::Url &url)
Sets server's URL.
void addBasicAuthHttpHeader(http::PostHttpRequestJsonPtr request) const
Adds a basic HTTP authentication header to a request when credentials are specified.
bool isAutoFailover() const
Checks if the auto-failover function is enabled for the server.
util::Optional< std::string > getKeyFile() const
Returns server's key-file.
asiolink::TlsContextPtr tls_context_
Server TLS context.
Role
Server's role in the High Availability setup.
void setRole(const std::string &role)
Sets servers role.
const http::BasicHttpAuthPtr & getBasicAuth() const
Returns const basic HTTP authentication.
std::string getName() const
Returns server name.
asiolink::TlsContextPtr getTlsContext() const
Returns a pointer to the server's TLS context.
static std::string roleToString(const HAConfig::PeerConfig::Role &role)
Returns role name.
static Role stringToRole(const std::string &role)
Decodes role provided as a string.
void setName(const std::string &name)
Sets server name.
util::Optional< std::string > getCertFile() const
Returns server's cert-file.
http::BasicHttpAuthPtr & getBasicAuth()
Returns non-const basic HTTP authentication.
http::Url getUrl() const
Returns URL of the server's control channel.
void setTrustAnchor(const util::Optional< std::string > &ca)
Sets server's trust-anchor.
void setCertFile(const util::Optional< std::string > &cert)
Sets server's cert-file.
Configuration specific to a single HA state.
util::StatePausing getPausing() const
Returns pausing mode for the given state.
int getState() const
Returns identifier of the state.
static util::StatePausing stringToPausing(const std::string &pausing)
Converts pausing mode from the textual form.
void setPausing(const std::string &pausing)
Sets pausing mode for the given state.
StateConfig(const int state)
Constructor.
static std::string pausingToString(const util::StatePausing &pausing)
Returns pausing mode in the textual form.
State machine configuration information.
StateConfigPtr getStateConfig(const int state)
Returns pointer to the state specific configuration.
StateMachineConfig()
Constructor.
Storage for High Availability configuration.
boost::shared_ptr< StateConfig > StateConfigPtr
Pointer to the state configuration.
uint32_t max_response_delay_
Max delay in response to heartbeats.
uint32_t http_listener_threads_
Number of HTTP listener threads.
static HAConfigPtr create()
Instantiates a HAConfig.
uint32_t sync_page_limit_
Page size limit while synchronizing leases.
HAMode getHAMode() const
Returns mode of operation.
util::Optional< std::string > getKeyFile() const
Returns global key-file.
std::string getThisServerName() const
Returns name of this server.
void setWaitBackupAck(const bool wait_backup_ack)
Configures the server to wait/not wait for the lease update acknowledgments from the backup servers.
bool require_client_certs_
Require client certs flag.
uint32_t getDelayedUpdatesLimit() const
Returns the maximum number of lease updates which can be held unsent in the communication-recovery st...
bool http_dedicated_listener_
Enable use of own HTTP listener.
void setHttpListenerThreads(uint32_t http_listener_threads)
Sets the number of threads the HTTP listener should use.
void setKeyFile(const util::Optional< std::string > &key)
Sets global key-file.
PeerConfigMap getAllServersConfig() const
Returns configurations of all servers.
std::map< std::string, PeerConfigPtr > PeerConfigMap
Map of the servers' configurations.
void validate()
Validates configuration.
void setHttpDedicatedListener(bool http_dedicated_listener)
Sets whether or not the server is configured to use its own HTTP listener.
uint32_t delayed_updates_limit_
Maximum number of lease updates held for later send in communication-recovery.
uint32_t getHeartbeatDelay() const
Returns heartbeat delay in milliseconds.
PeerConfigPtr getThisServerConfig() const
Returns configuration of this server.
bool getRequireClientCerts() const
Returns require-client-certs.
void setSyncPageLimit(const uint32_t sync_page_limit)
Sets new page limit size for leases fetched from the partner during database synchronization.
uint32_t max_rejected_lease_updates_
Limit of rejected lease updates before termination.
void setMaxRejectedLeaseUpdates(const uint32_t max_rejected_lease_updates)
Sets the maximum number of clients for whom the lease updates can fail due to other than general erro...
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...
void setTrustAnchor(const util::Optional< std::string > &ca)
Sets global trust-anchor.
void setHAMode(const std::string &ha_mode)
Sets new mode of operation.
HAMode ha_mode_
Mode of operation.
bool send_lease_updates_
Send lease updates to partner?
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.
bool amSendingLeaseUpdates() const
Returns boolean flag indicating whether lease updates should be sent to the partner.
void setRequireClientCerts(bool flag)
Sets require-client-certs.
void setMaxResponseDelay(const uint32_t max_response_delay)
Sets new max response delay.
bool getRestrictCommands() const
Returns restrict-commands.
void setHttpClientThreads(uint32_t http_client_threads)
Sets the number of threads the HTTP client should use.
void setSyncLeases(const bool sync_leases)
Sets boolean flag indicating whether the active servers should synchronize their lease databases upon...
uint32_t max_unacked_clients_
Maximum number of unacked clients.
void setMaxAckDelay(const uint32_t max_ack_delay)
Sets maximum time for a client trying to communicate with DHCP server to completed the transaction.
PeerConfigMap peers_
Map of peers' configurations.
bool amAllowingCommRecovery() const
Convenience function checking if communication recovery is allowed.
boost::shared_ptr< StateMachineConfig > StateMachineConfigPtr
Pointer to a state machine configuration.
uint32_t max_ack_delay_
Maximum DHCP message ack delay.
util::Optional< std::string > cert_file_
Certificate file.
uint32_t getSyncTimeout() const
Returns timeout for lease database synchronization.
bool amSyncingLeases() const
Returns boolean flag indicating whether the active servers should synchronize their lease databases u...
bool amWaitingBackupAck() const
Checks if the server is configured to wait for the acknowledgments to the lease updates from the back...
void setHeartbeatDelay(const uint32_t heartbeat_delay)
Sets new heartbeat delay in milliseconds.
uint32_t getMaxResponseDelay() const
Returns max response delay.
bool restrict_commands_
Restrict commands to HA flag.
void setThisServerName(const std::string &this_server_name)
Sets name of this server.
PeerConfigMap getOtherServersConfig() const
Returns configuration of other servers.
void setSendLeaseUpdates(const bool send_lease_updates)
Sets boolean flag indicating whether lease updates should be sent to the partner.
void setSyncTimeout(const uint32_t sync_timeout)
Sets new lease database syncing timeout in milliseconds.
PeerConfigPtr getFailoverPeerConfig() const
Returns configuration of the partner which takes part in failover.
PeerConfigPtr getPeerConfig(const std::string &name) const
Returns configuration of the specified server.
util::Optional< std::string > key_file_
Private key file.
util::Optional< std::string > getCertFile() const
Returns global cert-file.
PeerConfigPtr selectNextPeerConfig(const std::string &name)
Creates and returns pointer to the new peer's configuration.
void setRestrictCommands(bool flag)
Sets restrict-commands.
uint32_t getMaxRejectedLeaseUpdates() const
Returns a maximum number of clients for whom lease updates failed due to other than general error.
bool sync_leases_
Synchronize databases on startup?
bool wait_backup_ack_
Wait for lease update ack from backup?
uint32_t getMaxAckDelay() const
Returns maximum time for a client trying to communicate with DHCP server to complete the transaction.
StateMachineConfigPtr state_machine_
State machine configuration.
util::Optional< std::string > trust_anchor_
Trust anchor.
static HAMode stringToHAMode(const std::string &ha_mode)
Decodes HA mode provided as string.
void setCertFile(const util::Optional< std::string > &cert)
Sets global cert-file.
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.
StateMachineConfigPtr getStateMachineConfig() const
Returns state machine configuration.
uint32_t getHttpClientThreads()
Fetches the number of threads the HTTP client should use.
uint32_t http_client_threads_
Number of HTTP client threads.
util::Optional< std::string > getTrustAnchor() const
Returns global trust-anchor.
uint32_t sync_timeout_
Timeout for syncing lease database (ms)
boost::shared_ptr< PeerConfig > PeerConfigPtr
Pointer to the server's configuration.
bool enable_multi_threading_
Enable multi-threading.
uint32_t heartbeat_delay_
Heartbeat delay in milliseconds.
uint32_t getSyncPageLimit() const
Returns maximum number of leases per page to be fetched during database synchronization.
static std::string getSubnetServerName(const dhcp::ConstSubnetPtr &subnet)
Convenience function extracting a value of the ha-server-name parameter from a subnet context.
static std::string HAModeToString(const HAMode &ha_mode)
Returns HA mode name.
bool getEnableMultiThreading()
Checks if the server is configured for multi-threaded operation.
std::string this_server_name_
This server name.
void setEnableMultiThreading(bool enable_multi_threading)
Sets whether or not server is configured for multi-threaded operation.
bool getHttpDedicatedListener()
Checks if the server is configured to use its own HTTP listener.
Holds associations between objects and HA relationships.
A template representing an optional value.
boost::shared_ptr< TlsContext > TlsContextPtr
The type of shared pointers to TlsContext objects.
boost::shared_ptr< const Subnet > ConstSubnetPtr
A generic pointer to either const Subnet4 or const Subnet6 object.
boost::shared_ptr< HAConfigMapper > HAConfigMapperPtr
Pointer to an object mapping HAConfig to relationships.
HARelationshipMapper< HAConfig > HAConfigMapper
Type of an object mapping HAConfig to relationships.
boost::shared_ptr< HAConfig > HAConfigPtr
Pointer to the High Availability configuration structure.
boost::shared_ptr< BasicHttpAuth > BasicHttpAuthPtr
Type of pointers to basic HTTP authentication objects.
boost::shared_ptr< PostHttpRequestJson > PostHttpRequestJsonPtr
Pointer to PostHttpRequestJson.
StatePausing
State machine pausing modes.
Defines the logger used by the top-level component of kea-lfc.
This file defines the class StateModel.