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