17 #include <boost/shared_ptr.hpp>
89 void setName(
const std::string& name);
105 return (trust_anchor_);
165 void setRole(
const std::string& role);
185 return (auto_failover_);
193 auto_failover_ = auto_failover;
198 return (basic_auth_);
203 return (basic_auth_);
308 std::map<int, StateConfigPtr> states_;
353 void setHAMode(
const std::string& ha_mode);
StateMachineConfigPtr getStateMachineConfig() const
Returns state machine configuration.
util::StatePausing getPausing() const
Returns pausing mode for the given state.
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.
const http::BasicHttpAuthPtr & getBasicAuth() const
Returns const basic HTTP authentication.
Configuration specific to a single HA state.
util::Optional< std::string > getTrustAnchor() const
Returns server's trust-anchor.
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.
PeerConfigPtr getFailoverPeerConfig() const
Returns configuration of the partner which takes part in failover.
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...
std::string getThisServerName() const
Returns name of this server.
PeerConfigMap peers_
Map of peers' configurations.
void setThisServerName(const std::string &this_server_name)
Sets name of this server.
void setName(const std::string &name)
Sets server name.
State machine configuration information.
void setHAMode(const std::string &ha_mode)
Sets new mode of operation.
bool enable_multi_threading_
Enable multi-threading.
void setPausing(const std::string &pausing)
Sets pausing mode for the given state.
std::map< std::string, PeerConfigPtr > PeerConfigMap
Map of the servers' configurations.
static Role stringToRole(const std::string &role)
Decodes role provided as a string.
void setCertFile(const util::Optional< std::string > &cert)
Sets server's cert-file.
std::string this_server_name_
This server name.
uint32_t getMaxAckDelay() const
Returns maximum time for a client trying to communicate with DHCP server to complete the transaction...
void setMaxResponseDelay(const uint32_t max_response_delay)
Sets new max response delay.
util::Optional< std::string > getCertFile() const
Returns server's 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...
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...
StateConfigPtr getStateConfig(const int state)
Returns pointer to the state specific configuration.
StateConfig(const int state)
Constructor.
util::Optional< std::string > cert_file_
Certificate file.
uint32_t max_response_delay_
Max delay in response to heartbeats.
uint32_t getSyncTimeout() const
Returns timeout for lease database synchronization.
bool getEnableMultiThreading()
Checks if the server is configured for multi-threaded operation.
bool sync_leases_
Synchronize databases on startup?
bool http_dedicated_listener_
Enable use of own HTTP listener.
bool amWaitingBackupAck() const
Checks if the server is configured to wait for the acknowledgments to the lease updates from the back...
uint32_t getMaxUnackedClients() const
Returns maximum number of clients which may fail to communicate with the DHCP server before entering ...
bool wait_backup_ack_
Wait for lease update ack from backup?
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 sync_page_limit_
Page size limit while synchronizing leases.
uint32_t getDelayedUpdatesLimit() const
Returns the maximum number of lease updates which can be held unsent in the communication-recovery st...
PeerConfigPtr getPeerConfig(const std::string &name) const
Returns configuration of the specified server.
boost::shared_ptr< TlsContext > TlsContextPtr
The type of shared pointers to TlsContext objects.
uint32_t heartbeat_delay_
Heartbeat delay in milliseconds.
uint32_t getHeartbeatDelay() const
Returns heartbeat delay in milliseconds.
uint32_t max_ack_delay_
Maximum DHCP message ack delay.
void setKeyFile(const util::Optional< std::string > &key)
Sets server's key-file.
Exception thrown when configuration validation fails.
bool isAutoFailover() const
Checks if the auto-failover function is enabled for the server.
PeerConfigMap getAllServersConfig() const
Returns configurations of all servers.
boost::shared_ptr< PostHttpRequestJson > PostHttpRequestJsonPtr
Pointer to PostHttpRequestJson.
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.
PeerConfigMap getOtherServersConfig() const
Returns configuration of other servers.
uint32_t getMaxResponseDelay() const
Returns max response delay.
int getState() const
Returns identifier of the state.
std::string getName() const
Returns server name.
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 addBasicAuthHttpHeader(http::PostHttpRequestJsonPtr request) const
Adds a basic HTTP authentication header to a request when credentials are specified.
boost::shared_ptr< StateConfig > StateConfigPtr
Pointer to the state configuration.
util::Optional< std::string > getTrustAnchor() const
Returns global trust-anchor.
bool amSendingLeaseUpdates() const
Returns boolean flag indicating whether lease updates should be sent to the partner.
bool amSyncingLeases() const
Returns boolean flag indicating whether the active servers should synchronize their lease databases u...
void setHttpDedicatedListener(bool http_dedicated_listener)
Sets whether or not the server is configured to use its own HTTP listener.
http::Url getUrl() const
Returns URL of the server's control channel.
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...
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
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-dhcp-ddns.
uint32_t getSyncPageLimit() const
Returns maximum number of leases per page to be fetched during database synchronization.
void setKeyFile(const util::Optional< std::string > &key)
Sets global key-file.
std::string getLogLabel() const
Returns a string identifying a server used in logging.
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.
static std::string HAModeToString(const HAMode &ha_mode)
Returns HA mode name.
util::Optional< std::string > getCertFile() const
Returns global cert-file.
void setRole(const std::string &role)
Sets servers role.
HAMode getHAMode() const
Returns mode of operation.
bool amAllowingCommRecovery() const
Convenience function checking if communication recovery is allowed.
boost::shared_ptr< BasicHttpAuth > BasicHttpAuthPtr
Type of pointers to basic HTTP authentication objects.
HAConfigValidationError(const char *file, size_t line, const char *what)
Role
Server's role in the High Availability setup.
util::Optional< std::string > getKeyFile() const
Returns global key-file.
static std::string pausingToString(const util::StatePausing &pausing)
Returns pausing mode in the textual form.
boost::shared_ptr< StateMachineConfig > StateMachineConfigPtr
Pointer to a state machine configuration.
uint32_t delayed_updates_limit_
Maximum number of lease updates held for later send in communication-recovery.
static std::string roleToString(const HAConfig::PeerConfig::Role &role)
Returns role name.
Role getRole() const
Returns server's role.
uint32_t getHttpListenerThreads()
Fetches the number of threads the HTTP listener should use.
PeerConfigPtr selectNextPeerConfig(const std::string &name)
Creates and returns pointer to the new peer's configuration.
This file defines the class StateModel.
static util::StatePausing stringToPausing(const std::string &pausing)
Converts pausing mode from the textual form.
uint32_t http_listener_threads_
Number of HTTP listener threads.
void validate()
Validates configuration.
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.
void setUrl(const http::Url &url)
Sets server's URL.
static HAMode stringToHAMode(const std::string &ha_mode)
Decodes HA mode provided as string.
boost::shared_ptr< HAConfig > HAConfigPtr
Pointer to the High Availability configuration structure.
PeerConfigPtr getThisServerConfig() const
Returns configuration of this server.
HAMode ha_mode_
Mode of operation.
Storage for High Availability configuration.
boost::shared_ptr< PeerConfig > PeerConfigPtr
Pointer to the server's configuration.
util::Optional< std::string > getKeyFile() const
Returns server's key-file.