PcapPlusPlus
pcpp::SipRequestFirstLine Class Reference

#include <SipLayer.h>

Classes

class  SipRequestFirstLineException
 

Public Member Functions

SipRequestLayer::SipMethod getMethod ()
 
bool setMethod (SipRequestLayer::SipMethod newMethod)
 
std::string getUri ()
 
bool setUri (std::string newUri)
 
std::string getVersion ()
 
int getSize ()
 
bool isComplete ()
 

Static Public Member Functions

static SipRequestLayer::SipMethod parseMethod (char *data, size_t dataLen)
 

Detailed Description

Represents an SIP request first line. The first line includes 3 parameters: SIP method (e.g INVITE, ACK, BYE, etc.), URI (e.g sip:bla@b.nosp@m.la.c.nosp@m.om:12345) and SIP version (usually SIP/2.0). All these parameters are included in this class, and the user can retrieve or set them. This class cannot be instantiated by users, it's created inside SipRequestLayer and user can get a pointer to an instance of it. All "getters" of this class retrieve the actual data of the SIP request and the "setters" actually change the packet data. Since SIP is a textual protocol, most fields aren't of fixed size and this also applies to the first line parameters. So many "setter" methods of this class may need to shorten or extend the data in SipRequestLayer. These methods will return a false value if this action failed

Member Function Documentation

◆ getMethod()

SipRequestLayer::SipMethod pcpp::SipRequestFirstLine::getMethod ( )
inline
Returns
The SIP request method

◆ getSize()

int pcpp::SipRequestFirstLine::getSize ( )
inline
Returns
The size in bytes of the SIP request first line

◆ getUri()

std::string pcpp::SipRequestFirstLine::getUri ( )
Returns
A copied version of the URI (notice changing the return value won't change the actual data of the packet)

◆ getVersion()

std::string pcpp::SipRequestFirstLine::getVersion ( )
inline
Returns
The SIP version

◆ isComplete()

bool pcpp::SipRequestFirstLine::isComplete ( )
inline

As explained in SipRequestLayer, a SIP message can sometimes spread over more than 1 packet, so when looking at a single packet the header can be partial. Same goes for the first line - it can spread over more than 1 packet. This method returns an indication whether the first line is partial

Returns
False if the first line is partial, true if it's complete

◆ parseMethod()

static SipRequestLayer::SipMethod pcpp::SipRequestFirstLine::parseMethod ( char *  data,
size_t  dataLen 
)
static

A static method for parsing the SIP method out of raw data

Parameters
[in]dataThe raw data
[in]dataLenThe raw data length
Returns
The parsed SIP method

◆ setMethod()

bool pcpp::SipRequestFirstLine::setMethod ( SipRequestLayer::SipMethod  newMethod)

Set the SIP request method

Parameters
[in]newMethodThe method to set
Returns
False if newMethod is SipRequestLayer::SipMethodUnknown or if shortening/extending the SipRequestLayer data failed. True otherwise

◆ setUri()

bool pcpp::SipRequestFirstLine::setUri ( std::string  newUri)

Set the URI

Parameters
[in]newUriThe URI to set
Returns
False if shortening/extending the SipRequestLayer data failed. True otherwise