12 #include <boost/shared_ptr.hpp> 37 typedef boost::shared_ptr<Option>
OptionPtr;
77 const static size_t OPTION4_HDR_LEN = 2;
80 const static size_t OPTION6_HDR_LEN = 4;
114 const OptionBuffer& buf);
174 OptionBufferConstIter last);
195 static OptionPtr create(
Universe u, uint16_t type);
209 static OptionPtr create(
Universe u, uint16_t type,
const OptionBuffer& data);
228 virtual OptionPtr clone()
const;
254 virtual void unpack(OptionBufferConstIter begin,
255 OptionBufferConstIter end);
262 virtual std::string toText(
int indent = 0)
const;
270 virtual std::string toString()
const;
279 virtual std::vector<uint8_t> toBinary(
const bool include_header =
false)
const;
288 virtual std::string toHexString(
const bool include_header =
false)
const;
301 virtual uint16_t len()
const;
306 virtual uint16_t getHeaderLen()
const;
311 virtual bool valid()
const;
333 void addOption(OptionPtr opt);
340 OptionPtr getOption(uint16_t type)
const;
366 void getOptionsCopy(OptionCollection& options_copy)
const;
373 bool delOption(uint16_t type);
380 uint8_t getUint8()
const;
387 uint16_t getUint16()
const;
394 uint32_t getUint32()
const;
401 void setUint8(uint8_t value);
408 void setUint16(uint16_t value);
415 void setUint32(uint32_t value);
426 template<
typename InputIterator>
427 void setData(InputIterator first, InputIterator last) {
428 data_.assign(first, last);
436 encapsulated_space_ = encapsulated_space;
443 return (encapsulated_space_);
457 bool equals(
const OptionPtr& other)
const;
471 virtual bool equals(
const Option& other)
const;
496 template<
typename OptionType>
498 const OptionType* cast_this =
dynamic_cast<const OptionType*
>(
this);
500 return (boost::shared_ptr<OptionType>(
new OptionType(*cast_this)));
550 void unpackOptions(
const OptionBuffer& buf);
562 std::string headerToText(
const int indent = 0,
563 const std::string& type_name =
"")
const;
577 std::string suboptionsToText(
const int indent = 0)
const;
uint16_t getType() const
Returns option type (0-255 for DHCPv4, 0-65535 for DHCPv6)
Exception thrown during option unpacking This exception is thrown when an error has occurred...
boost::shared_ptr< OptionBuffer > OptionBufferPtr
pointer to a DHCP buffer
boost::shared_ptr< Option > OptionPtr
Universe
defines option universe DHCPv4 or DHCPv6
static OptionPtr factory(Option::Universe u, uint16_t type)
Factory function to create instance of option.
OptionPtr cloneInternal() const
Copies this option and returns a pointer to the copy.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Universe universe_
option universe (V4 or V6)
std::vector< uint8_t > OptionBuffer
buffer types used in DHCP code.
const OptionCollection & getOptions() const
Returns all encapsulated options.
Universe getUniverse() const
returns option universe (V4 or V6)
OptionCollection options_
collection for storing suboptions
virtual const OptionBuffer & getData() const
Returns pointer to actual data.
SkipThisOptionError(const char *file, size_t line, const char *what)
void setEncapsulatedSpace(const std::string &encapsulated_space)
Sets the name of the option space encapsulated by this option.
std::multimap< unsigned int, OptionPtr > OptionCollection
A collection of DHCP (v4 or v6) options.
The OutputBuffer class is a buffer abstraction for manipulating mutable data.
OptionBuffer::const_iterator OptionBufferConstIter
const_iterator for walking over OptionBuffer
This is a base class for exceptions thrown from the DNS library module.
Defines the logger used by the top-level component of kea-lfc.
std::string getEncapsulatedSpace() const
Returns the name of the option space encapsulated by this option.
OptionBuffer::iterator OptionBufferIter
iterator for walking over OptionBuffer
Exception thrown during option unpacking This exception is thrown when an error has occurred unpackin...
OptionBuffer data_
contains content of this data
uint16_t type_
option type (0-255 for DHCPv4, 0-65535 for DHCPv6)
OptionCollection & getMutableOptions()
Returns all encapsulated options.
void setData(InputIterator first, InputIterator last)
Sets content of this option from buffer.
static bool lenient_parsing_
Governs whether options should be parsed less strictly.
SkipRemainingOptionsError(const char *file, size_t line, const char *what)
boost::shared_ptr< OptionCollection > OptionCollectionPtr
A pointer to an OptionCollection.
std::string encapsulated_space_
Name of the option space being encapsulated by this option.
OptionPtr Factory(Option::Universe u, uint16_t type, const OptionBuffer &buf)
a factory function prototype