PcapPlusPlus
19.12
|
#include <SdpLayer.h>
Public Member Functions | |
SdpLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet) | |
SdpLayer () | |
SdpLayer (std::string username, long sessionID, long sessionVersion, IPv4Address ipAddress, std::string sessionName, long startTime, long stopTime) | |
SdpLayer (const SdpLayer &other) | |
SdpLayer & | operator= (const SdpLayer &other) |
IPv4Address | getOwnerIPv4Address () const |
uint16_t | getMediaPort (std::string mediaType) const |
bool | addMediaDescription (std::string mediaType, uint16_t mediaPort, std::string mediaProtocol, std::string mediaFormat, std::vector< std::string > mediaAttributes) |
OsiModelLayer | getOsiModelLayer () const |
std::string | toString () 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 |
Represents a SDP (Session Description Protocol) message. SDP is a text-based protocol described by a series of fields, one per line (lines are separated by CRLF). The form of each field is as follows:
Each character represents a certain type of field. All field type are represented as macros in SdpLayer.h file (for example: PCPP_SDP_ORIGINATOR_FIELD is a macro for the originator field (o=) ).
For more details about SDP structure please refer to its Wikipedia page: https://en.wikipedia.org/wiki/Session_Description_Protocol
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::SdpLayer::SdpLayer | ( | ) |
An empty c'tor which initialize an empty message with no fields
pcpp::SdpLayer::SdpLayer | ( | std::string | username, |
long | sessionID, | ||
long | sessionVersion, | ||
IPv4Address | ipAddress, | ||
std::string | sessionName, | ||
long | startTime, | ||
long | stopTime | ||
) |
A c'tor which initializes a message with the minimum required fields.
After this c'tor the message will look like this:
[in] | username | User's login on the originating host |
[in] | sessionID | A globally unique identifier for the session |
[in] | sessionVersion | A version number for this session description |
[in] | ipAddress | The address of the machine from which the session is created |
[in] | sessionName | A textual session name |
[in] | startTime | The start time of the session |
[in] | stopTime | The stop time of the session |
|
inline |
A copy constructor for this layer. Inherits the base copy constructor and doesn't add anything else
[in] | other | The instance to copy from |
bool pcpp::SdpLayer::addMediaDescription | ( | std::string | mediaType, |
uint16_t | mediaPort, | ||
std::string | mediaProtocol, | ||
std::string | mediaFormat, | ||
std::vector< std::string > | mediaAttributes | ||
) |
Adds a 'media-description' field (m=) with all necessary data and attribute fields (a=) with data relevant for this media.
After this method is run the following block of fields will be added at the end of the message:
[in] | mediaType | The media type, usually "audio", "video", "text" or "image" |
[in] | mediaPort | The transport port to which the media stream is sent |
[in] | mediaProtocol | The transport protocol, usually "udp", "RTP/AVP" or "RTP/SAVP" |
[in] | mediaFormat | A space-separated list of media format description. For example: "8 96" |
[in] | mediaAttributes | A vector of media attributes. Each string in this vector will be translated into a 'media-attribute' field (a=) |
uint16_t pcpp::SdpLayer::getMediaPort | ( | std::string | mediaType | ) | const |
The 'media-description' field (m=) contains the transport port to which the media stream is sent. This port can be used to track the RTP data relevant for the call. This method extracts this port from the 'media-description' field and returns it. Since a SDP message can contain several 'media-description' fields, one for each media type (e.g audio, image, etc.), the user is required to provide the media type. A value of 0 will be returned in the following cases: (1) if 'media-description' field doesn't exist; (2) if provided media type was not found; (3) if 'media-description' field didn't contain a port
[in] | mediaType | The media type to search in |
|
inlinevirtual |
Implements pcpp::Layer.
IPv4Address pcpp::SdpLayer::getOwnerIPv4Address | ( | ) | const |
The 'originator' field (o=) contains the IP address of the the machine from which the session is created. This IP address can be used to track the RTP data relevant for the call. This method extracts this IP address from the 'originator' field and returns it. A value of IPv4Address::Zero will be returned in the following cases: (1) if 'originator' field doesn't exist; (2) if it doesn't contain the IP address; (3) if it contains a non-IPv4 address
An assignment operator overload for this layer. Inherits the base assignment operator and doesn't add anything else
[in] | other | The instance to copy from |
|
virtual |
Implements pcpp::Layer.