PcapPlusPlus  19.12
pcpp::SipRequestLayer Class Reference

#include <SipLayer.h>

Inheritance diagram for pcpp::SipRequestLayer:
pcpp::SipLayer pcpp::TextBasedProtocolMessage pcpp::Layer pcpp::IDataContainer

Public Types

enum  SipMethod {
  SipINVITE, SipACK, SipBYE, SipCANCEL,
  SipREGISTER, SipPRACK, SipOPTIONS, SipSUBSCRIBE,
  SipNOTIFY, SipPUBLISH, SipINFO, SipREFER,
  SipMESSAGE, SipUPDATE, SipMethodUnknown
}
 

Public Member Functions

 SipRequestLayer (uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
 
 SipRequestLayer (SipMethod method, std::string requestUri, std::string version="SIP/2.0")
 
 SipRequestLayer (const SipRequestLayer &other)
 
SipRequestLayeroperator= (const SipRequestLayer &other)
 
SipRequestFirstLinegetFirstLine () const
 
std::string toString () const
 
- Public Member Functions inherited from pcpp::SipLayer
int getContentLength () const
 
HeaderFieldsetContentLength (int contentLength, const std::string prevFieldName="")
 
OsiModelLayer getOsiModelLayer () const
 
void parseNextLayer ()
 
void computeCalculateFields ()
 
- Public Member Functions inherited from pcpp::TextBasedProtocolMessage
HeaderFieldgetFieldByName (std::string fieldName, int index=0) const
 
HeaderFieldgetFirstField () const
 
HeaderFieldgetNextField (HeaderField *prevField) const
 
int getFieldCount () const
 
virtual HeaderFieldaddField (const std::string &fieldName, const std::string &fieldValue)
 
virtual HeaderFieldaddField (const HeaderField &newField)
 
HeaderFieldaddEndOfHeader ()
 
virtual HeaderFieldinsertField (HeaderField *prevField, const std::string &fieldName, const std::string &fieldValue)
 
virtual HeaderFieldinsertField (std::string prevFieldName, const std::string &fieldName, const std::string &fieldValue)
 
virtual HeaderFieldinsertField (HeaderField *prevField, const HeaderField &newField)
 
bool removeField (HeaderField *fieldToRemove)
 
bool removeField (std::string fieldName, int index=0)
 
bool isHeaderComplete () const
 
size_t getHeaderLen () const
 
- Public Member Functions inherited from pcpp::Layer
virtual ~Layer ()
 
LayergetNextLayer () const
 
LayergetPrevLayer () 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
 

Detailed Description

Represents a SIP request header and inherits all basic functionality of SipLayer and TextBasedProtocolMessage. The functionality that is added for this class is the SIP first line concept. A SIP request has the following first line: INVITE sip:bla@b.nosp@m.la.c.nosp@m.om:12345 SIP/2.0 Since it's not an "ordinary" header field, it requires a special treatment and gets a class of it's own: SipRequestFirstLine. In most cases a SIP request will be contained in a single packet but for cases it is not, only the first packet will be identified as SIP request layer. You can find out whether the header is complete by using SipLayer::isHeaderComplete()

Member Enumeration Documentation

◆ SipMethod

SIP request methods

Enumerator
SipINVITE 

INVITE

SipACK 

ACK

SipBYE 

BYE

SipCANCEL 

CANCEL

SipREGISTER 

REFISTER

SipPRACK 

PRACK

SipOPTIONS 

OPTIONS

SipSUBSCRIBE 

SUBSCRIBE

SipNOTIFY 

NOTIFY

SipPUBLISH 

PUBLISH

SipINFO 

INFO

SipREFER 

REFER

SipMESSAGE 

MESSAGE

SipUPDATE 

UPDATE

SipMethodUnknown 

Unknown SIP method

Constructor & Destructor Documentation

◆ SipRequestLayer() [1/3]

pcpp::SipRequestLayer::SipRequestLayer ( uint8_t *  data,
size_t  dataLen,
Layer prevLayer,
Packet packet 
)

A constructor that creates the layer from an existing packet raw data

Parameters
[in]dataA pointer to the raw data
[in]dataLenSize of the data in bytes
[in]prevLayerA pointer to the previous layer
[in]packetA pointer to the Packet instance where layer will be stored in

◆ SipRequestLayer() [2/3]

pcpp::SipRequestLayer::SipRequestLayer ( SipMethod  method,
std::string  requestUri,
std::string  version = "SIP/2.0" 
)

A constructor that allocates a new SIP request with only the first line filled. The request will be created without further fields. The user can then add fields using addField() or insertField() methods

Parameters
[in]methodThe SIP method to be used in this SIP request
[in]requestUriThe URI of the request
[in]versionSIP version to be used in this request. Default is "SIP/2.0"

◆ SipRequestLayer() [3/3]

pcpp::SipRequestLayer::SipRequestLayer ( const SipRequestLayer other)

A copy constructor for this layer. Inherits base copy constructor SipLayer and adds the functionality of copying the first line

Parameters
[in]otherThe instance to copy from

Member Function Documentation

◆ getFirstLine()

SipRequestFirstLine* pcpp::SipRequestLayer::getFirstLine ( ) const
inline
Returns
A pointer to the first line instance for this message

◆ operator=()

SipRequestLayer& pcpp::SipRequestLayer::operator= ( const SipRequestLayer other)

An assignment operator overload for this layer. This method inherits base assignment operator SipLayer::operator=() and adds the functionality of copying the first line

Parameters
[in]otherThe instance to copy from

◆ toString()

std::string pcpp::SipRequestLayer::toString ( ) const
virtual
Returns
A string representation of the layer most important data (should look like the layer description in Wireshark)

Implements pcpp::Layer.