Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Packet++/header/SipLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,15 @@ namespace pcpp
friend class SipResponseLayer;

public:
/// @brief A structure containing parsed components from a SIP response first line.
struct FirstLineData
{
/// @brief The SIP protocol version (e.g., SIP/2.0)
std::string version;
/// @brief The response status code number (e.g., 200, 100)
SipResponseLayer::SipResponseStatusCode statusCode;
};

/// @return The status code as SipResponseLayer#SipResponseStatusCode enum
SipResponseLayer::SipResponseStatusCode getStatusCode() const
{
Expand Down Expand Up @@ -689,6 +698,12 @@ namespace pcpp
/// @return The parsed SIP version string or an empty string if version cannot be extracted
static std::string parseVersion(const char* data, size_t dataLen);

/// @brief A static method for parsing the complete SIP response first line from raw data
/// @param data The raw data containing the SIP response line
/// @param dataLen The raw data length
/// @return A pair where first indicates success/failure, and second contains the parsed data.
static std::pair<bool, FirstLineData> parseFirstLine(const char* data, size_t dataLen);

/// @return The size in bytes of the SIP response first line
int getSize() const
{
Expand Down
Loading
Loading