PcapPlusPlus
pcpp::SipRequestLayer Class Reference

#include <SipLayer.h>

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

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 ()
 
std::string toString ()
 
- Public Member Functions inherited from pcpp::SipLayer
int getContentLength ()
 
HeaderFieldsetContentLength (int contentLength, const std::string prevFieldName="")
 
OsiModelLayer getOsiModelLayer ()
 
void parseNextLayer ()
 
void computeCalculateFields ()
 
- Public Member Functions inherited from pcpp::TextBasedProtocolMessage
HeaderFieldgetFieldByName (std::string fieldName, int index=0)
 
HeaderFieldgetFirstField ()
 
HeaderFieldgetNextField (HeaderField *prevField)
 
int getFieldCount ()
 
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 ()
 
size_t getHeaderLen ()
 
- Public Member Functions inherited from pcpp::Layer
virtual ~Layer ()
 
LayergetNextLayer ()
 
LayergetPrevLayer ()
 
ProtocolType getProtocol ()
 
uint8_t * getData ()
 
size_t getDataLen ()
 
uint8_t * getLayerPayload ()
 
size_t getLayerPayloadSize ()
 
bool isAllocatedToPacket ()
 
void copyData (uint8_t *toArr)
 

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

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

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
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"
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

SipRequestFirstLine* pcpp::SipRequestLayer::getFirstLine ( )
inline
Returns
A pointer to the first line instance for this message
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
std::string pcpp::SipRequestLayer::toString ( )
virtual
Returns
A string representation of the layer most important data (should look like the layer description in Wireshark)

Implements pcpp::Layer.