 |
Kea
1.5.0
|
Go to the documentation of this file.
7 #ifndef HA_COMMUNICATION_STATE_H
8 #define HA_COMMUNICATION_STATE_H
15 #include <boost/date_time/posix_time/posix_time.hpp>
16 #include <boost/function.hpp>
17 #include <boost/shared_ptr.hpp>
109 const boost::function<
void()>& heartbeat_impl);
119 const boost::function<
void()>& heartbeat_impl = 0);
130 return (
static_cast<bool>(
timer_));
355 virtual void analyzeMessage(
const boost::shared_ptr<dhcp::Pkt>& message);
407 virtual void analyzeMessage(
const boost::shared_ptr<dhcp::Pkt>& message);
virtual void analyzeMessage(const boost::shared_ptr< dhcp::Pkt > &message)
Checks if the DHCPv6 message appears to be unanswered.
bool isCommunicationInterrupted() const
Checks if communication with the partner is interrupted.
virtual void clearUnackedClients()=0
Removes information about clients which the partner server failed to respond to.
bool clockSkewShouldTerminate() const
Indicates whether the HA service should enter "terminated" state as a result of the clock skew exceed...
boost::shared_ptr< CommunicationState4 > CommunicationState4Ptr
Pointer to the CommunicationState4 object.
CommunicationState6(const asiolink::IOServicePtr &io_service, const HAConfigPtr &config)
Constructor.
bool isHeartbeatRunning() const
Checks if recurring heartbeat is running.
virtual void analyzeMessage(const boost::shared_ptr< dhcp::Pkt > &message)=0
Checks if the DHCP message appears to be unanswered.
bool clockSkewShouldWarn()
Indicates whether the HA service should issue a warning about high clock skew between the active serv...
void setPartnerState(const std::string &state)
Sets partner state.
virtual ~CommunicationState()
Destructor.
std::string logFormatClockSkew() const
Returns current clock skew value in the logger friendly format.
int partner_state_
Last known state of the partner server.
std::set< std::vector< uint8_t > > unacked_clients_
Holds information about the clients which the partner server failed to respond to.
boost::shared_ptr< CommunicationState6 > CommunicationState6Ptr
Pointer to the CommunicationState6 object.
void setPartnerTime(const std::string &time_text)
Provide partner's notion of time so the new clock skew can be calculated.
boost::function< void()> heartbeat_impl_
Pointer to the function providing heartbeat implementation.
boost::posix_time::time_duration clock_skew_
Clock skew between the active servers.
Defines the logger used by the top-level component of kea-dhcp-ddns.
void poke()
Pokes the communication state.
void startHeartbeat(const long interval, const boost::function< void()> &heartbeat_impl)
Starts recurring heartbeat (public interface).
boost::shared_ptr< isc::asiolink::IntervalTimer > IntervalTimerPtr
void startHeartbeatInternal(const long interval=0, const boost::function< void()> &heartbeat_impl=0)
Starts recurring heartbeat.
void stopHeartbeat()
Stops recurring heartbeat.
virtual void analyzeMessage(const boost::shared_ptr< dhcp::Pkt > &message)
Checks if the DHCPv4 message appears to be unanswered.
CommunicationState4(const asiolink::IOServicePtr &io_service, const HAConfigPtr &config)
Constructor.
boost::posix_time::ptime last_clock_skew_warn_
Holds a time when last warning about too high clock skew was issued.
virtual void clearUnackedClients()
Removes information about clients which the partner server failed to respond to.
Holds communication state between DHCPv6 servers.
bool isClockSkewGreater(const long seconds) const
Checks if the clock skew is greater than the specified number of seconds.
long interval_
Interval specified for the heartbeat.
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
asiolink::IntervalTimerPtr timer_
Interval timer triggering heartbeat commands.
boost::shared_ptr< HAConfig > HAConfigPtr
Pointer to the High Availability configuration structure.
boost::shared_ptr< CommunicationState > CommunicationStatePtr
Type of the pointer to the CommunicationState object.
virtual void clearUnackedClients()
Removes information about clients which the partner server failed to respond to.
virtual bool failureDetected() const
Checks if the partner failure has been detected based on the DHCP traffic analysis.
virtual bool failureDetected() const =0
Checks if the partner failure has been detected based on the DHCP traffic analysis.
int64_t getDurationInMillisecs() const
Returns duration between the poke time and current time.
std::multimap< std::vector< uint8_t >, std::vector< uint8_t > > unacked_clients_
Holds information about the clients which the partner server failed to respond to.
virtual bool failureDetected() const
Checks if the partner failure has been detected based on the DHCP traffic analysis.
CommunicationState(const asiolink::IOServicePtr &io_service, const HAConfigPtr &config)
Constructor.
boost::posix_time::ptime poke_time_
Last poke time.
int getPartnerState() const
Returns last known state of the partner.
Holds communication state between the two HA peers.
Holds communication state between DHCPv4 servers.
HAConfigPtr config_
High availability configuration.
asiolink::IOServicePtr io_service_
Pointer to the common IO service instance.