20using TimeStamp = std::chrono::time_point<std::chrono::system_clock>;
74 uint32_t min_echos = 1, uint32_t reply_timeout = 100,
97 static TimeStamp min_time = std::chrono::system_clock::time_point::min();
234 return (parking_lot_);
240 uint32_t min_echos_ = 0;
243 uint32_t reply_timeout_ = 0;
246 uint32_t echos_sent_ = 0;
The IOAddress class represents an IP addresses (version agnostic)
const TimeStamp & getNextExpiry() const
Fetches the time at which the WAITING_FOR_REPLY state expires(ed)
const TimeStamp & getLastEchoSentTime() const
Fetches the timestamp of when the most recent ECHO REQUEST was sent.
State getState() const
Fetches the current state.
void setEchosSent(uint32_t value)
Sets the number of ECHO REQUESTs sent.
void setMinEchos(uint32_t value)
Sets the minimum number of ECHO REQUESTs.
isc::dhcp::Lease4Ptr getLease() const
Returns the candidate lease whose address is the target to check.
void setState(const State &value)
Sets the state.
bool isWaitingForReply() const
Returns true if state is WAITING_FOR_REPLY.
static const TimeStamp & MIN_TIME()
Fetches the minimum timestamp.
uint32_t getReplyTimeout() const
Fetches the reply timeout (milliseconds)
uint32_t getMinEchos() const
Fetches the minimum number of ECHO REQUESTs.
void setSendWaitStart(const TimeStamp &value)
Sets the send wait start timestamp.
isc::dhcp::Pkt4Ptr getQuery() const
Returns the query that instigated this check.
const TimeStamp & getCreatedTime() const
Fetches the time at which the context was created.
void beginWaitingToSend(const TimeStamp &begin_time=PingContext::now())
Enters WAITING_TO_SEND state.
bool isWaitingToSend() const
Returns true if state is WAITING_TO_SEND.
static const TimeStamp & EMPTY_TIME()
Fetches an empty timestamp.
PingContext(isc::dhcp::Lease4Ptr &lease, isc::dhcp::Pkt4Ptr &query, uint32_t min_echos=1, uint32_t reply_timeout=100, isc::hooks::ParkingLotHandlePtr &parking_lot=EMPTY_LOT())
Constructor.
static TimeStamp now()
Fetches the current timestamp (UTC/milliseconds precision)
isc::hooks::ParkingLotHandlePtr getParkingLot()
Fetches the parking lot used for this context.
void setNextExpiry(const TimeStamp &value)
Sets the timestamp which specifies the time at which the WAITING_FOR_REPLY state expires.
uint32_t getEchosSent() const
Fetches the number of ECHO REQUESTs sent.
State
Defines PingContext life cycle states.
const TimeStamp & getSendWaitStart() const
Fetches the time the context went into WAITING_TO_SEND state.
virtual ~PingContext()=default
Destructor.
static std::string stateToString(const State &state)
Converts a State to a string.
static hooks::ParkingLotHandlePtr & EMPTY_LOT()
Fetches an empty parking lot handle.
void setLastEchoSentTime(const TimeStamp &value)
Sets the timestamp the most recent ECHO REQUEST was sent.
void beginWaitingForReply(const TimeStamp &begin_time=PingContext::now())
Enters WAITING_TO_REPLY state.
const isc::asiolink::IOAddress & getTarget() const
Fetches the IP address that is under test.
void setReplyTimeout(uint32_t value)
Sets the reply timeout.
static State stringToState(const std::string &state_str)
Converts a string to State.
boost::shared_ptr< Pkt4 > Pkt4Ptr
A pointer to Pkt4 object.
boost::shared_ptr< Lease4 > Lease4Ptr
Pointer to a Lease4 structure.
boost::shared_ptr< ParkingLotHandle > ParkingLotHandlePtr
Pointer to the parking lot handle.
std::chrono::time_point< std::chrono::system_clock > TimeStamp
Specifies the type for time stamps.
boost::shared_ptr< PingContext > PingContextPtr
Defines a shared pointer to a PingContext.
Defines the logger used by the top-level component of kea-lfc.