PcapPlusPlus
20.08
|
#include <RadiusLayer.h>
Public Member Functions | |
RadiusLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet) | |
RadiusLayer (uint8_t code, uint8_t id, const uint8_t *authenticator, uint8_t authenticatorArrSize) | |
RadiusLayer (uint8_t code, uint8_t id, const std::string authenticator) | |
~RadiusLayer () | |
radius_header * | getRadiusHeader () const |
std::string | getAuthenticatorValue () const |
void | setAuthenticatorValue (const std::string &authValue) |
RadiusAttribute | getFirstAttribute () const |
RadiusAttribute | getNextAttribute (RadiusAttribute &attr) const |
RadiusAttribute | getAttribute (uint8_t attrType) const |
size_t | getAttributeCount () const |
RadiusAttribute | addAttribute (const RadiusAttributeBuilder &attrBuilder) |
RadiusAttribute | addAttributeAfter (const RadiusAttributeBuilder &attrBuilder, uint8_t prevAttrType) |
bool | removeAttribute (uint8_t attrType) |
bool | removeAllAttributes () |
size_t | getHeaderLen () const |
void | parseNextLayer () |
void | computeCalculateFields () |
std::string | toString () const |
OsiModelLayer | getOsiModelLayer () const |
Public Member Functions inherited from pcpp::Layer | |
virtual | ~Layer () |
Layer * | getNextLayer () const |
Layer * | getPrevLayer () const |
ProtocolType | getProtocol () const |
uint8_t * | getData () const |
size_t | getDataLen () const |
uint8_t * | getLayerPayload () const |
size_t | getLayerPayloadSize () const |
bool | isAllocatedToPacket () const |
void | copyData (uint8_t *toArr) const |
uint8_t * | getDataPtr (size_t offset=0) const |
Static Public Member Functions | |
static std::string | getRadiusMessageString (uint8_t radiusMessageCode) |
static bool | isDataValid (const uint8_t *udpData, size_t udpDataLen) |
static bool | isRadiusPort (uint16_t port) |
Represents a RADIUS (Remote Authentication Dial-In User Service) protocol layer
|
inline |
A constructor that creates the layer from an existing packet raw data
[in] | data | A pointer to the raw data |
[in] | dataLen | Size of the data in bytes |
[in] | prevLayer | A pointer to the previous layer |
[in] | packet | A pointer to the Packet instance where layer will be stored in |
pcpp::RadiusLayer::RadiusLayer | ( | uint8_t | code, |
uint8_t | id, | ||
const uint8_t * | authenticator, | ||
uint8_t | authenticatorArrSize | ||
) |
A constructor that creates a new layer from scratch
[in] | code | The RADIUS message code |
[in] | id | The RADIUS message ID |
[in] | authenticator | A pointer to a byte array containing the authenticator value |
[in] | authenticatorArrSize | The authenticator byte array size. A valid size of the authenticator field is 16 bytes. If the provided size is less than that then the byte array will be copied to the packet but the missing bytes will stay zero. If the size is more than 16 bytes, only the first 16 bytes will be copied to the packet |
pcpp::RadiusLayer::RadiusLayer | ( | uint8_t | code, |
uint8_t | id, | ||
const std::string | authenticator | ||
) |
A constructor that creates a new layer from scratch
[in] | code | The RADIUS message code |
[in] | id | The RADIUS message ID |
[in] | authenticator | A hex string representing the authenticator value. A valid size of the authenticator field is 16 bytes. If the hex string represents an array that is smaller than this then the missing bytes in the packet's authenticator field will stay zero. If the hex string represents an array that is larger than 16 bytes, only the first 16 bytes will be copied to the packet |
|
inline |
A d'tor for this layer, currently does nothing
RadiusAttribute pcpp::RadiusLayer::addAttribute | ( | const RadiusAttributeBuilder & | attrBuilder | ) |
Add a new RADIUS attribute at the end of the layer
[in] | attrBuilder | A RadiusAttributeBuilder object that contains the requested attribute data to add |
RadiusAttribute pcpp::RadiusLayer::addAttributeAfter | ( | const RadiusAttributeBuilder & | attrBuilder, |
uint8_t | prevAttrType | ||
) |
Add a new RADIUS attribute after an existing one
[in] | attrBuilder | A RadiusAttributeBuilder object that contains the requested attribute data to add |
[in] | prevAttrType | The RADIUS attribute which the newly added attribute will come after |
|
virtual |
Calculate and store the value of radius_header::length according to the layer size
Implements pcpp::Layer.
RadiusAttribute pcpp::RadiusLayer::getAttribute | ( | uint8_t | attrType | ) | const |
Get a RADIUS attribute by attribute type
[in] | attrType | RADIUS attribute type |
size_t pcpp::RadiusLayer::getAttributeCount | ( | ) | const |
std::string pcpp::RadiusLayer::getAuthenticatorValue | ( | ) | const |
RadiusAttribute pcpp::RadiusLayer::getFirstAttribute | ( | ) | const |
|
virtual |
Implements pcpp::Layer.
RadiusAttribute pcpp::RadiusLayer::getNextAttribute | ( | RadiusAttribute & | attr | ) | const |
Get the RADIUS attribute that comes after a given attribute. If the given attribute was the last one, the returned value will contain a logical NULL (RadiusAttribute::isNull() == true)
[in] | attr | A given attribute |
|
inlinevirtual |
Implements pcpp::Layer.
|
inline |
Get a pointer to the RADIUS header. Notice this points directly to the data, so every change will change the actual packet data
|
static |
A static method that returns the RADIUS message string for a give message code. For example: the string "Access-Request" will be returned for code 1
[in] | radiusMessageCode | RADIUS message code |
|
static |
The static method makes validation of UDP data
[in] | udpData | The pointer to the UDP payload data. It points to the first byte of RADIUS header. |
[in] | udpDataLen | The payload data size |
|
inlinestatic |
A static method that checks whether the port is considered as RADIUS
[in] | port | The port number to be checked |
|
inlinevirtual |
Does nothing for this layer, RADIUS is always last
Implements pcpp::Layer.
bool pcpp::RadiusLayer::removeAllAttributes | ( | ) |
Remove all RADIUS attributes in this layer
bool pcpp::RadiusLayer::removeAttribute | ( | uint8_t | attrType | ) |
Remove an existing RADIUS attribute from the layer
[in] | attrType | The RADIUS attribute type to remove |
void pcpp::RadiusLayer::setAuthenticatorValue | ( | const std::string & | authValue | ) |
Setter for radius_header::authenticator
[in] | authValue | A hex string representing the requested authenticator value |
|
virtual |
Implements pcpp::Layer.