15 #include <boost/date_time/posix_time/posix_time.hpp>
16 #include <boost/shared_array.hpp>
17 #include <boost/shared_ptr.hpp>
31 typedef boost::shared_ptr<Pkt6>
Pkt6Ptr;
92 std::string
toText()
const;
112 Pkt6(uint8_t msg_type,
196 virtual std::string
getLabel()
const;
203 virtual std::string
toText()
const;
215 virtual size_t len();
251 const uint8_t relay_level)
const;
291 int& start,
int& end,
int& direction)
const;
403 static const char*
getName(
const uint8_t type);
550 void unpackMsg(OptionBuffer::const_iterator begin,
551 OptionBuffer::const_iterator end);
OptionCollection getNonCopiedOptions(const uint16_t opt_type) const
Returns all option instances of specified type without copying.
boost::shared_ptr< DUID > DuidPtr
virtual std::string toText() const
Returns text representation of the packet.
const isc::asiolink::IOAddress & getRelay6PeerAddress(uint8_t relay_level) const
return the peer address field from a relay option
boost::shared_ptr< HWAddr > HWAddrPtr
Shared pointer to a hardware address structure.
uint16_t getRelayOverhead(const RelayInfo &relay) const
Calculates overhead introduced in specified relay.
uint16_t directLen() const
Calculates size of the message as if it was not relayed at all.
isc::dhcp::OptionCollection options_
options received from a specified relay, except relay-msg option
void packUDP()
Builds on wire packet for UDP transmission.
virtual void setType(uint8_t type)
Sets message type (e.g.
uint16_t relay_msg_len_
length of the relay_msg_len Used when calculating length during pack/unpack
Pkt6(uint8_t msg_type, uint32_t transid, DHCPv6Proto proto=UDP)
Constructor, used in replying to a message.
Base class for classes representing DHCP messages.
void copyRelayInfo(const Pkt6Ptr &question)
copies relay information from client's packet to server's response
boost::shared_ptr< Option > OptionPtr
Represents a DHCPv6 packet.
void unpackRelayMsg()
Unpacks relayed message (RELAY-FORW or RELAY-REPL).
virtual std::string getLabel() const
Returns text representation of the primary packet identifiers.
void setProto(DHCPv6Proto proto=UDP)
Sets protocol of this packet.
OptionPtr getRelayOption(uint16_t option_code, uint8_t nesting_level)
Returns option inserted by relay.
OptionPtr getNonCopiedAnyRelayOption(const uint16_t option_code, const RelaySearchOrder &order) const
Returns pointer to an instance of specified option.
virtual HWAddrPtr getMACFromDocsisCMTS()
Attempts to extract MAC/Hardware address from DOCSIS options.
virtual HWAddrPtr getMACFromSrcLinkLocalAddr()
Attempts to generate MAC/Hardware address from IPv6 link-local address.
std::vector< RelayInfo > relay_info_
Relay information.
void unpackUDP()
Parses on-wire form of UDP DHCPv6 packet.
const isc::asiolink::IOAddress & getRelay6LinkAddress(uint8_t relay_level) const
return the link address field from a relay option
boost::shared_ptr< Pkt6 > Pkt6Ptr
A pointer to Pkt6 packet.
structure that describes a single relay information
static const size_t DHCPV6_RELAY_HDR_LEN
specifies relay DHCPv6 packet header length (over UDP)
virtual void unpack()
Dispatch method that handles binary packet parsing.
virtual size_t len()
Returns length of the packet.
OptionPtr getNonCopiedRelayOption(const uint16_t opt_type, const uint8_t relay_level) const
Returns pointer to an option inserted by relay agent.
virtual HWAddrPtr getMACFromDocsisModem()
Attempts to extract MAC/Hardware address from DOCSIS options inserted by the modem itself...
uint8_t msg_type_
DHCPv6 message type.
DHCPv6Proto
DHCPv6 transport protocol.
std::multimap< unsigned int, OptionPtr > OptionCollection
A collection of DHCP (v4 or v6) options.
std::string toText() const
Returns printable representation of the relay information.
static const size_t DHCPV6_PKT_HDR_LEN
specifies non-relayed DHCPv6 packet header length (over UDP)
virtual void pack()
Prepares on-wire format.
virtual HWAddrPtr getMACFromIPv6RelayOpt()
Extract MAC/Hardware address from client link-layer address.
DHCPv6Proto getProto()
Returns protocol of this packet (UDP or TCP).
void packTCP()
Builds on wire packet for TCP transmission.
Defines the logger used by the top-level component of kea-dhcp-ddns.
static std::string makeLabel(const DuidPtr duid, const uint32_t transid, const HWAddrPtr &hwaddr)
Returns text representation of the given packet identifiers.
void unpackMsg(OptionBuffer::const_iterator begin, OptionBuffer::const_iterator end)
Unpacks direct (non-relayed) message.
RelaySearchOrder
defines relay search pattern
uint8_t hop_count_
number of traversed relays (up to 32)
OptionPtr getAnyRelayOption(const uint16_t option_code, const RelaySearchOrder &order)
Return first instance of a specified option.
RelayInfo()
default constructor
const char * getName() const
Returns name of the DHCPv6 message.
isc::dhcp::OptionCollection getOptions(const uint16_t type)
Returns all instances of specified type.
virtual HWAddrPtr getMACFromDUID()
Extract MAC/Hardware address from client-id.
isc::asiolink::IOAddress linkaddr_
fixed field in relay-forw/relay-reply
DHCPv6Proto proto_
UDP (usually) or TCP (bulk leasequery or failover)
isc::asiolink::IOAddress peeraddr_
fixed field in relay-forw/relay-reply
void unpackTCP()
Parses on-wire form of TCP DHCPv6 packet.
The IOAddress class represents an IP addresses (version agnostic)
uint16_t calculateRelaySizes()
Calculates overhead for all relays defined for this message.
DuidPtr getClientId() const
Retrieves the DUID from the Client Identifier option.
virtual uint8_t getType() const
Returns message type (e.g.
void addRelayInfo(const RelayInfo &relay)
add information about one traversed relay
virtual HWAddrPtr getMACFromRemoteIdRelayOption()
Attempts to obtain MAC address from remote-id relay option.
uint8_t msg_type_
message type (RELAY-FORW oro RELAY-REPL)