public interface SipPacket extends ApplicationPacket
| Modifier and Type | Method and Description |
|---|---|
SipPacket |
clone() |
CallIdHeader |
getCallIDHeader()
Convenience method for fetching the call-id-header
|
ContactHeader |
getContactHeader()
Get the
ContactHeader |
Object |
getContent()
|
ContentTypeHeader |
getContentTypeHeader()
Get the
ContentTypeHeader for this message. |
CSeqHeader |
getCSeqHeader()
Convenience method for fetching the CSeq header
|
FromHeader |
getFromHeader()
Convenience method for fetching the from-header
|
Optional<SipHeader> |
getHeader(Buffer headerName)
Get the header as a buffer
|
Optional<SipHeader> |
getHeader(String headerName)
Same as
#getHeader(Buffers.wrap(keyParameter). |
List<SipHeader> |
getHeaders()
Get all headers as a list of
SipHeader |
Map<String,List<SipHeader>> |
getHeaderValues()
Get all headers as keyed by header name
|
Buffer |
getInitialLine()
The first line of a sip message, which is either a request or a response
line
|
MaxForwardsHeader |
getMaxForwards() |
Buffer |
getMethod()
Get the method of this sip message
|
Buffer |
getRawContent()
Get the content as a
Buffer. |
RecordRouteHeader |
getRecordRouteHeader()
Get the top-most
RecordRouteHeader header if present. |
List<RecordRouteHeader> |
getRecordRouteHeaders()
Get all the RecordRoute-headers in this
SipMessage. |
RouteHeader |
getRouteHeader()
Get the top-most
RouteHeader header if present. |
List<RouteHeader> |
getRouteHeaders()
Get all the Route-headers in this
SipMessage. |
ToHeader |
getToHeader()
Convenience method for fetching the to-header
|
ViaHeader |
getViaHeader()
Get the top-most
ViaHeader if present. |
List<ViaHeader> |
getViaHeaders()
Get all the Via-headers in this
SipMessage. |
boolean |
hasContent()
Checks whether this
SipPacket is carrying anything in its message
body. |
boolean |
isAck()
Convenience method for determining whether the method of this message is
an ACK or not.
|
boolean |
isBye()
Convenience method for determining whether the method of this message is
a BYE or not.
|
boolean |
isCancel()
Convenience method for determining whether the method of this message is
a CANCEL or not
|
boolean |
isInfo()
Convenience method for determining whether the method of this message is
a INFO or not.
|
boolean |
isInitial()
Checks whether or not this request is considered to be an "initial"
request, i.e., a request that does not go within a dialog.
|
boolean |
isInvite()
Convenience method for determining whether the method of this message is
an INVITE or not.
|
boolean |
isMessage()
Convenience method for determining whether the method of this message is
a MESSAGE or not.
|
boolean |
isOptions()
Convenience method for determining whether the method of this message is
a OPTIONS or not.
|
boolean |
isRequest()
Check whether this sip message is a request or not
|
boolean |
isResponse()
Check whether this sip message is a response or not
|
Buffer |
toBuffer()
|
SipRequestPacket |
toRequest()
Got tired of casting the
SipPacket into a
SipRequestPacket so you can use this method instead. |
SipResponsePacket |
toResponse()
Got tired of casting the
SipPacket into a
SipResponsePacket so you can use this method instead. |
void |
verify()
Calling this method will force the packet to completely parse its data
and check so that all the information conforms to whatever rules this
packet needs to follow.
|
getArrivalTime, getName, getNextPacket, getPacket, getParentPacket, getPayload, getProtocol, hasProtocol, write, writeBuffer getInitialLine()
SipRequestPacket toRequest() throws ClassCastException
SipPacket into a
SipRequestPacket so you can use this method instead. Just a short
cut for:
(SipRequest)sipMessage;
SipRequestPacketClassCastException - in case this SipPacket is actually a
SipResponsePacket.SipResponsePacket toResponse() throws ClassCastException
SipPacket into a
SipResponsePacket so you can use this method instead. Just a
short cut for:
(SipResponse)sipMessage;
SipResponsePacketClassCastException - in case this SipPacket is actually a
SipResponsePacket.boolean isResponse()
boolean isRequest()
Object getContent() throws SipPacketParseException
SipPacket as an
Object. If the ContentTypeHeader indicates a content type
that is known (such as an sdp) then an attempt to parse the content into
that type is made. If the payload is unknown then a Buffer
representing the payload will be returned.SipPacketParseException - in case anything goes wrong when trying to frame the content
in any way.boolean hasContent()
SipPacket is carrying anything in its message
body.SipPacket has a message body, false
otherwise.Buffer getMethod() throws SipPacketParseException
SipPacketParseExceptionList<SipHeader> getHeaders()
SipHeaderSipHeaderMap<String,List<SipHeader>> getHeaderValues()
SipHeaderOptional<SipHeader> getHeader(Buffer headerName) throws SipPacketParseException
headerName - the name of the header we wish to fetchSipHeader or null if not foundSipPacketParseExceptionOptional<SipHeader> getHeader(String headerName) throws SipPacketParseException
#getHeader(Buffers.wrap(keyParameter).headerName - the name of the header we wish to fetchSipHeaderSipPacketParseExceptionFromHeader getFromHeader() throws SipPacketParseException
SipPacketParseException - TODOToHeader getToHeader() throws SipPacketParseException
SipPacketParseExceptionViaHeader getViaHeader() throws SipPacketParseException
ViaHeader if present. If this is a request that
has been sent then there should always be a ViaHeader present.
However, you just created a SipPacket yourself then this method
may return null so please check for it.ViaHeader or null if there are no
ViaHeaders on this message just yet.SipPacketParseExceptionList<ViaHeader> getViaHeaders() throws SipPacketParseException
SipMessage. If this is a request
that just was created then this may return an empty list.SipPacketParseExceptionMaxForwardsHeader getMaxForwards() throws SipPacketParseException
SipPacketParseExceptionRecordRouteHeader getRecordRouteHeader() throws SipPacketParseException
RecordRouteHeader header if present.RecordRouteHeader header or null if there
are no RecordRouteHeader headers found in this
SipPacket.SipPacketParseExceptionList<RecordRouteHeader> getRecordRouteHeaders() throws SipPacketParseException
SipMessage. If there are
no RecordRouteHeaders in this SipMessage then an empty
list will be returned.SipPacketParseExceptionRouteHeader getRouteHeader() throws SipPacketParseException
RouteHeader header if present.RouteHeader header or null if there are no
RouteHeader headers found in this SipPacket.SipPacketParseExceptionList<RouteHeader> getRouteHeaders() throws SipPacketParseException
SipMessage. If there are no
RouteHeaders in this SipMessage then an empty list will
be returned.SipPacketParseExceptionContactHeader getContactHeader() throws SipPacketParseException
ContactHeaderSipPacketParseExceptionContentTypeHeader getContentTypeHeader() throws SipPacketParseException
ContentTypeHeader for this message. If there is no
Content-Type header in this SIP message then null will be returned.ContentTypeHeader or null if there is none.SipPacketParseExceptionCallIdHeader getCallIDHeader() throws SipPacketParseException
SipPacketParseExceptionCSeqHeader getCSeqHeader() throws SipPacketParseException
SipPacketParseExceptionboolean isInvite()
throws SipPacketParseException
SipPacketParseException - in case the method could not be parsed out of the underlying
buffer.boolean isBye()
throws SipPacketParseException
SipPacketParseException - in case the method could not be parsed out of the underlying
buffer.boolean isAck()
throws SipPacketParseException
SipPacketParseException - in case the method could not be parsed out of the underlying
buffer.boolean isOptions()
throws SipPacketParseException
SipPacketParseException - in case the method could not be parsed out of the underlying
buffer.boolean isMessage()
throws SipPacketParseException
SipPacketParseException - in case the method could not be parsed out of the underlying
buffer.boolean isInfo()
throws SipPacketParseException
SipPacketParseException - in case the method could not be parsed out of the underlying
buffer.boolean isCancel()
throws SipPacketParseException
SipPacketParseException - in case the method could not be parsed out of the underlying
buffer.boolean isInitial()
throws SipPacketParseException
SipPacketParseExceptionvoid verify()
IPPacket, hardly does anything
in this method but more complex protocols such as SIP (once again), HTTP
etc can spend quite some time verifying everything, which is why you
don't want to do it unless you really have to.
In general, yajpcap has the philosophy of
"assume that everything is ok until things blow up and then deal with it"
In the case of a SIP message the following checks are conducted: The following checks are available:
This list is taken from Kamailio.org
Buffer toBuffer()
Buffer that is representing this SipPacket. Note,
the data behind the buffer is shared with the actual SipPacket so
any changes to the Buffer will affect this SipPacket.
Hence, by changing this buffer directly, you bypass all checks for valid
inputs and the end-result of doing so is undefined (most likely you will
either blow up at some point or you will end up sending garbage across
the network).Copyright © 2021. All Rights Reserved.