Kea
1.9.9-git
|
Base class for classes representing DHCP messages. More...
#include <pkt.h>
Public Member Functions | |
virtual | ~Pkt () |
Virtual destructor. More... | |
void | addClass (const isc::dhcp::ClientClass &client_class, bool required=false) |
Adds packet to a specified class. More... | |
virtual void | addOption (const OptionPtr &opt) |
Adds an option to this packet. More... | |
bool | delOption (uint16_t type) |
Attempts to delete first suboption of requested type. More... | |
isc::util::OutputBuffer & | getBuffer () |
Returns reference to output buffer. More... | |
const ClientClasses & | getClasses (bool required=false) const |
Returns the class set. More... | |
std::string | getIface () const |
Returns interface name. More... | |
uint32_t | getIndex () const |
Returns interface index. More... | |
virtual std::string | getLabel () const |
Returns text representation primary packet identifiers. More... | |
const isc::asiolink::IOAddress & | getLocalAddr () const |
Returns local IP address. More... | |
uint16_t | getLocalPort () const |
Returns local UDP (and soon TCP) port. More... | |
HWAddrPtr | getMAC (uint32_t hw_addr_src) |
Returns MAC address. More... | |
virtual const char * | getName () const =0 |
Returns name of the DHCP message. More... | |
OptionPtr | getOption (const uint16_t type) |
Returns the first option of specified type. More... | |
const isc::asiolink::IOAddress & | getRemoteAddr () const |
Returns remote IP address. More... | |
HWAddrPtr | getRemoteHWAddr () const |
Returns the remote HW address obtained from raw sockets. More... | |
uint16_t | getRemotePort () const |
Returns remote port. More... | |
const boost::posix_time::ptime & | getTimestamp () const |
Returns packet timestamp. More... | |
uint32_t | getTransid () const |
Returns value of transaction-id field. More... | |
virtual uint8_t | getType () const =0 |
Returns message type (e.g. More... | |
bool | inClass (const isc::dhcp::ClientClass &client_class) |
Checks whether a client belongs to a given class. More... | |
bool | indexSet () const |
Checks if interface index has been set. More... | |
bool | isCopyRetrievedOptions () const |
Returns whether the copying of retrieved options is enabled. More... | |
virtual size_t | len ()=0 |
Returns packet size in binary format. More... | |
virtual void | pack ()=0 |
Prepares on-wire format of DHCP (either v4 or v6) packet. More... | |
void | repack () |
Copies content of input buffer to output buffer. More... | |
void | resetIndex () |
Resets interface index to negative value. More... | |
virtual void | setCopyRetrievedOptions (const bool copy) |
Controls whether the option retrieved by the Pkt::getOption should be copied before being returned. More... | |
void | setIface (const std::string &iface) |
Sets interface name. More... | |
void | setIndex (uint32_t ifindex) |
Sets interface index. More... | |
void | setLocalAddr (const isc::asiolink::IOAddress &local) |
Sets local IP address. More... | |
void | setLocalPort (uint16_t local) |
Sets local UDP (and soon TCP) port. More... | |
void | setRemoteAddr (const isc::asiolink::IOAddress &remote) |
Sets remote IP address. More... | |
void | setRemoteHWAddr (const HWAddrPtr &hw_addr) |
Sets remote hardware address. More... | |
void | setRemoteHWAddr (const uint8_t htype, const uint8_t hlen, const std::vector< uint8_t > &hw_addr) |
Sets remote hardware address. More... | |
void | setRemotePort (uint16_t remote) |
Sets remote UDP (and soon TCP) port. More... | |
void | setTimestamp (boost::posix_time::ptime ×tamp) |
Set packet timestamp. More... | |
void | setTransid (uint32_t transid) |
Sets transaction-id value. More... | |
virtual void | setType (uint8_t type)=0 |
Sets message type (e.g. More... | |
virtual std::string | toText () const =0 |
Returns text representation of the packet. More... | |
virtual void | unpack ()=0 |
Parses on-wire form of DHCP (either v4 or v6) packet. More... | |
void | updateTimestamp () |
Update packet timestamp. More... | |
Public Member Functions inherited from isc::hooks::CalloutHandleAssociate | |
CalloutHandleAssociate () | |
Constructor. More... | |
CalloutHandlePtr | getCalloutHandle () |
Returns callout handle. More... | |
Public Attributes | |
ClientClasses | classes_ |
Classes this packet belongs to. More... | |
OptionBuffer | data_ |
Unparsed data (in received packets). More... | |
isc::dhcp::OptionCollection | options_ |
Collection of options present in this message. More... | |
ClientClasses | required_classes_ |
Classes which are required to be evaluated. More... | |
Protected Member Functions | |
Pkt (uint32_t transid, const isc::asiolink::IOAddress &local_addr, const isc::asiolink::IOAddress &remote_addr, uint16_t local_port, uint16_t remote_port) | |
Constructor. More... | |
Pkt (const uint8_t *buf, uint32_t len, const isc::asiolink::IOAddress &local_addr, const isc::asiolink::IOAddress &remote_addr, uint16_t local_port, uint16_t remote_port) | |
Constructor. More... | |
virtual HWAddrPtr | getMACFromDocsisCMTS ()=0 |
Attempts to extract MAC/Hardware address from DOCSIS options inserted by the CMTS (the relay agent) More... | |
virtual HWAddrPtr | getMACFromDocsisModem ()=0 |
Attempts to extract MAC/Hardware address from DOCSIS options inserted by the modem itself. More... | |
virtual HWAddrPtr | getMACFromDUID ()=0 |
Attempts to obtain MAC address from DUID-LL or DUID-LLT. More... | |
HWAddrPtr | getMACFromIPv6 (const isc::asiolink::IOAddress &addr) |
Attempts to convert IPv6 address into MAC. More... | |
virtual HWAddrPtr | getMACFromIPv6RelayOpt ()=0 |
Attempts to obtain MAC address from relay option client-linklayer-addr. More... | |
virtual HWAddrPtr | getMACFromRemoteIdRelayOption ()=0 |
Attempts to obtain MAC address from remote-id relay option. More... | |
virtual HWAddrPtr | getMACFromSrcLinkLocalAddr ()=0 |
Attempts to obtain MAC address from source link-local IPv6 address. More... | |
OptionPtr | getNonCopiedOption (const uint16_t type) const |
Returns the first option of specified type without copying. More... | |
Protected Attributes | |
isc::util::OutputBuffer | buffer_out_ |
Output buffer (used during message transmission) More... | |
bool | copy_retrieved_options_ |
Indicates if a copy of the retrieved option should be returned when Pkt::getOption is called. More... | |
std::string | iface_ |
Name of the network interface the packet was received/to be sent over. More... | |
int64_t | ifindex_ |
Interface index. More... | |
isc::asiolink::IOAddress | local_addr_ |
Local IP (v4 or v6) address. More... | |
uint16_t | local_port_ |
local TDP or UDP port More... | |
isc::asiolink::IOAddress | remote_addr_ |
Remote IP address. More... | |
HWAddrPtr | remote_hwaddr_ |
uint16_t | remote_port_ |
remote TCP or UDP port More... | |
boost::posix_time::ptime | timestamp_ |
packet timestamp More... | |
uint32_t | transid_ |
Transaction-id (32 bits for v4, 24 bits for v6) More... | |
Protected Attributes inherited from isc::hooks::CalloutHandleAssociate | |
CalloutHandlePtr | callout_handle_ |
Callout handle stored. More... | |
Base class for classes representing DHCP messages.
This is a base class that holds common information (e.g. source and destination ports) and operations (e.g. add, get, delete options) for derived classes representing both DHCPv4 and DHCPv6 messages. The Pkt4
and Pkt6
classes derive from it.
|
protected |
Constructor.
This constructor is typically used for transmitted messages as it creates an empty (no options) packet. The constructor is protected, so only derived classes can call it. Pkt class cannot be instantiated anyway, because it is an abstract class.
transid | transaction-id |
local_addr | local IPv4 or IPv6 address |
remote_addr | remote IPv4 or IPv6 address |
local_port | local UDP (one day also TCP) port |
remote_port | remote UDP (one day also TCP) port |
|
protected |
Constructor.
This constructor is typically used for received messages as it takes a buffer that's going to be parsed as one of arguments. The constructor is protected, so only derived classes can call it. Pkt class cannot be instantiated anyway, because it is an abstract class.
buf | pointer to a buffer that contains on-wire data |
len | length of the pointer specified in buf |
local_addr | local IPv4 or IPv6 address |
remote_addr | remote IPv4 or IPv6 address |
local_port | local UDP (one day also TCP) port |
remote_port | remote UDP (one day also TCP) port |
|
inlinevirtual |
void isc::dhcp::Pkt::addClass | ( | const isc::dhcp::ClientClass & | client_class, |
bool | required = false |
||
) |
Adds packet to a specified class.
A packet can be added to the same class repeatedly. Any additional attempts to add to a class the packet already belongs to, will be ignored silently.
client_class | name of the class to be added |
required | the class is marked for required evaluation |
Definition at line 100 of file pkt.cc.
References classes_, isc::dhcp::ClientClasses::contains(), isc::dhcp::ClientClasses::empty(), isc::dhcp::ClientClasses::insert(), and required_classes_.
|
virtual |
Adds an option to this packet.
Derived classes may provide more specialized implementations. In particular Pkt4
provides one that checks if option is unique.
opt | option to be added. |
Reimplemented in isc::dhcp::Pkt4.
Definition at line 56 of file pkt.cc.
References options_.
Referenced by isc::dhcp::Pkt4::addOption().
bool isc::dhcp::Pkt::delOption | ( | uint16_t | type | ) |
Attempts to delete first suboption of requested type.
If there are several options of the same type present, only the first option will be deleted.
type | Type of option to be deleted. |
Definition at line 83 of file pkt.cc.
References options_.
|
inline |
Returns reference to output buffer.
Returned buffer will contain reasonable data only for output (TX) packet and after pack() was called.
RX packet or TX packet before pack() will return buffer with zero length. This buffer is returned as non-const, so hooks framework (and user's callouts) can modify them if needed
Definition at line 174 of file pkt.h.
References buffer_out_.
Referenced by isc::dhcp::Pkt4o6::pack().
|
inline |
Returns the class set.
required | return classes or required to be evaluated classes. |
Definition at line 300 of file pkt.h.
References classes_, and required_classes_.
|
inline |
Returns interface name.
Returns interface name over which packet was received or is going to be transmitted.
Definition at line 512 of file pkt.h.
References iface_.
Referenced by isc::dhcp::TokenPkt::evaluate().
|
inline |
|
inlinevirtual |
Returns text representation primary packet identifiers.
This method is intended to be used to provide as a consistent way to identify packets within log statements. Derivations should supply there own implementation.
Reimplemented in isc::dhcp::Pkt6, and isc::dhcp::Pkt4.
Definition at line 202 of file pkt.h.
References isc_throw.
|
inline |
Returns local IP address.
Definition at line 439 of file pkt.h.
References local_addr_.
Referenced by isc::dhcp::TokenPkt::evaluate().
|
inline |
Returns local UDP (and soon TCP) port.
This sets a local port, i.e. destination port for recently received packet or a source port for to be transmitted packet.
Definition at line 459 of file pkt.h.
References local_port_.
HWAddrPtr isc::dhcp::Pkt::getMAC | ( | uint32_t | hw_addr_src | ) |
Returns MAC address.
The difference between this method and getRemoteHWAddr() is that getRemoteHWAddr() returns only what was obtained from raw sockets. This method is more generic and can attempt to obtain MAC from varied sources: raw sockets, client-id, link-local IPv6 address, and various relay options.
hw_addr_src takes a combination of bit values specified in HWADDR_SOURCE_* constants.
hw_addr_src | a bitmask that specifies hardware address source |
Definition at line 146 of file pkt.cc.
References getMACFromDocsisCMTS(), getMACFromDocsisModem(), getMACFromDUID(), getMACFromIPv6RelayOpt(), getMACFromRemoteIdRelayOption(), getMACFromSrcLinkLocalAddr(), getRemoteHWAddr(), isc::dhcp::HWAddr::HWADDR_SOURCE_CLIENT_ADDR_RELAY_OPTION, isc::dhcp::HWAddr::HWADDR_SOURCE_DOCSIS_CMTS, isc::dhcp::HWAddr::HWADDR_SOURCE_DOCSIS_MODEM, isc::dhcp::HWAddr::HWADDR_SOURCE_DUID, isc::dhcp::HWAddr::HWADDR_SOURCE_IPV6_LINK_LOCAL, isc::dhcp::HWAddr::HWADDR_SOURCE_RAW, and isc::dhcp::HWAddr::HWADDR_SOURCE_REMOTE_ID.
|
protectedpure virtual |
Attempts to extract MAC/Hardware address from DOCSIS options inserted by the CMTS (the relay agent)
This is a generic mechanism for extracting hardware address from the DOCSIS options.
Pkt6
class have respective implementation. This method is currently not implemented in DHCPv4.Implemented in isc::dhcp::Pkt6, and isc::dhcp::Pkt4.
Referenced by getMAC().
|
protectedpure virtual |
Attempts to extract MAC/Hardware address from DOCSIS options inserted by the modem itself.
This is a generic mechanism for extracting hardware address from the DOCSIS options.
Pkt6
class have respective implementation. This method is currently not implemented in DHCPv4.Implemented in isc::dhcp::Pkt6, and isc::dhcp::Pkt4.
Referenced by getMAC().
|
protectedpure virtual |
Attempts to obtain MAC address from DUID-LL or DUID-LLT.
This method is called from getMAC(HWADDR_SOURCE_DUID) and should not be called directly. It will attempt to extract MAC address information from DUID if its type is LLT or LL. If this method fails, it will return NULL.
Pkt6
class have respective implementation. This method is not applicable to DHCPv4.Implemented in isc::dhcp::Pkt6, and isc::dhcp::Pkt4.
Referenced by getMAC().
|
protected |
Attempts to convert IPv6 address into MAC.
Utility method that attempts to convert link-local IPv6 address to the MAC address. That works only for link-local IPv6 addresses that are based on EUI-64.
addr | IPv6 address to be converted |
Definition at line 243 of file pkt.cc.
References isc::dhcp::IfaceMgr::getIface(), isc::dhcp::HWAddr::HWADDR_SOURCE_IPV6_LINK_LOCAL, iface_, isc::dhcp::IfaceMgr::instance(), isc::asiolink::IOAddress::isV6LinkLocal(), and isc::asiolink::IOAddress::toBytes().
Referenced by isc::dhcp::Pkt6::getMACFromSrcLinkLocalAddr().
|
protectedpure virtual |
Attempts to obtain MAC address from relay option client-linklayer-addr.
This method is called from getMAC(HWADDR_SOURCE_CLIENT_ADDR_RELAY_OPTION) and should not be called directly. It will extract the client's MAC/Hardware address from option client_linklayer_addr (RFC6939) inserted by the relay agent closest to the client. If this method fails, it will return NULL.
Pkt6
class have respective implementation. This method is not applicable to DHCPv4.Implemented in isc::dhcp::Pkt6, and isc::dhcp::Pkt4.
Referenced by getMAC().
|
protectedpure virtual |
Attempts to obtain MAC address from remote-id relay option.
This method is called from getMAC(HWADDR_SOURCE_REMOTE_ID) and should not be called directly. It will attempt to extract MAC address information from remote-id option inserted by a relay agent closest to the client. If this method fails, it will return NULL.
Pkt6
class have respective implementation. This method is not applicable to DHCPv4.Implemented in isc::dhcp::Pkt6, and isc::dhcp::Pkt4.
Referenced by getMAC().
|
protectedpure virtual |
Attempts to obtain MAC address from source link-local IPv6 address.
This method is called from getMAC(HWADDR_SOURCE_IPV6_LINK_LOCAL) and should not be called directly. It is not 100% reliable. The source IPv6 address does not necessarily have to be link-local (may be global or ULA) and even if it's link-local, it doesn't necessarily be based on EUI-64. For example, Windows supports RFC4941, which randomized IID part of the link-local address. If this method fails, it will return NULL.
For direct message, it attempts to use remote_addr_ field. For relayed message, it uses peer-addr of the first relay.
Pkt6
class have respective implementation. This method is not applicable to DHCPv4.Implemented in isc::dhcp::Pkt6, and isc::dhcp::Pkt4.
Referenced by getMAC().
|
pure virtual |
Returns name of the DHCP message.
For all unsupported messages the derived classes must return "UNKNOWN".
Implemented in isc::dhcp::Pkt6, and isc::dhcp::Pkt4.
|
protected |
Returns the first option of specified type without copying.
This method is internally used by the Pkt class and derived classes to retrieve a pointer to the specified option. This method doesn't copy the option before returning it to the caller.
type | Option type. |
Definition at line 61 of file pkt.cc.
References options_.
Referenced by isc::dhcp::Pkt4::addOption(), isc::dhcp::Pkt6::getClientId(), isc::dhcp::Pkt4::getLabel(), isc::dhcp::Pkt6::getMACFromDocsisModem(), isc::dhcp::Pkt6::getMACFromDUID(), isc::dhcp::Pkt4::getType(), and isc::dhcp::Pkt4::setType().
OptionPtr isc::dhcp::Pkt::getOption | ( | const uint16_t | type | ) |
Returns the first option of specified type.
Returns the first option of specified type. Note that in DHCPv6 several instances of the same option are allowed (and frequently used). Also see Pkt6::getOptions().
The options will be only returned after unpack() is called.
type | option type we are looking for |
Definition at line 70 of file pkt.cc.
References copy_retrieved_options_, and options_.
Referenced by isc::dhcp::TokenVendor::evaluate(), isc::dhcp::TokenVendorClass::evaluate(), isc::dhcp::TokenOption::getOption(), isc::dhcp::TokenRelay4Option::getOption(), and isc::dhcp::TokenVendor::getOption().
|
inline |
Returns remote IP address.
Definition at line 425 of file pkt.h.
References remote_addr_.
Referenced by isc::dhcp::TokenPkt::evaluate().
|
inline |
Returns the remote HW address obtained from raw sockets.
Definition at line 559 of file pkt.h.
References remote_hwaddr_.
Referenced by getMAC().
|
inline |
Returns remote port.
Definition at line 476 of file pkt.h.
References remote_port_.
|
inline |
Returns packet timestamp.
Returns packet timestamp value updated when packet is received or send.
Definition at line 395 of file pkt.h.
References timestamp_.
|
inline |
Returns value of transaction-id field.
Definition at line 266 of file pkt.h.
References transid_.
Referenced by isc::dhcp::TokenPkt4::evaluate(), isc::dhcp::TokenPkt6::evaluate(), isc::dhcp::Pkt6::getLabel(), isc::perfdhcp::PerfPkt6::rawPack(), isc::perfdhcp::PerfPkt4::rawPack(), isc::perfdhcp::PerfPkt6::rawUnpack(), and isc::perfdhcp::PerfPkt4::rawUnpack().
|
pure virtual |
Returns message type (e.g.
1 = SOLICIT).
Pkt4
and Pkt6
class have respective implementations of this method.Implemented in isc::dhcp::Pkt4, and isc::dhcp::Pkt6.
bool isc::dhcp::Pkt::inClass | ( | const isc::dhcp::ClientClass & | client_class | ) |
Checks whether a client belongs to a given class.
client_class | name of the class |
Definition at line 95 of file pkt.cc.
References classes_, and isc::dhcp::ClientClasses::contains().
Referenced by isc::dhcp::TokenMember::evaluate().
|
inline |
|
inline |
Returns whether the copying of retrieved options is enabled.
Also see setCopyRetrievedOptions.
Definition at line 377 of file pkt.h.
References copy_retrieved_options_.
|
pure virtual |
Returns packet size in binary format.
Returns size of the packet in on-wire format or size needed to store it in on-wire format.
Pkt4
and Pkt6
class have respective implementations of this method.Implemented in isc::dhcp::Pkt6, and isc::dhcp::Pkt4.
|
pure virtual |
Prepares on-wire format of DHCP (either v4 or v6) packet.
Prepares on-wire format of message and all its options. A caller must ensure that options are stored in options_ field prior to calling this method.
Output buffer will be stored in buffer_out_. The buffer_out_ should be cleared before writing to the buffer in the derived classes.
Pkt4
and Pkt6
class have respective implementations of this method.InvalidOperation | if packing fails |
Implemented in isc::dhcp::Pkt6, isc::dhcp::Pkt4, and isc::dhcp::Pkt4o6.
void isc::dhcp::Pkt::repack | ( | ) |
Copies content of input buffer to output buffer.
This is mostly a diagnostic function. It is being used for sending received packet. Received packet is stored in data_, but transmitted data is stored in buffer_out_. If we want to send packet that we just received, a copy between those two buffers is necessary.
Definition at line 116 of file pkt.cc.
References buffer_out_, data_, and isc::util::OutputBuffer::writeData().
|
inline |
|
inlinevirtual |
Controls whether the option retrieved by the Pkt::getOption should be copied before being returned.
Setting this value to true enables the mechanism of copying options retrieved from the packet to prevent accidental modifications of options that shouldn't be modified. The typical use case for this mechanism is to prevent hook library from modifying instance of an option within the packet that would also affect the value for this option within the Kea configuration structures.
Kea doesn't copy option instances which it stores in the packet. It merely copy pointers into the packets. Thus, any modification to an option would change the value of this option in the Kea configuration. To prevent this, option copying should be enabled prior to passing the pointer to a packet to a hook library.
Note that only only does this method causes the server to copy an option, but the copied option also replaces the original option within the packet. The option can be then freely modified and the modifications will only affect the instance of this option within the packet but not within the server configuration.
copy | Indicates if the options should be copied when retrieved (if true), or not copied (if false). |
Reimplemented in isc::dhcp::Pkt4o6.
Definition at line 368 of file pkt.h.
References isc::data::copy(), and copy_retrieved_options_.
Referenced by isc::dhcp::Pkt4o6::setCopyRetrievedOptions().
|
inline |
Sets interface name.
Sets interface name over which packet was received or is going to be transmitted.
Definition at line 520 of file pkt.h.
References iface_.
Referenced by isc::dhcp::Pkt4o6::Pkt4o6().
|
inline |
Sets interface index.
ifindex | specifies interface index. |
Definition at line 483 of file pkt.h.
References ifindex_.
Referenced by isc::dhcp::Pkt4o6::Pkt4o6().
|
inline |
Sets local IP address.
local | specifies local address |
Definition at line 432 of file pkt.h.
References local_addr_.
|
inline |
Sets local UDP (and soon TCP) port.
This sets a local port, i.e. destination port for recently received packet or a source port for to be transmitted packet.
local | specifies local port |
Definition at line 449 of file pkt.h.
References local_port_.
|
inline |
Sets remote IP address.
remote | specifies remote address |
Definition at line 418 of file pkt.h.
References remote_addr_.
Referenced by isc::dhcp::Pkt4o6::Pkt4o6().
void isc::dhcp::Pkt::setRemoteHWAddr | ( | const HWAddrPtr & | hw_addr | ) |
Sets remote hardware address.
Sets hardware address (MAC) from an existing HWAddr structure. The remote address is a destination address for outgoing packet and source address for incoming packet. When this is an outgoing packet, this address will be used to construct the link layer header.
hw_addr | structure representing HW address. |
BadValue | if addr is null |
Definition at line 129 of file pkt.cc.
References isc_throw, and remote_hwaddr_.
void isc::dhcp::Pkt::setRemoteHWAddr | ( | const uint8_t | htype, |
const uint8_t | hlen, | ||
const std::vector< uint8_t > & | hw_addr | ||
) |
Sets remote hardware address.
Sets the destination hardware (MAC) address for the outgoing packet or source HW address for the incoming packet. When this is an outgoing packet this address will be used to construct the link layer header.
In a typical case, hlen field would be redundant, as it could be extracted from mac_addr.size(). However, the difference is when running on exotic hardware, like Infiniband, that had MAC addresses 20 bytes long. In that case, hlen is set to zero in DHCPv4.
htype | hardware type (will be sent in htype field) |
hlen | hardware length (will be sent in hlen field) |
hw_addr | pointer to hardware address |
Definition at line 123 of file pkt.cc.
References remote_hwaddr_.
|
inline |
Sets remote UDP (and soon TCP) port.
This sets a remote port, i.e. source port for recently received packet or a destination port for to be transmitted packet.
remote | specifies remote port |
Definition at line 469 of file pkt.h.
References remote_port_.
|
inline |
Set packet timestamp.
Sets packet timestamp to arbitrary value. It is used by perfdhcp tool and should not be used elsewhere.
Definition at line 403 of file pkt.h.
References timestamp_.
Referenced by isc::perfdhcp::AvalancheScen::resendPackets().
|
inline |
Sets transaction-id value.
transid | transaction-id to be set. |
Definition at line 261 of file pkt.h.
References transid_.
Referenced by isc::perfdhcp::PerfPkt4::PerfPkt4(), isc::perfdhcp::PerfPkt6::PerfPkt6(), isc::perfdhcp::PerfPkt6::rawUnpack(), and isc::perfdhcp::PerfPkt4::rawUnpack().
|
pure virtual |
Sets message type (e.g.
1 = SOLICIT).
Pkt4
and Pkt6
class have respective implementations of this method.type | message type to be set |
Implemented in isc::dhcp::Pkt4, and isc::dhcp::Pkt6.
|
pure virtual |
Returns text representation of the packet.
This function is useful mainly for debugging.
Pkt4
and Pkt6
class have respective implementations of this method.Implemented in isc::dhcp::Pkt6, and isc::dhcp::Pkt4.
|
pure virtual |
Parses on-wire form of DHCP (either v4 or v6) packet.
Parses received packet, stored in on-wire format in data_.
Will create a collection of option objects that will be stored in options_ container.
Pkt4
and Pkt6
class have respective implementations of this method.Method will throw exception if packet parsing fails.
tbd |
Implemented in isc::dhcp::Pkt6, and isc::dhcp::Pkt4.
void isc::dhcp::Pkt::updateTimestamp | ( | ) |
Update packet timestamp.
Updates packet timestamp. This method is invoked by interface manager just before sending or just after receiving it.
isc::Unexpected | if timestamp update failed |
Definition at line 112 of file pkt.cc.
References timestamp_.
|
protected |
Output buffer (used during message transmission)
Definition at line 764 of file pkt.h.
Referenced by getBuffer(), isc::dhcp::Pkt4::pack(), isc::dhcp::Pkt6::packUDP(), isc::perfdhcp::PerfPkt6::rawPack(), isc::perfdhcp::PerfPkt4::rawPack(), and repack().
ClientClasses isc::dhcp::Pkt::classes_ |
Classes this packet belongs to.
This field is public, so the code outside of Pkt4 or Pkt6 class can iterate over existing classes. Having it public also solves the problem of returned reference lifetime. It is preferred to use inClass and addClass should be used to operate on this field.
Definition at line 596 of file pkt.h.
Referenced by addClass(), getClasses(), and inClass().
|
protected |
Indicates if a copy of the retrieved option should be returned when Pkt::getOption is called.
Definition at line 770 of file pkt.h.
Referenced by getOption(), isc::dhcp::Pkt6::getOptions(), isc::dhcp::Pkt6::getRelayOption(), isCopyRetrievedOptions(), and setCopyRetrievedOptions().
OptionBuffer isc::dhcp::Pkt::data_ |
Unparsed data (in received packets).
Definition at line 312 of file pkt.h.
Referenced by Pkt(), isc::perfdhcp::PerfPkt6::rawPack(), isc::perfdhcp::PerfPkt4::rawPack(), isc::perfdhcp::PerfPkt6::rawUnpack(), isc::perfdhcp::PerfPkt4::rawUnpack(), repack(), isc::dhcp::Pkt4::unpack(), isc::dhcp::Pkt6::unpackMsg(), isc::dhcp::Pkt6::unpackRelayMsg(), isc::dhcp::Pkt6::unpackUDP(), isc::perfdhcp::PerfPkt6::writeAt(), isc::perfdhcp::PerfPkt4::writeAt(), isc::perfdhcp::PerfPkt6::writeValueAt(), and isc::perfdhcp::PerfPkt4::writeValueAt().
|
protected |
Name of the network interface the packet was received/to be sent over.
Definition at line 729 of file pkt.h.
Referenced by getIface(), getMACFromIPv6(), isc::dhcp::Pkt6::getMACFromRemoteIdRelayOption(), and setIface().
|
protected |
Interface index.
Each network interface has assigned an unique ifindex. It is a functional equivalent of a name, but sometimes more useful, e.g. when using odd systems that allow spaces in interface names.
Definition at line 736 of file pkt.h.
Referenced by getIndex(), indexSet(), resetIndex(), and setIndex().
|
protected |
Local IP (v4 or v6) address.
Specifies local IPv4 or IPv6 address. It is a destination address for received packet, and a source address if it packet is being transmitted.
Definition at line 742 of file pkt.h.
Referenced by getLocalAddr(), setLocalAddr(), isc::dhcp::Pkt4::toText(), and isc::dhcp::Pkt6::toText().
|
protected |
local TDP or UDP port
Definition at line 751 of file pkt.h.
Referenced by getLocalPort(), setLocalPort(), isc::dhcp::Pkt4::toText(), and isc::dhcp::Pkt6::toText().
isc::dhcp::OptionCollection isc::dhcp::Pkt::options_ |
Collection of options present in this message.
Definition at line 614 of file pkt.h.
Referenced by addOption(), delOption(), isc::dhcp::Pkt6::directLen(), getNonCopiedOption(), isc::dhcp::Pkt6::getNonCopiedOptions(), isc::dhcp::Pkt6::getNonCopiedRelayOption(), getOption(), isc::dhcp::Pkt6::getOptions(), isc::dhcp::Pkt6::getRelayOption(), isc::dhcp::Pkt4::len(), isc::dhcp::Pkt4::pack(), isc::dhcp::Pkt6::packUDP(), isc::perfdhcp::PerfPkt6::rawPack(), isc::perfdhcp::PerfPkt4::rawPack(), isc::perfdhcp::PerfPkt6::rawUnpack(), isc::perfdhcp::PerfPkt4::rawUnpack(), isc::dhcp::Pkt6::RelayInfo::toText(), isc::dhcp::Pkt4::toText(), isc::dhcp::Pkt6::toText(), isc::dhcp::Pkt4::unpack(), and isc::dhcp::Pkt6::unpackMsg().
|
protected |
Remote IP address.
Specifies local IPv4 or IPv6 address. It is source address for received packet and a destination address for packet being transmitted.
Definition at line 748 of file pkt.h.
Referenced by isc::dhcp::Pkt6::getMACFromSrcLinkLocalAddr(), getRemoteAddr(), setRemoteAddr(), isc::dhcp::Pkt4::toText(), and isc::dhcp::Pkt6::toText().
|
protected |
Definition at line 776 of file pkt.h.
Referenced by getRemoteHWAddr(), and setRemoteHWAddr().
|
protected |
remote TCP or UDP port
Definition at line 754 of file pkt.h.
Referenced by getRemotePort(), setRemotePort(), isc::dhcp::Pkt4::toText(), and isc::dhcp::Pkt6::toText().
ClientClasses isc::dhcp::Pkt::required_classes_ |
Classes which are required to be evaluated.
The comment on classes_ applies here.
Before output option processing these classes will be evaluated and if evaluation status is true added to the previous collection.
Definition at line 604 of file pkt.h.
Referenced by addClass(), and getClasses().
|
protected |
packet timestamp
Definition at line 773 of file pkt.h.
Referenced by getTimestamp(), setTimestamp(), and updateTimestamp().
|
protected |
Transaction-id (32 bits for v4, 24 bits for v6)
Definition at line 726 of file pkt.h.
Referenced by isc::dhcp::Pkt4::getLabel(), getTransid(), isc::dhcp::Pkt4::pack(), isc::dhcp::Pkt6::packUDP(), setTransid(), isc::dhcp::Pkt4::toText(), isc::dhcp::Pkt6::toText(), isc::dhcp::Pkt4::unpack(), and isc::dhcp::Pkt6::unpackMsg().