14 #define PCPP_SIP_FROM_FIELD "From"
16 #define PCPP_SIP_TO_FIELD "To"
18 #define PCPP_SIP_VIA_FIELD "Via"
20 #define PCPP_SIP_CALL_ID_FIELD "Call-ID"
22 #define PCPP_SIP_CONTENT_TYPE_FIELD "Content-Type"
24 #define PCPP_SIP_CONTENT_LENGTH_FIELD "Content-Length"
26 #define PCPP_SIP_CONTENT_DISPOSITION_FIELD "Content-Disposition"
28 #define PCPP_SIP_CONTENT_ENCODING_FIELD "Content-Encoding"
30 #define PCPP_SIP_CONTENT_LANGUAGE_FIELD "Content-Language"
32 #define PCPP_SIP_CSEQ_FIELD "CSeq"
34 #define PCPP_SIP_CONTACT_FIELD "Contact"
36 #define PCPP_SIP_MAX_FORWARDS_FIELD "Max-Forwards"
38 #define PCPP_SIP_USER_AGENT_FIELD "User-Agent"
40 #define PCPP_SIP_ACCEPT_FIELD "Accept"
42 #define PCPP_SIP_ACCEPT_ENCODING_FIELD "Accept-Encoding"
44 #define PCPP_SIP_ACCEPT_LANGUAGE_FIELD "Accept-Language"
46 #define PCPP_SIP_ALLOW_FIELD "Allow"
48 #define PCPP_SIP_AUTHORIZATION_FIELD "Authorization"
50 #define PCPP_SIP_DATE_FIELD "Date"
52 #define PCPP_SIP_MIME_VERSION_FIELD "MIME-Version"
54 #define PCPP_SIP_REASON_FIELD "Reason"
56 #define PCPP_SIP_SUPPORTED_FIELD "Supported"
58 #define PCPP_SIP_SERVER_FIELD "Server"
60 #define PCPP_SIP_WWW_AUTHENTICATE_FIELD "WWW-Authenticate"
62 #define PCPP_SIP_RETRY_AFTER_FIELD "Retry-After"
64 #define PCPP_SIP_RECORD_ROUTE_FIELD "Record-Route"
114 return port == 5060 || port == 5061;
121 SipLayer() : TextBasedProtocolMessage()
123 SipLayer(
const SipLayer& other) : TextBasedProtocolMessage(other)
125 SipLayer& operator=(
const SipLayer& other)
127 TextBasedProtocolMessage::operator=(other);
132 char getHeaderFieldNameValueSeparator()
const override
136 bool spacesAllowedBetweenHeaderFieldNameAndValue()
const override
142 class SipRequestFirstLine;
459 const std::string& sipVersion =
"SIP/2.0");
537 return m_FirstLineEndOffset;
558 void setMessage(
const std::string& message)
562 virtual const char* what()
const noexcept
564 return m_Message.c_str();
568 std::string m_Message;
574 const std::string& uri);
580 std::string m_Version;
583 int m_FirstLineEndOffset;
647 return m_FirstLineEndOffset;
668 void setMessage(
const std::string& message)
672 virtual const char* what()
const noexcept
674 return m_Message.c_str();
678 std::string m_Message;
687 std::string m_Version;
689 int m_FirstLineEndOffset;
Definition: SipLayer.h:70
void computeCalculateFields() override
OsiModelLayer getOsiModelLayer() const override
Definition: SipLayer.h:96
HeaderField * setContentLength(int contentLength, const std::string &prevFieldName="")
static bool isSipPort(uint16_t port)
Definition: SipLayer.h:112
int getContentLength() const
void parseNextLayer() override
Definition: SipLayer.h:554
Definition: SipLayer.h:497
std::string getVersion() const
Definition: SipLayer.h:523
bool setUri(const std::string &newUri)
bool isComplete() const
Definition: SipLayer.h:544
std::string getUri() const
int getSize() const
Definition: SipLayer.h:535
bool setMethod(SipRequestLayer::SipMethod newMethod)
static SipRequestLayer::SipMethod parseMethod(const char *data, size_t dataLen)
SipRequestLayer::SipMethod getMethod() const
Definition: SipLayer.h:502
Definition: SipLayer.h:152
SipRequestLayer(const SipRequestLayer &other)
SipRequestLayer & operator=(const SipRequestLayer &other)
SipRequestFirstLine * getFirstLine() const
Definition: SipLayer.h:218
SipRequestLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
std::string toString() const override
SipRequestLayer(SipMethod method, const std::string &requestUri, const std::string &version="SIP/2.0")
SipMethod
SIP request methods.
Definition: SipLayer.h:158
@ SipMESSAGE
MESSAGE.
Definition: SipLayer.h:184
@ SipSUBSCRIBE
SUBSCRIBE.
Definition: SipLayer.h:174
@ SipINFO
INFO.
Definition: SipLayer.h:180
@ SipUPDATE
UPDATE.
Definition: SipLayer.h:186
@ SipPUBLISH
PUBLISH.
Definition: SipLayer.h:178
@ SipCANCEL
CANCEL.
Definition: SipLayer.h:166
@ SipINVITE
INVITE.
Definition: SipLayer.h:160
@ SipNOTIFY
NOTIFY.
Definition: SipLayer.h:176
@ SipPRACK
PRACK.
Definition: SipLayer.h:170
@ SipOPTIONS
OPTIONS.
Definition: SipLayer.h:172
@ SipREGISTER
REFISTER.
Definition: SipLayer.h:168
@ SipMethodUnknown
Unknown SIP method.
Definition: SipLayer.h:188
@ SipACK
ACK.
Definition: SipLayer.h:162
@ SipREFER
REFER.
Definition: SipLayer.h:182
@ SipBYE
BYE.
Definition: SipLayer.h:164
Definition: SipLayer.h:664
Definition: SipLayer.h:598
static SipResponseLayer::SipResponseStatusCode parseStatusCode(const char *data, size_t dataLen)
static std::string parseVersion(const char *data, size_t dataLen)
bool setStatusCode(SipResponseLayer::SipResponseStatusCode newStatusCode, std::string statusCodeString="")
SipResponseLayer::SipResponseStatusCode getStatusCode() const
Definition: SipLayer.h:603
int getStatusCodeAsInt() const
void setVersion(const std::string &newVersion)
int getSize() const
Definition: SipLayer.h:645
bool isComplete() const
Definition: SipLayer.h:654
std::string getVersion() const
Definition: SipLayer.h:622
std::string getStatusCodeString() const
Definition: SipLayer.h:241
SipResponseStatusCode
Definition: SipLayer.h:248
@ Sip416UnsupportedURIScheme
Request-URI is unknown to the server.
Definition: SipLayer.h:323
@ Sip608Rejected
An intermediary machine or process rejected the call attempt.
Definition: SipLayer.h:438
@ Sip415UnsupportedMediaType
Request body in a format not supported.
Definition: SipLayer.h:321
@ Sip420BadExtension
Bad SIP Protocol Extension used, not understood by the server.
Definition: SipLayer.h:327
@ Sip428UseIdentityHeader
The server policy requires an Identity header, and one has not been provided.
Definition: SipLayer.h:340
@ Sip502BadGateway
Definition: SipLayer.h:406
@ Sip181CallisBeingForwarded
Servers can optionally send this response to indicate a call is being forwarded.
Definition: SipLayer.h:255
@ Sip503ServiceUnavailable
Definition: SipLayer.h:409
@ Sip183SessioninProgress
This response may be used to send extra information for a call which is still being set up.
Definition: SipLayer.h:260
@ Sip301MovedPermanently
Definition: SipLayer.h:275
@ Sip414RequestURITooLong
Definition: SipLayer.h:319
@ Sip555PushNotificationServiceNotSupported
Definition: SipLayer.h:419
@ Sip504ServerTimeout
Definition: SipLayer.h:412
@ Sip380AlternativeService
The call failed, but alternatives are detailed in the message body.
Definition: SipLayer.h:282
@ Sip600BusyEverywhere
Definition: SipLayer.h:424
@ Sip202Accepted
Indicates that the request has been accepted for processing, but the processing has not been complete...
Definition: SipLayer.h:267
@ Sip500ServerInternalError
The server could not fulfill the request due to some unexpected condition.
Definition: SipLayer.h:399
@ Sip493Undecipherable
Request contains an encrypted MIME body, which recipient can not decrypt.
Definition: SipLayer.h:393
@ Sip412ConditionalRequestFailed
The given precondition has not been met.
Definition: SipLayer.h:314
@ Sip402PaymentRequired
Reserved for future use.
Definition: SipLayer.h:288
@ Sip436BadIdentityInfo
The request has an Identity-Info header, and the URI scheme in that header cannot be dereferenced.
Definition: SipLayer.h:350
@ Sip422SessionIntervalTooSmall
The received request contains a Session-Expires header field with a duration below the minimum timer.
Definition: SipLayer.h:331
@ Sip406NotAcceptable
Definition: SipLayer.h:300
@ Sip180Ringing
Destination user agent received INVITE, and is alerting user of call.
Definition: SipLayer.h:253
@ Sip470ConsentNeeded
The source of the request did not have the permission of the recipient to make such a request.
Definition: SipLayer.h:369
@ Sip199EarlyDialogTerminated
Definition: SipLayer.h:263
@ Sip305UseProxy
The Contact field details a proxy that must be used to access the requested destination.
Definition: SipLayer.h:280
@ Sip604DoesNotExistAnywhere
The server has authoritative information that the requested user does not exist anywhere.
Definition: SipLayer.h:430
@ Sip424BadLocationInformation
The request's location content was malformed or otherwise unsatisfactory.
Definition: SipLayer.h:335
@ Sip400BadRequest
The request could not be understood due to malformed syntax.
Definition: SipLayer.h:284
@ Sip486BusyHere
Callee is busy.
Definition: SipLayer.h:383
@ Sip484AddressIncomplete
Request-URI incomplete.
Definition: SipLayer.h:379
@ Sip413RequestEntityTooLarge
Request body too large.
Definition: SipLayer.h:316
@ Sip433AnonymityDisallowed
The request has been rejected because it was anonymous.
Definition: SipLayer.h:348
@ Sip501NotImplemented
Definition: SipLayer.h:403
@ Sip491RequestPending
Server has some pending request from the same dialog.
Definition: SipLayer.h:391
@ Sip429ProvideReferrerIdentity
The server did not receive a valid Referred-By token on the request.
Definition: SipLayer.h:342
@ Sip408RequestTimeout
Definition: SipLayer.h:306
@ Sip603Decline
Definition: SipLayer.h:428
@ Sip440MaxBreadthExceeded
Definition: SipLayer.h:363
@ Sip439FirstHopLacksOutboundSupport
Definition: SipLayer.h:358
@ Sip480TemporarilyUnavailable
Callee currently unavailable.
Definition: SipLayer.h:371
@ Sip481Call_TransactionDoesNotExist
Server received a request that does not match any dialog or transaction.
Definition: SipLayer.h:373
@ Sip409Conflict
User already registered.
Definition: SipLayer.h:308
@ Sip606NotAcceptable
Definition: SipLayer.h:433
@ Sip403Forbidden
The server understood the request, but is refusing to fulfill it.
Definition: SipLayer.h:290
@ Sip421ExtensionRequired
The server needs a specific extension not listed in the Supported header.
Definition: SipLayer.h:329
@ Sip487RequestTerminated
Request has terminated by bye or cancel.
Definition: SipLayer.h:385
@ Sip404NotFound
Definition: SipLayer.h:294
@ Sip100Trying
Definition: SipLayer.h:251
@ Sip411LengthRequired
The server will not accept the request without a valid Content-Length.
Definition: SipLayer.h:312
@ Sip407ProxyAuthenticationRequired
The request requires user authentication. This response is issued by proxies.
Definition: SipLayer.h:302
@ Sip204NoNotification
Indicates the request was successful, but the corresponding response will not be received.
Definition: SipLayer.h:269
@ Sip494SecurityAgreementRequired
Definition: SipLayer.h:397
@ Sip437UnsupportedCertificate
The server was unable to validate a certificate for the domain that signed the request.
Definition: SipLayer.h:352
@ Sip488NotAcceptableHere
Some aspect of the session description or the Request-URI is not acceptable.
Definition: SipLayer.h:387
@ Sip417UnknownResourcePriority
There was a resource-priority option tag, but no Resource-Priority header.
Definition: SipLayer.h:325
@ Sip405MethodNotAllowed
Definition: SipLayer.h:297
@ SipStatusCodeUnknown
Unknown SIP status code.
Definition: SipLayer.h:440
@ Sip430FlowFailed
Definition: SipLayer.h:346
@ Sip469BadInfoPackage
Definition: SipLayer.h:367
@ Sip302MovedTemporarily
Definition: SipLayer.h:278
@ Sip489BadEvent
The server did not understand an event package specified in an Event header field.
Definition: SipLayer.h:389
@ Sip410Gone
The user existed once, but is not available here any more.
Definition: SipLayer.h:310
@ Sip300MultipleChoices
Definition: SipLayer.h:272
@ Sip482LoopDetected
Server has detected a loop.
Definition: SipLayer.h:375
@ Sip483TooManyHops
Max-Forwards header has reached the value '0'.
Definition: SipLayer.h:377
@ Sip513MessageTooLarge
The request message length is longer than the server can process.
Definition: SipLayer.h:416
@ Sip580PreconditionFailure
The server is unable or unwilling to meet some constraints specified in the offer.
Definition: SipLayer.h:421
@ Sip401Unauthorized
The request requires user authentication. This response is issued by UASs and registrars.
Definition: SipLayer.h:286
@ Sip438InvalidIdentityHeader
Definition: SipLayer.h:355
@ Sip485Ambiguous
Request-URI is ambiguous.
Definition: SipLayer.h:381
@ Sip607Unwanted
Definition: SipLayer.h:436
@ Sip425BadAlertMessage
Definition: SipLayer.h:338
@ Sip200OK
Indicates the request was successful.
Definition: SipLayer.h:265
@ Sip182Queued
Definition: SipLayer.h:258
@ Sip423IntervalTooBrief
Expiration time of the resource is too short.
Definition: SipLayer.h:333
@ Sip505VersionNotSupported
The SIP protocol version in the request is not supported by the server.
Definition: SipLayer.h:414
std::string toString() const override
SipResponseLayer(SipResponseLayer::SipResponseStatusCode statusCode, std::string statusCodeString="", const std::string &sipVersion="SIP/2.0")
SipResponseLayer & operator=(const SipResponseLayer &other)
SipResponseFirstLine * getFirstLine() const
Definition: SipLayer.h:474
SipResponseLayer(uint8_t *data, size_t dataLen, Layer *prevLayer, Packet *packet)
SipResponseLayer(const SipResponseLayer &other)
Definition: TextBasedProtocol.h:105
The main namespace for the PcapPlusPlus lib.
uint8_t ProtocolType
Definition: ProtocolType.h:13
OsiModelLayer
An enum representing OSI model layers.
Definition: ProtocolType.h:225
@ OsiModelSesionLayer
Session layer (layer 5)
Definition: ProtocolType.h:235