PcapPlusPlus
20.08
|
#include <SipLayer.h>
Classes | |
class | SipResponseFirstLineException |
Public Member Functions | |
SipResponseLayer::SipResponseStatusCode | getStatusCode () const |
int | getStatusCodeAsInt () const |
std::string | getStatusCodeString () const |
bool | setStatusCode (SipResponseLayer::SipResponseStatusCode newStatusCode, std::string statusCodeString="") |
std::string | getVersion () const |
void | setVersion (std::string newVersion) |
int | getSize () const |
bool | isComplete () const |
Static Public Member Functions | |
static SipResponseLayer::SipResponseStatusCode | parseStatusCode (char *data, size_t dataLen) |
static std::string | parseVersion (char *data, size_t dataLen) |
Represents an SIP response message first line. The first line includes 2 parameters: status code (e.g 100 Trying ,200 OK, etc.), and SIP version (usually SIP/2.0). These 2 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 SipResponseLayer and user can get a pointer to an instance of it. The "getter" methods of this class will retrieve the actual data of the SIP response and the "setter" methods will 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 most "setter" methods of this class may need to shorten or extend the data in SipResponseLayer. These methods will return a false value if this action failed
|
inline |
|
inline |
int pcpp::SipResponseFirstLine::getStatusCodeAsInt | ( | ) | const |
std::string pcpp::SipResponseFirstLine::getStatusCodeString | ( | ) | const |
|
inline |
|
inline |
As explained in SipResponseLayer, 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
|
static |
A static method for parsing the SIP status code out of raw data
[in] | data | The raw data |
[in] | dataLen | The raw data length |
|
static |
A static method for parsing the SIP version out of raw data
[in] | data | The raw data |
[in] | dataLen | The raw data length |
bool pcpp::SipResponseFirstLine::setStatusCode | ( | SipResponseLayer::SipResponseStatusCode | newStatusCode, |
std::string | statusCodeString = "" |
||
) |
Set the status code
[in] | newStatusCode | The new status code to set |
[in] | statusCodeString | An optional parameter: set a non-default status code message (e.g "Bla Bla" instead of "Not Found"). If this parameter isn't supplied or supplied as empty string (""), the default message for the status code will be set |
void pcpp::SipResponseFirstLine::setVersion | ( | std::string | newVersion | ) |
Set the SIP version. The version to set is expected to be in the format of SIP/x.y otherwise an error will be written to log
[in] | newVersion | The SIP version to set |