![]() |
Kea
1.5.0
|
Namespaces | |
| detail | |
| encode | |
| io | |
| random | |
| str | |
| thread | |
| Wrappers for thread related functionality. | |
| unittests | |
Classes | |
| 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... | |
| class | Filename |
| Class to Manipulate Filenames. 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 | InvalidBufferPosition |
| A standard DNS module exception that is thrown if an out-of-range buffer operation is being performed. 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 | OptionalValue |
| Simple class representing an optional value. More... | |
| struct | OptionalValueState |
Indicate if an OptionalValue is is specified or not. 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 | ProcessSpawn |
| Utility class for spawning new processes. More... | |
| class | ProcessSpawnError |
| Exception thrown when error occurs during spawning a process. More... | |
| class | ProcessSpawnImpl |
Implementation of the ProcessSpawn class. More... | |
| struct | ProcessState |
| Type for process state. More... | |
| class | SignalSet |
| Represents a collection of signals handled in a customized way. More... | |
| class | SignalSetError |
Exception thrown when the isc::util::SignalSet class experiences an error. 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... | |
| 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 | 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... | |
Typedefs | |
| typedef boost::function< bool(int signum)> | BoolSignalHandler |
| Pointer to a signal handling function which returns bool result. More... | |
| typedef LabeledValue | Event |
| Define an Event. More... | |
| typedef LabeledValuePtr | EventPtr |
| Define Event pointer. More... | |
| typedef boost::shared_ptr< InputBuffer > | InputBufferPtr |
Pointer-like types pointing to InputBuffer or OutputBuffer. More... | |
| typedef std::map< unsigned int, LabeledValuePtr > | LabeledValueMap |
| Defines a map of pointers to LabeledValues keyed by value. More... | |
| typedef boost::shared_ptr< LabeledValue > | LabeledValuePtr |
| Defines a shared pointer to a LabeledValue instance. More... | |
| typedef boost::shared_ptr< OutputBuffer > | OutputBufferPtr |
| typedef boost::shared_ptr< PIDFile > | PIDFilePtr |
| Defines a shared pointer to a PIDFile. More... | |
| typedef std::vector< std::string > | ProcessArgs |
| Type of the container holding arguments of the executable being run as a background process. More... | |
| typedef std::map< pid_t, ProcessState > | ProcessStates |
| typedef std::list< int > | SigIntList |
| Defines a list of integer signal identifiers: SIGHUP, SIGTERM... More... | |
| typedef boost::shared_ptr< SigIntList > | SigIntListPtr |
| Pointer to a list of signal identifiers. More... | |
| typedef std::set< int > | SigIntSet |
| Defines a set of integer signal identifiers: SIGHUP, SIGTERM... More... | |
| typedef boost::shared_ptr< SigIntSet > | SigIntSetPtr |
| Pointer to a set of signal identifiers. More... | |
| typedef boost::function< void(int signum)> | SignalHandler |
| Pointer to the signal handling function. More... | |
| typedef boost::shared_ptr< SignalSet > | SignalSetPtr |
Pointer to the isc::util::SignalSet. More... | |
| typedef boost::function< void()> | StateHandler |
| Defines a pointer to an instance method for handling a state. More... | |
| typedef boost::shared_ptr< StateModel > | StateModelPtr |
| Defines a pointer to a StateModel. More... | |
| typedef boost::shared_ptr< State > | StatePtr |
| Defines a shared pointer to a State. More... | |
| typedef boost::shared_ptr< VersionedColumn > | VersionedColumnPtr |
| Defines a smart pointer to VersionedColumn. More... | |
| typedef boost::shared_ptr< WatchSocket > | WatchSocketPtr |
| Defines a smart pointer to an instance of a WatchSocket. More... | |
Enumerations | |
| enum | StatePausing { STATE_PAUSE_ALWAYS, STATE_PAUSE_NEVER, STATE_PAUSE_ONCE } |
| State machine pausing modes. More... | |
Functions | |
| std::string | durationToText (boost::posix_time::time_duration dur) |
| Converts StatsDuration to text. More... | |
| template<typename T > | |
| bool | equalValues (const T &ptr1, const T &ptr2) |
| This function checks if two pointers are non-null and values are equal. More... | |
| template<typename Iterator > | |
| void | fillRandom (Iterator begin, Iterator end) |
| Fill in specified range with a random data. More... | |
| template<typename Iterator > | |
| bool | isRangeZero (Iterator begin, Iterator end) |
| Checks if specified range in a container contains only zeros. More... | |
| 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. More... | |
| std::ostream & | operator<< (std::ostream &os, const LabeledValue &vlp) |
| Dumps the label to ostream. More... | |
| std::ostream & | operator<< (std::ostream &os, const CSVRow &row) |
Overrides standard output stream operator for CSVRow object. More... | |
| template<typename T > | |
| std::ostream & | operator<< (std::ostream &os, const OptionalValue< T > &optional_value) |
| Inserts an optional value to a stream. More... | |
| std::string | ptimeToText (boost::posix_time::ptime t) |
| Converts ptime structure to text. More... | |
| uint16_t | readUint16 (const void *buffer, size_t length) |
| Read Unsigned 16-Bit Integer from Buffer. More... | |
| uint32_t | readUint32 (const uint8_t *buffer, size_t length) |
| Read Unsigned 32-Bit Integer from Buffer. More... | |
| uint64_t | readUint64 (const uint8_t *buffer, size_t length) |
| Read Unsigned 64-Bit Integer from Buffer. More... | |
| uint8_t * | writeUint16 (uint16_t value, void *buffer, size_t length) |
| Write Unsigned 16-Bit Integer to Buffer. More... | |
| uint8_t * | writeUint32 (uint32_t value, uint8_t *buffer, size_t length) |
| Write Unsigned 32-Bit Integer to Buffer. More... | |
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. More... | |
| string | timeToText32 (const uint32_t value) |
| Convert integral DNSSEC time to textual form, 32-bit version. More... | |
| uint64_t | timeFromText64 (const std::string &time_txt) |
| Convert textual DNSSEC time to integer, 64-bit version. More... | |
| uint32_t | timeFromText32 (const std::string &time_txt) |
| Convert textual DNSSEC time to integer, 32-bit version. More... | |
| typedef boost::function<bool(int signum)> isc::util::BoolSignalHandler |
Pointer to a signal handling function which returns bool result.
The handler is expected to return true if the signal it was given has been processed (i.e. should not be recorded for deferred processing) or false in which case it will be recorded.
Definition at line 54 of file signal_set.h.
| typedef LabeledValue isc::util::Event |
Define an Event.
Definition at line 30 of file state_model.h.
| typedef LabeledValuePtr isc::util::EventPtr |
Define Event pointer.
Definition at line 33 of file state_model.h.
| typedef boost::shared_ptr<InputBuffer> isc::util::InputBufferPtr |
Pointer-like types pointing to InputBuffer or OutputBuffer.
These types are expected to be used as an argument in asynchronous callback functions. The internal reference-counting will ensure that that ongoing state information will not be lost if the object that originated the asynchronous call falls out of scope.
| 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 std::vector<std::string> isc::util::ProcessArgs |
Type of the container holding arguments of the executable being run as a background process.
Definition at line 28 of file process_spawn.h.
| typedef std::map<pid_t, ProcessState> isc::util::ProcessStates |
Definition at line 37 of file process_spawn.cc.
| typedef std::list<int> isc::util::SigIntList |
Defines a list of integer signal identifiers: SIGHUP, SIGTERM...
Definition at line 37 of file signal_set.h.
| typedef boost::shared_ptr<SigIntList> isc::util::SigIntListPtr |
Pointer to a list of signal identifiers.
Definition at line 39 of file signal_set.h.
| typedef std::set<int> isc::util::SigIntSet |
Defines a set of integer signal identifiers: SIGHUP, SIGTERM...
Definition at line 32 of file signal_set.h.
| typedef boost::shared_ptr<SigIntSet> isc::util::SigIntSetPtr |
Pointer to a set of signal identifiers.
Definition at line 34 of file signal_set.h.
| typedef boost::function<void(int signum)> isc::util::SignalHandler |
Pointer to the signal handling function.
Definition at line 47 of file signal_set.h.
| typedef boost::shared_ptr<SignalSet> isc::util::SignalSetPtr |
Pointer to the isc::util::SignalSet.
Definition at line 43 of file signal_set.h.
| typedef boost::function<void()> isc::util::StateHandler |
Defines a pointer to an instance method for handling a state.
Definition at line 36 of file state_model.h.
| typedef boost::shared_ptr<StateModel> isc::util::StateModelPtr |
Defines a pointer to a StateModel.
Definition at line 727 of file state_model.h.
| typedef boost::shared_ptr<State> isc::util::StatePtr |
Defines a shared pointer to a State.
Definition at line 110 of file state_model.h.
| 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<WatchSocket> isc::util::WatchSocketPtr |
Defines a smart pointer to an instance of a WatchSocket.
Definition at line 138 of file watch_socket.h.
State machine pausing modes.
Supported modes are:
| Enumerator | |
|---|---|
| STATE_PAUSE_ALWAYS | |
| STATE_PAUSE_NEVER | |
| STATE_PAUSE_ONCE | |
Definition at line 44 of file state_model.h.
| std::string isc::util::durationToText | ( | boost::posix_time::time_duration | dur | ) |
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.
Definition at line 25 of file boost_time_utils.cc.
Referenced by isc::stats::Observation::getJSON(), and ptimeToText().
|
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 a 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 53 of file range_utilities.h.
References isc::cryptolink::random().
Here is the call graph for this function:| 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==().
Here is the call graph for this function:| 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().
Here is the call graph for this function:| 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 69 of file csv_file.cc.
References isc::util::CSVRow::render().
Here is the call graph for this function:| std::ostream& isc::util::operator<< | ( | std::ostream & | os, |
| const OptionalValue< 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 OptionalValue objects.
| os | A std::ostream object to which the value is inserted. |
| optional_value | An OptionalValue object to be inserted into a stream. |
| Type | of the value encapsulated by the OptionalValue object. |
Definition at line 167 of file optional_value.h.
References isc::util::OptionalValue< T >::get().
Here is the call graph for this function:| std::string isc::util::ptimeToText | ( | boost::posix_time::ptime | t | ) |
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.
Definition at line 14 of file boost_time_utils.cc.
References durationToText().
Referenced by isc::stat_cmds::LeaseStatCmdsImpl::createResultSet(), and isc::stats::Observation::getJSON().
Here is the call graph for this function:
|
inline |
Read Unsigned 16-Bit Integer from Buffer.
This is essentially a copy of the isc::util::InputBuffer::readUint16. It should really be moved into a separate library.
| buffer | Data buffer at least two bytes long of which the first two bytes are assumed to represent a 16-bit integer in network-byte order. |
| length | Length of the data buffer. |
Definition at line 28 of file io_utilities.h.
References isc_throw.
Referenced by isc::dhcp::DUIDFactory::createLL(), isc::dhcp::DUIDFactory::createLLT(), isc::dns::TSIGContext::TSIGContextImpl::digestDNSMessage(), isc::dhcp::Pkt6::getMACFromDUID(), isc::dhcp::Option::getUint16(), isc::asiolink::TCPSocket< SocketCallback >::processReceivedData(), isc::dhcp::OptionDataTypeUtil::readInt(), isc::dhcp::OptionDataTypeUtil::readPsid(), isc::dhcp::OptionDataTypeUtil::readTuple(), isc::asiodns::IOFetchData::responseOK(), isc::dhcp::Option6StatusCode::unpack(), isc::dhcp::OptionInt< T >::unpack(), isc::dhcp::OptionIntArray< T >::unpack(), isc::dhcp::OpaqueDataTuple::unpack(), isc::dhcp::LibDHCP::unpackOptions6(), and isc::dhcp::LibDHCP::unpackVendorOptions6().
|
inline |
Read Unsigned 32-Bit Integer from Buffer.
| buffer | Data buffer at least four bytes long of which the first four bytes are assumed to represent a 32-bit integer in network-byte order. |
| length | Length of the data buffer. |
Definition at line 79 of file io_utilities.h.
References isc_throw.
Referenced by isc::dhcp::DUIDFactory::createEN(), isc::dhcp::DUIDFactory::createLLT(), isc::dhcp::Option::getUint32(), isc::dhcp::OptionDataTypeUtil::readInt(), isc::dhcp::Option6IA::unpack(), isc::dhcp::OptionVendor::unpack(), isc::dhcp::OptionVendorClass::unpack(), isc::dhcp::Option6IAPrefix::unpack(), isc::dhcp::OptionInt< T >::unpack(), and isc::dhcp::OptionIntArray< T >::unpack().
|
inline |
Read Unsigned 64-Bit Integer from Buffer.
| buffer | Data buffer at least four bytes long of which the first four bytes are assumed to represent a 64-bit integer in network-byte order. |
| length | Length of the data buffer. |
Definition at line 105 of file io_utilities.h.
References isc_throw.
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.
Definition at line 196 of file time_utilities.cc.
References timeFromText64().
Here is the call graph for this function:| 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.| InvalidTime | The given textual representation is invalid. |
| time_txt | Textual time in the form of YYYYMMDDHHmmSS |
time_txt Definition at line 154 of file time_utilities.cc.
References isc_throw.
Referenced by isc::dhcp_ddns::NameChangeRequest::setLeaseExpiresOn(), and timeFromText32().
| std::string isc::util::timeToText32 | ( | const 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".
Definition at line 122 of file time_utilities.cc.
References isc::util::detail::gettimeWrapper(), and timeToText64().
Here is the call graph for this function:| 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.
| InvalidTime | The given time specifies on or after year 10,000. |
| Other | A standard exception, if resource allocation for the returned text fails. |
| value | Seconds since epoch to be converted. |
value in the form of YYYYMMDDHHmmSS. Definition at line 50 of file time_utilities.cc.
References isc_throw.
Referenced by isc::dhcp_ddns::NameChangeRequest::getLeaseExpiresOnStr(), and timeToText32().
|
inline |
Write Unsigned 16-Bit Integer to Buffer.
This is essentially a copy of isc::util::OutputBuffer::writeUint16. It should really be moved into a separate library.
| value | 16-bit value to convert |
| buffer | Data buffer at least two bytes long into which the 16-bit value is written in network-byte order. |
| length | Length of the data buffer. |
Definition at line 55 of file io_utilities.h.
References isc_throw.
Referenced by isc::dhcp::DUIDFactory::createLL(), isc::dhcp::DUIDFactory::createLLT(), isc::dhcp::Option::setUint16(), isc::dhcp::OptionDataTypeUtil::writeInt(), isc::dhcp::OptionDataTypeUtil::writePsid(), and isc::dhcp::OptionDataTypeUtil::writeTuple().
|
inline |
Write Unsigned 32-Bit Integer to Buffer.
| value | 32-bit value to convert |
| buffer | Data buffer at least four bytes long into which the 32-bit value is written in network-byte order. |
| length | Length of the data buffer. |
Definition at line 136 of file io_utilities.h.
References isc_throw.
Referenced by isc::dhcp::DUIDFactory::createLLT(), isc::dhcp::Option::setUint32(), and isc::dhcp::OptionDataTypeUtil::writeInt().