Kea 2.7.6
|
Namespaces | |
namespace | detail |
namespace | encode |
namespace | file |
namespace | io |
namespace | str |
namespace | unittests |
Classes | |
struct | CSCallbackSet |
Embodies a named set of CriticalSection callbacks. More... | |
class | CSCallbackSetList |
Maintains list of unique CSCallbackSets. More... | |
class | CSVFile |
Provides input/output access to CSV files. More... | |
class | CSVFileError |
Exception thrown when an error occurs during CSV file processing. More... | |
class | CSVRow |
Represents a single row of the CSV file. More... | |
struct | Hash64 |
Hash implementation based on Fowler-Noll-Vo hash function. More... | |
class | InputBuffer |
The InputBuffer class is a buffer abstraction for manipulating read-only data. More... | |
class | InvalidTime |
A standard DNS (or ISC) module exception that is thrown if a time conversion function encounters bad input. More... | |
class | LabeledValue |
Implements the concept of a constant value with a text label. More... | |
class | LabeledValueError |
Thrown if an error is encountered handling a LabeledValue. More... | |
class | LabeledValueSet |
Implements a set of unique LabeledValues. More... | |
class | MemorySegment |
Memory Segment Class. More... | |
class | MemorySegmentError |
General error that can be thrown by a MemorySegment implementation. More... | |
class | MemorySegmentGrown |
Exception that is thrown, when allocating space in a MemorySegment results in growing the underlying segment. More... | |
class | MemorySegmentLocal |
malloc/free based Memory Segment class More... | |
class | MemorySegmentOpenError |
Exception that can be thrown when constructing a MemorySegment object. More... | |
class | MultiThreadingCriticalSection |
RAII class creating a critical section. More... | |
struct | MultiThreadingLock |
RAII lock object to protect the code in the same scope with a mutex. More... | |
class | MultiThreadingMgr |
Multi Threading Manager. More... | |
class | Optional |
A template representing an optional value. More... | |
class | OutputBuffer |
The OutputBuffer class is a buffer abstraction for manipulating mutable data. More... | |
class | PIDCantReadPID |
Exception thrown when an error occurs trying to read a PID from an opened file. More... | |
class | PIDFile |
Class to help with processing PID files. More... | |
class | PIDFileError |
Exception thrown when an error occurs during PID file processing. More... | |
class | ReadLockGuard |
Read mutex RAII handler. More... | |
class | ReadWriteMutex |
Read-Write Mutex. More... | |
class | ReconnectCtl |
Warehouses reconnect control values. More... | |
class | StagedValue |
This class implements set/commit mechanism for a single object. More... | |
class | State |
Defines a State within the State Model. More... | |
class | StateModel |
Implements a finite state machine. More... | |
class | StateModelError |
Thrown if the state machine encounters a general error. More... | |
class | StateSet |
Implements a unique set or dictionary of states. More... | |
class | Stopwatch |
Utility class to measure code execution times. More... | |
class | StopwatchImpl |
Stopwatch class implementation. More... | |
struct | ThreadPool |
Defines a thread pool which uses a thread pool queue for managing work items. More... | |
class | Triplet |
This template specifies a parameter value. More... | |
class | UnlockGuard |
Unlock Guard. More... | |
class | VersionedColumn |
Contains the metadata for a single column in a file. More... | |
class | VersionedCSVFile |
Implements a CSV file that supports multiple versions of the file's "schema". More... | |
class | VersionedCSVFileError |
Exception thrown when an error occurs during CSV file processing. More... | |
class | WatchedThread |
Provides a thread and controls for monitoring its activities. More... | |
class | WatchSocket |
Provides an IO "ready" semaphore for use with select() or poll() WatchSocket exposes a single open file descriptor, the "select-fd" which can be marked as being ready to read (i.e. More... | |
class | WatchSocketError |
Exception thrown if an error occurs during IO source open. More... | |
class | WriteLockGuard |
Write mutex RAII handler. More... | |
Typedefs | |
typedef LabeledValue | Event |
Define an Event. | |
typedef LabeledValuePtr | EventPtr |
Define Event pointer. | |
typedef boost::shared_ptr< InputBuffer > | InputBufferPtr |
Type of pointers to input buffer. | |
using | int128_t = boost::multiprecision::checked_int128_t |
typedef std::map< unsigned int, LabeledValuePtr > | LabeledValueMap |
Defines a map of pointers to LabeledValues keyed by value. | |
typedef boost::shared_ptr< LabeledValue > | LabeledValuePtr |
Defines a shared pointer to a LabeledValue instance. | |
typedef boost::shared_ptr< OutputBuffer > | OutputBufferPtr |
Type of pointers to output buffers. | |
typedef boost::shared_ptr< PIDFile > | PIDFilePtr |
Defines a shared pointer to a PIDFile. | |
typedef boost::shared_ptr< ReconnectCtl > | ReconnectCtlPtr |
Pointer to an instance of ReconnectCtl. | |
typedef std::function< void()> | StateHandler |
Defines a pointer to an instance method for handling a state. | |
typedef boost::shared_ptr< StateModel > | StateModelPtr |
Defines a pointer to a StateModel. | |
typedef boost::shared_ptr< State > | StatePtr |
Defines a shared pointer to a State. | |
typedef boost::shared_ptr< std::thread > | ThreadPtr |
Thread pointer type. | |
using | uint128_t = boost::multiprecision::checked_uint128_t |
typedef boost::shared_ptr< VersionedColumn > | VersionedColumnPtr |
Defines a smart pointer to VersionedColumn. | |
typedef boost::shared_ptr< WatchedThread > | WatchedThreadPtr |
Defines a pointer to a WatchedThread. | |
typedef boost::shared_ptr< WatchSocket > | WatchSocketPtr |
Defines a smart pointer to an instance of a WatchSocket. | |
Enumerations | |
enum | DhcpSpace { DHCPv4 , DHCPv6 } |
enum class | OnFailAction { STOP_RETRY_EXIT , SERVE_RETRY_EXIT , SERVE_RETRY_CONTINUE } |
Type of action to take on connection loss. More... | |
enum | StatePausing { STATE_PAUSE_ALWAYS , STATE_PAUSE_NEVER , STATE_PAUSE_ONCE } |
State machine pausing modes. More... | |
Functions | |
bool | areDoublesEquivalent (double a, double b, double tolerance=0.000001) |
Tests two doubles for equivalence within a given tolerance. | |
std::string | clockToText (std::chrono::system_clock::time_point t, size_t fsecs_precision=MAX_FSECS_PRECISION) |
Converts chrono time point structure to text. | |
template<DhcpSpace D> | |
char const * | cStringDhcpSpace () |
Provides the C string representation of the DHCP space. | |
template<> | |
char const * | cStringDhcpSpace< DHCPv4 > () |
template<> | |
char const * | cStringDhcpSpace< DHCPv6 > () |
std::string | durationToText (boost::posix_time::time_duration dur, size_t fsecs_precision=MAX_FSECS_PRECISION) |
Converts StatsDuration to text. | |
template<typename Duration > | |
std::string | durationToText (Duration dur, size_t fsecs_precision=MAX_FSECS_PRECISION) |
Converts StatsDuration to text. | |
template std::string | durationToText< steady_clock::duration > (steady_clock::duration dur, size_t fsecs_precision) |
template std::string | durationToText< system_clock::duration > (system_clock::duration dur, size_t fsecs_precision) |
template<typename T > | |
bool | equalValues (const T &ptr1, const T &ptr2) |
This function checks if two pointers are non-null and values are equal. | |
template<typename Iterator > | |
void | fillRandom (Iterator begin, Iterator end) |
Fill in specified range with a random data. | |
template<DhcpSpace D> | |
std::string | formatDhcpSpace (char const *const format_string) |
Replaces all occurrences of {} with 4 or 6 based on the templated DHCP space. | |
template<typename Iterator > | |
bool | isRangeZero (Iterator begin, Iterator end) |
Checks if specified range in a container contains only zeros. | |
template<typename T > | |
bool | nullOrEqualValues (const T &ptr1, const T &ptr2) |
This function checks if two pointers are both null or both are non-null and they point to equal values. | |
std::ostream & | operator<< (std::ostream &os, const CSVRow &row) |
Overrides standard output stream operator for CSVRow object. | |
std::ostream & | operator<< (std::ostream &os, const LabeledValue &vlp) |
Dumps the label to ostream. | |
template<typename T > | |
std::ostream & | operator<< (std::ostream &os, const Optional< T > &optional_value) |
Inserts an optional value to a stream. | |
std::string | ptimeToText (boost::posix_time::ptime t, size_t fsecs_precision=MAX_FSECS_PRECISION) |
Converts ptime structure to text. | |
template<typename uint_t > | |
uint_t | readUint (void const *const buffer, size_t const length) |
Read an unsigned integer from given buffer. | |
uint16_t | readUint16 (void const *const buffer, size_t const length) |
uint16_t wrapper over readUint. | |
uint32_t | readUint32 (void const *const buffer, size_t const length) |
uint32_t wrapper over readUint. | |
uint64_t | readUint64 (void const *const buffer, size_t const length) |
uint16_t wrapper over readUint. | |
template<typename uint_t > | |
uint8_t * | writeUint (uint_t const value, void *const buffer, size_t const length) |
Write the given unsigned integer to the given buffer. | |
uint8_t * | writeUint16 (uint16_t const value, void *const buffer, size_t const length) |
uint16_t wrapper over writeUint. | |
uint8_t * | writeUint32 (uint32_t const value, void *const buffer, size_t const length) |
uint32_t wrapper over writeUint. | |
uint8_t * | writeUint64 (uint64_t const value, void *const buffer, size_t const length) |
uint64_t wrapper over writeUint. | |
DNSSEC time conversion functions. | |
These functions convert between times represented in seconds (in integer) since epoch and those in the textual form used in the RRSIG records. For integers we provide both 32-bit and 64-bit versions. The RRSIG expiration and inception fields are both 32-bit unsigned integers, so 32-bit versions would be more useful for protocol operations. However, with 32-bit integers we need to take into account wrap-around points and compare values using the serial number arithmetic as specified in RFC4034, which would be more error prone. We therefore provide 64-bit versions, too. The timezone is always UTC for these functions. | |
string | timeToText64 (uint64_t value) |
Convert integral DNSSEC time to textual form, 64-bit version. | |
string | timeToText32 (uint32_t value) |
Convert integral DNSSEC time to textual form, 32-bit version. | |
uint64_t | timeFromText64 (const std::string &time_txt) |
Convert textual DNSSEC time to integer, 64-bit version. | |
uint32_t | timeFromText32 (const std::string &time_txt) |
Convert textual DNSSEC time to integer, 32-bit version. | |
Variables | |
const size_t | MAX_FSECS_PRECISION =boost::posix_time::time_duration::num_fractional_digits() |
The number of digits of fractional seconds supplied by the underlying class, boost::posix_time. | |
typedef LabeledValue isc::util::Event |
Define an Event.
Definition at line 31 of file state_model.h.
typedef LabeledValuePtr isc::util::EventPtr |
Define Event pointer.
Definition at line 34 of file state_model.h.
typedef boost::shared_ptr<InputBuffer> isc::util::InputBufferPtr |
using isc::util::int128_t = boost::multiprecision::checked_int128_t |
typedef std::map<unsigned int, LabeledValuePtr> isc::util::LabeledValueMap |
Defines a map of pointers to LabeledValues keyed by value.
Definition at line 95 of file labeled_value.h.
typedef boost::shared_ptr<LabeledValue> isc::util::LabeledValuePtr |
Defines a shared pointer to a LabeledValue instance.
Definition at line 92 of file labeled_value.h.
typedef boost::shared_ptr<OutputBuffer> isc::util::OutputBufferPtr |
typedef boost::shared_ptr<PIDFile> isc::util::PIDFilePtr |
Defines a shared pointer to a PIDFile.
Definition at line 92 of file pid_file.h.
typedef boost::shared_ptr<ReconnectCtl> isc::util::ReconnectCtlPtr |
Pointer to an instance of ReconnectCtl.
Definition at line 138 of file reconnect_ctl.h.
typedef std::function<void()> isc::util::StateHandler |
Defines a pointer to an instance method for handling a state.
Definition at line 37 of file state_model.h.
typedef boost::shared_ptr<StateModel> isc::util::StateModelPtr |
Defines a pointer to a StateModel.
Definition at line 846 of file state_model.h.
typedef boost::shared_ptr<State> isc::util::StatePtr |
Defines a shared pointer to a State.
Definition at line 111 of file state_model.h.
typedef boost::shared_ptr<std::thread> isc::util::ThreadPtr |
Thread pointer type.
Definition at line 22 of file watched_thread.h.
using isc::util::uint128_t = boost::multiprecision::checked_uint128_t |
typedef boost::shared_ptr<VersionedColumn> isc::util::VersionedColumnPtr |
Defines a smart pointer to VersionedColumn.
Definition at line 53 of file versioned_csv_file.h.
typedef boost::shared_ptr<WatchedThread> isc::util::WatchedThreadPtr |
Defines a pointer to a WatchedThread.
Definition at line 140 of file watched_thread.h.
typedef boost::shared_ptr<WatchSocket> isc::util::WatchSocketPtr |
Defines a smart pointer to an instance of a WatchSocket.
Definition at line 138 of file watch_socket.h.
enum isc::util::DhcpSpace |
Enumerator | |
---|---|
DHCPv4 | |
DHCPv6 |
Definition at line 17 of file dhcp_space.h.
|
strong |
Type of action to take on connection loss.
Enumerator | |
---|---|
STOP_RETRY_EXIT | |
SERVE_RETRY_EXIT | |
SERVE_RETRY_CONTINUE |
Definition at line 17 of file reconnect_ctl.h.
State machine pausing modes.
Supported modes are:
Enumerator | |
---|---|
STATE_PAUSE_ALWAYS | |
STATE_PAUSE_NEVER | |
STATE_PAUSE_ONCE |
Definition at line 45 of file state_model.h.
|
inline |
Tests two doubles for equivalence within a given tolerance.
a | comparison operand one |
b | comparison operand two |
tolerance | the amount by which the two values may differ and still be considered "equal". |
std::string isc::util::clockToText | ( | std::chrono::system_clock::time_point | t, |
size_t | fsecs_precision = MAX_FSECS_PRECISION ) |
Converts chrono time point structure to text.
This is Kea implementation for converting time point to strings.
t | time point value to convert to text |
fsecs_precision | number of digits of precision for fractional seconds. Zero omits the value. |
Definition at line 19 of file chrono_time_utils.cc.
References MAX_FSECS_PRECISION.
Referenced by isc::stats::Observation::getJSON().
char const * isc::util::cStringDhcpSpace | ( | ) |
Provides the C string representation of the DHCP space.
D | DHCP space |
Referenced by formatDhcpSpace().
char const * isc::util::cStringDhcpSpace< DHCPv4 > | ( | ) |
Definition at line 15 of file dhcp_space.cc.
char const * isc::util::cStringDhcpSpace< DHCPv6 > | ( | ) |
Definition at line 20 of file dhcp_space.cc.
std::string isc::util::durationToText | ( | boost::posix_time::time_duration | dur, |
size_t | fsecs_precision = MAX_FSECS_PRECISION ) |
Converts StatsDuration to text.
This is Kea equivalent of boost::posix_time::to_simple_string(time_duration). See ptimeToText for explanation why we chose our own implementation.
dur | duration value to convert to text |
fsecs_precision | number of digits of precision for fractional seconds. Default is given by boost::posix_time::time_duration::num_fractional_digits(). Zero omits the value. |
Definition at line 25 of file boost_time_utils.cc.
References MAX_FSECS_PRECISION.
Referenced by isc::stats::Observation::getJSON(), and ptimeToText().
std::string isc::util::durationToText | ( | Duration | dur, |
size_t | fsecs_precision = MAX_FSECS_PRECISION ) |
Converts StatsDuration to text.
See clockToText for explanation why we chose our own implementation.
Duration | duration type instance for instance std::chrono::system_clock::duration . |
dur | duration value to convert to text |
fsecs_precision | number of digits of precision for fractional seconds. Zero omits the value. |
Definition at line 55 of file chrono_time_utils.cc.
References MAX_FSECS_PRECISION.
template std::string isc::util::durationToText< steady_clock::duration > | ( | steady_clock::duration | dur, |
size_t | fsecs_precision ) |
template std::string isc::util::durationToText< system_clock::duration > | ( | system_clock::duration | dur, |
size_t | fsecs_precision ) |
|
inline |
This function checks if two pointers are non-null and values are equal.
This function performs the typical comparison of values encapsulated by the smart pointers, with checking if the pointers are non-null.
ptr1 | First pointer. |
ptr2 | Second pointer. |
T | Pointer type, e.g. boost::shared_ptr, or boost::scoped_ptr. |
Definition at line 27 of file pointer_util.h.
Referenced by isc::dhcp::Lease4::belongsToClient(), isc::dhcp::Dhcpv6Srv::extendIA_NA(), isc::dhcp::Dhcpv6Srv::extendIA_PD(), and nullOrEqualValues().
void isc::util::fillRandom | ( | Iterator | begin, |
Iterator | end ) |
Fill in specified range with a random data.
Make sure that random number generator is initialized properly. Otherwise you will get the same pseudo-random sequence after every start of your process. Calling srand() is enough. This method uses default rand(), which is usually a LCG pseudo-random number generator, so it is not suitable for security purposes. Please use cryptolink RNG if you are doing anything related with security.
PRNG initialization is left out of this function on purpose. It may be initialized to specific value on purpose, e.g. to repeat exactly the same sequence in a test.
begin | |
end |
Definition at line 52 of file range_utilities.h.
Referenced by isc::dhcp::DUIDFactory::createEN().
std::string isc::util::formatDhcpSpace | ( | char const *const | format_string | ) |
Replaces all occurrences of {} with 4 or 6 based on the templated DHCP space.
D | DHCP space |
Definition at line 36 of file dhcp_space.h.
References cStringDhcpSpace().
bool isc::util::isRangeZero | ( | Iterator | begin, |
Iterator | end ) |
Checks if specified range in a container contains only zeros.
begin | beginning of the range |
end | end of the range |
Definition at line 29 of file range_utilities.h.
|
inline |
This function checks if two pointers are both null or both are non-null and they point to equal values.
ptr1 | First pointer. |
ptr2 | Second pointer. |
T | Pointer type, e.g. boost::shared_ptr, or boost::scoped_ptr. |
Definition at line 42 of file pointer_util.h.
References equalValues().
Referenced by isc::dhcp::Lease4::operator==(), and isc::dhcp::Lease6::operator==().
std::ostream & isc::util::operator<< | ( | std::ostream & | os, |
const CSVRow & | row ) |
Overrides standard output stream operator for CSVRow
object.
The resulting string of characters is the same as the one returned by CSVRow::render
function.
os | Output stream. |
row | Object representing a CSV file row. |
Definition at line 100 of file csv_file.cc.
References isc::util::CSVRow::render().
std::ostream & isc::util::operator<< | ( | std::ostream & | os, |
const LabeledValue & | vlp ) |
Dumps the label to ostream.
Definition at line 51 of file labeled_value.cc.
References isc::util::LabeledValue::getLabel().
std::ostream & isc::util::operator<< | ( | std::ostream & | os, |
const Optional< T > & | optional_value ) |
Inserts an optional value to a stream.
This function overloads the global operator<< to behave as in ostream::operator<<
but applied to Optional
objects.
os | A std::ostream object to which the value is inserted. |
optional_value | An Optional object to be inserted into a stream. |
Type | of the value encapsulated by the Optional object. |
Definition at line 191 of file optional.h.
References isc::util::Optional< T >::get().
std::string isc::util::ptimeToText | ( | boost::posix_time::ptime | t, |
size_t | fsecs_precision = MAX_FSECS_PRECISION ) |
Converts ptime structure to text.
This is Kea implementation for converting ptime to strings. It's a functional equivalent of boost::posix_time::to_simple_string. We do not use it, though, because it would introduce unclear dependency on boost_time_date library. First, we try to avoid depending on boost libraries (we tend to use only the headers). Second, this dependency is system specific, i.e. it is required on Ubuntu and FreeBSD, but doesn't seem to be needed on OS X. Since the functionality needed is minor, we decided to reimplement it on our own, rather than introduce extra dependencies. This explanation also applies to durationToText.
t | ptime value to convert to text |
fsecs_precision | number of digits of precision for fractional seconds. Default is given by boost::posix_time::time_duration::num_fractional_digits(). Zero omits the value. |
Definition at line 14 of file boost_time_utils.cc.
References durationToText().
Referenced by isc::stat_cmds::LeaseStatCmdsImpl::createResultSet(), isc::ha::CommunicationState::getReport(), isc::perfmon::PerfMonMgr::perfmonGetAllDurationsHandler(), isc::ha::HAService::processStatusGet(), isc::perfmon::PerfMonMgr::reportAlarm(), isc::perfmon::MonitoredDuration::toElement(), and isc::perfmon::MonitoredDuration::toValueRow().
uint_t isc::util::readUint | ( | void const *const | buffer, |
size_t const | length ) |
Read an unsigned integer from given buffer.
uint_t | Data type of the unsigned integer. |
buffer | Data buffer at least two bytes long of which the first bytes are assumed to represent an unsigned integer in network-byte order. |
length | Length of the data buffer. |
Definition at line 27 of file io.h.
References isc_throw.
Referenced by readUint16(), readUint32(), and readUint64().
|
inline |
uint16_t wrapper over readUint.
Definition at line 76 of file io.h.
References readUint().
Referenced by isc::dhcp::DUIDFactory::createLL(), isc::dhcp::DUIDFactory::createLLT(), isc::dns::TSIGContext::TSIGContextImpl::digestDNSMessage(), isc::dhcp::TokenInt16ToText::evaluate(), isc::dhcp::TokenUInt16ToText::evaluate(), isc::dhcp::Pkt6::getMACFromDUID(), isc::dhcp::Option::getUint16(), isc::asiolink::TCPSocket< C >::processReceivedData(), isc::asiolink::TLSSocket< C >::processReceivedData(), isc::dhcp::OptionDataTypeUtil::readInt(), isc::dhcp::OptionDataTypeUtil::readPsid(), isc::dhcp::OptionDataTypeUtil::readTuple(), isc::asiodns::IOFetchData::responseOK(), isc::dhcp::OpaqueDataTuple::unpack(), isc::dhcp::Option6StatusCode::unpack(), isc::dhcp::OptionInt< T >::unpack(), isc::dhcp::OptionIntArray< T >::unpack(), isc::dhcp::Option6Dnr::unpackAddresses(), isc::dhcp::DnrInstance::unpackDnrInstanceDataLength(), isc::dhcp::LibDHCP::unpackOptions6(), isc::dhcp::DnrInstance::unpackServicePriority(), isc::dhcp::DnrInstance::unpackSvcParams(), and isc::dhcp::LibDHCP::unpackVendorOptions6().
|
inline |
uint32_t wrapper over readUint.
Definition at line 82 of file io.h.
References readUint().
Referenced by isc::dhcp::Option4AddrLst::Option4AddrLst(), isc::dhcp::DUIDFactory::createEN(), isc::dhcp::DUIDFactory::createLLT(), isc::dhcp::TokenInt32ToText::evaluate(), isc::dhcp::TokenUInt32ToText::evaluate(), isc::dhcp::Option::getUint32(), isc::dhcp::OptionDataTypeUtil::readInt(), isc::dhcp::Option6IA::unpack(), isc::dhcp::Option6IAAddr::unpack(), isc::dhcp::Option6IAPrefix::unpack(), isc::dhcp::OptionInt< T >::unpack(), isc::dhcp::OptionIntArray< T >::unpack(), isc::dhcp::OptionVendor::unpack(), isc::dhcp::OptionVendorClass::unpack(), and isc::dhcp::DnrInstance::unpackAddresses().
|
inline |
uint16_t wrapper over readUint.
Definition at line 88 of file io.h.
References readUint().
Referenced by isc::dhcp::Option6Auth::unpack().
uint32_t isc::util::timeFromText32 | ( | const std::string & | time_txt | ) |
Convert textual DNSSEC time to integer, 32-bit version.
This version is the same as timeFromText64()
except that the return value is wrapped around to an unsigned 32-bit integer, simply dropping the upper 32 bits.
time_txt | Textual time in the form of YYYYMMDDHHmmSS |
time_txt
as uint_32 Definition at line 188 of file time_utils.cc.
References timeFromText64().
uint64_t isc::util::timeFromText64 | ( | const std::string & | time_txt | ) |
Convert textual DNSSEC time to integer, 64-bit version.
The textual form must only consist of digits and be in the form of YYYYMMDDHHmmSS, where:
For all fields the range includes the begin and end values. Note that 60 is allowed for 'SS', intending a leap second, although in real operation it's unlikely to be specified.
If the given text is valid, this function converts it to an unsigned 64-bit number of seconds since epoch (1 January 1970 00:00:00) and returns the converted value. 64 bits are sufficient to represent all possible values for the valid format uniquely, so there is no overflow.
InvalidTime
.time_txt | Textual time in the form of YYYYMMDDHHmmSS |
time_txt
InvalidTime | The given textual representation is invalid. |
Definition at line 149 of file time_utils.cc.
References isc_throw.
Referenced by isc::dhcp_ddns::NameChangeRequest::setLeaseExpiresOn(), and timeFromText32().
std::string isc::util::timeToText32 | ( | uint32_t | value | ) |
Convert integral DNSSEC time to textual form, 32-bit version.
This version is the same as timeToText64()
, but the time value is expected to be the lower 32 bits of the full 64-bit value. These two will be different on and after a certain point of time in year 2106, so this function internally resolves the ambiguity using the current system time at the time of function call; it first identifies the range of [N*2^32 - 2^31, N*2^32 + 2^31) that contains the current time, and interprets value
in the context of that range. It then applies the same process as timeToText64()
.
There is one important exception in this processing, however. Until 19 Jan 2038 03:14:08 (2^31 seconds since epoch), this range would contain time before epoch. In order to ensure the returned value is also a valid input to timeFromText
, this function uses a special range [0, 2^32) until that time. As a result, all upper half of the 32-bit values are treated as a future time. For example, 2^32-1 (the highest value in 32-bit unsigned integers) will be converted to "21060207062815", instead of "19691231235959".
value | Seconds since epoch to be converted. |
value
in the form of YYYYMMDDHHmmSS. Definition at line 133 of file time_utils.cc.
References isc::util::detail::getTimeWrapper(), and timeToText64().
std::string isc::util::timeToText64 | ( | uint64_t | value | ) |
Convert integral DNSSEC time to textual form, 64-bit version.
This function takes an integer that would be seconds since epoch and converts it in the form of YYYYMMDDHHmmSS. For example, if value
is 0, it returns "19700101000000". If the value corresponds to a point of time on and after year 10,000, which cannot be represented in the YYYY... form, an exception of class InvalidTime
will be thrown.
value | Seconds since epoch to be converted. |
value
in the form of YYYYMMDDHHmmSS.InvalidTime | The given time specifies on or after year 10,000. |
Other | A standard exception, if resource allocation for the returned text fails. |
Definition at line 85 of file time_utils.cc.
References isc_throw.
Referenced by isc::dhcp_ddns::NameChangeRequest::getLeaseExpiresOnStr(), and timeToText32().
uint8_t * isc::util::writeUint | ( | uint_t const | value, |
void *const | buffer, | ||
size_t const | length ) |
Write the given unsigned integer to the given buffer.
uint_t | Data type of the unsigned integer. |
value | Value to convert. |
buffer | Data buffer at least two bytes long into which the unsigned integer value is written in network-byte order. |
length | Length of the data buffer. |
Definition at line 56 of file io.h.
References isc_throw.
Referenced by writeUint16(), writeUint32(), and writeUint64().
|
inline |
uint16_t wrapper over writeUint.
Definition at line 94 of file io.h.
References writeUint().
Referenced by isc::dhcp::DUIDFactory::createEN(), isc::dhcp::DUIDFactory::createLL(), isc::dhcp::DUIDFactory::createLLT(), isc::dhcp::Option::setUint16(), isc::dhcp::OptionDataTypeUtil::writeInt(), isc::dhcp::OptionDataTypeUtil::writePsid(), isc::dhcp::OptionDataTypeUtil::writeTuple(), and isc::dhcp::OptionDataTypeUtil::writeTuple().
|
inline |
uint32_t wrapper over writeUint.
Definition at line 100 of file io.h.
References writeUint().
Referenced by isc::dhcp::DUIDFactory::createEN(), isc::dhcp::DUIDFactory::createLLT(), isc::dhcp::Option::setUint32(), and isc::dhcp::OptionDataTypeUtil::writeInt().
|
inline |
uint64_t wrapper over writeUint.
Definition at line 106 of file io.h.
References writeUint().
const size_t isc::util::MAX_FSECS_PRECISION =boost::posix_time::time_duration::num_fractional_digits() |
The number of digits of fractional seconds supplied by the underlying class, boost::posix_time.
The number of digits of fractional seconds supplied by the underlying class, std::chrono::time_point.
Typically 6 = microseconds.
Definition at line 18 of file boost_time_utils.h.
Referenced by clockToText(), durationToText(), and durationToText().