Class StringMsgParser
java.lang.Object
io.github.lunasaw.sip.common.conf.msg.StringMsgParser
- All Implemented Interfaces:
gov.nist.javax.sip.parser.MessageParser
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongov.nist.javax.sip.address.AddressImpl
parseAddress
(String address) Parse an address (nameaddr or address spec) and return and address structure.gov.nist.core.Host
Parse a host name and return a parsed structure.static gov.nist.javax.sip.header.SIPHeader
parseSIPHeader
(String header) Parse an individual SIP message header from a string.gov.nist.javax.sip.message.SIPMessage
parseSIPMessage
(byte[] msgBuffer, boolean readBody, boolean strict, gov.nist.javax.sip.parser.ParseExceptionListener parseExceptionListener) Parse a buffer containing a single SIP Message where the body is an array of un-interpreted bytes.gov.nist.javax.sip.header.RequestLine
parseSIPRequestLine
(String requestLine) Parse the SIP Request Linegov.nist.javax.sip.header.StatusLine
parseSIPStatusLine
(String statusLine) Parse the SIP Response message status linegov.nist.javax.sip.address.SipUri
parseSIPUrl
(String url) Parse a SIP url from a string and return a URI structure for it.gov.nist.javax.sip.address.TelephoneNumber
parseTelephoneNumber
(String telephone_number) Parse a telephone number return a parsed structure.gov.nist.javax.sip.address.GenericURI
Parse a uri from a string and return a URI structure for it.protected gov.nist.javax.sip.message.SIPMessage
processFirstLine
(String firstLine, gov.nist.javax.sip.parser.ParseExceptionListener parseExceptionListener, byte[] msgBuffer) protected void
processHeader
(String header, gov.nist.javax.sip.message.SIPMessage message, gov.nist.javax.sip.parser.ParseExceptionListener parseExceptionListener, byte[] rawMessage) static void
setComputeContentLengthFromMessage
(boolean computeContentLengthFromMessage) protected static String
trimEndOfLine
(String line)
-
Field Details
-
computeContentLengthFromMessage
protected static boolean computeContentLengthFromMessage
-
-
Constructor Details
-
StringMsgParser
public StringMsgParser()- Since:
- v0.9
-
-
Method Details
-
parseSIPMessage
public gov.nist.javax.sip.message.SIPMessage parseSIPMessage(byte[] msgBuffer, boolean readBody, boolean strict, gov.nist.javax.sip.parser.ParseExceptionListener parseExceptionListener) throws ParseException Parse a buffer containing a single SIP Message where the body is an array of un-interpreted bytes. This is intended for parsing the message from a memory buffer when the buffer. Incorporates a bug fix for a bug that was noted by Will Sullin of Callcast- Specified by:
parseSIPMessage
in interfacegov.nist.javax.sip.parser.MessageParser
- Parameters:
msgBuffer
- a byte buffer containing the messages to be parsed. This can consist of multiple SIP Messages concatenated together.- Returns:
- a SIPMessage[] structure (request or response) containing the parsed SIP message.
- Throws:
ParseException
- is thrown when an illegal message has been encountered (and the rest of the buffer is discarded).- See Also:
-
ParseExceptionListener
-
trimEndOfLine
-
processFirstLine
protected gov.nist.javax.sip.message.SIPMessage processFirstLine(String firstLine, gov.nist.javax.sip.parser.ParseExceptionListener parseExceptionListener, byte[] msgBuffer) throws ParseException - Throws:
ParseException
-
processHeader
protected void processHeader(String header, gov.nist.javax.sip.message.SIPMessage message, gov.nist.javax.sip.parser.ParseExceptionListener parseExceptionListener, byte[] rawMessage) throws ParseException - Throws:
ParseException
-
parseAddress
Parse an address (nameaddr or address spec) and return and address structure.- Parameters:
address
- is a String containing the address to be parsed.- Returns:
- a parsed address structure.
- Throws:
ParseException
- when the address is badly formatted.- Since:
- v1.0
-
parseHost
Parse a host name and return a parsed structure.- Parameters:
host
- is a String containing the host name to be parsed- Returns:
- a parsed address structure.
- Throws:
ParseException
- a ParseException when the hostname is badly formatted.- Since:
- v1.0
-
parseTelephoneNumber
public gov.nist.javax.sip.address.TelephoneNumber parseTelephoneNumber(String telephone_number) throws ParseException Parse a telephone number return a parsed structure.- Parameters:
telephone_number
- is a String containing the telephone # to be parsed- Returns:
- a parsed address structure.
- Throws:
ParseException
- a ParseException when the address is badly formatted.- Since:
- v1.0
-
parseSIPUrl
Parse a SIP url from a string and return a URI structure for it.- Parameters:
url
- a String containing the URI structure to be parsed.- Returns:
- A parsed URI structure
- Throws:
ParseException
- if there was an error parsing the message.
-
parseUrl
Parse a uri from a string and return a URI structure for it.- Parameters:
url
- a String containing the URI structure to be parsed.- Returns:
- A parsed URI structure
- Throws:
ParseException
- if there was an error parsing the message.
-
parseSIPHeader
public static gov.nist.javax.sip.header.SIPHeader parseSIPHeader(String header) throws ParseException Parse an individual SIP message header from a string.- Parameters:
header
- String containing the SIP header.- Returns:
- a SIPHeader structure.
- Throws:
ParseException
- if there was an error parsing the message.
-
parseSIPRequestLine
public gov.nist.javax.sip.header.RequestLine parseSIPRequestLine(String requestLine) throws ParseException Parse the SIP Request Line- Parameters:
requestLine
- a String containing the request line to be parsed.- Returns:
- a RequestLine structure that has the parsed RequestLine
- Throws:
ParseException
- if there was an error parsing the requestLine.
-
parseSIPStatusLine
public gov.nist.javax.sip.header.StatusLine parseSIPStatusLine(String statusLine) throws ParseException Parse the SIP Response message status line- Parameters:
statusLine
- a String containing the Status line to be parsed.- Returns:
- StatusLine class corresponding to message
- Throws:
ParseException
- if there was an error parsing- See Also:
-
StatusLine
-
setComputeContentLengthFromMessage
public static void setComputeContentLengthFromMessage(boolean computeContentLengthFromMessage)
-