|
NIST-SIP: The Reference Implementation for JAIN-SIP 1.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgov.nist.javax.sip.parser.StringMsgParser
public class StringMsgParser
Parse SIP message and parts of SIP messages such as URI's etc from memory and return a structure. Intended use: UDP message processing. This class is used when you have an entire SIP message or SIPHeader or SIP URL in memory and you want to generate a parsed structure from it. For SIP messages, the payload can be binary or String. If you have a binary payload, use parseSIPMessage(byte[]) else use parseSIPMessage(String) The payload is accessible from the parsed message using the getContent and getContentBytes methods provided by the SIPMessage class. If SDP parsing is enabled using the parseContent method, then the SDP body is also parsed and can be accessed from the message using the getSDPAnnounce method. Currently only eager parsing of the message is supported (i.e. the entire message is parsed in one feld swoop).
Constructor Summary | |
---|---|
StringMsgParser()
|
|
StringMsgParser(ParseExceptionListener exhandler)
Constructor (given a parse exception handler). |
Method Summary | |
---|---|
static void |
main(String[] args)
Test code. |
AddressImpl |
parseAddress(String address)
Parse an address (nameaddr or address spec) and return and address structure. |
gov.nist.core.Host |
parseHost(String host)
Parse a host name and return a parsed structure. |
SIPHeader |
parseSIPHeader(String header)
Parse an individual SIP message header from a string. |
SIPMessage |
parseSIPMessage(byte[] msgBuffer)
Parse a buffer containing a single SIP Message where the body is an array of un-interpreted bytes. |
SIPMessage |
parseSIPMessage(String msgString)
Parse a buffer containing one or more SIP Messages and return an array of SIPMessage parsed structures. |
RequestLine |
parseSIPRequestLine(String requestLine)
Parse the SIP Request Line |
StatusLine |
parseSIPStatusLine(String statusLine)
Parse the SIP Response message status line |
SipUri |
parseSIPUrl(String url)
Parse a SIP url from a string and return a URI structure for it. |
TelephoneNumber |
parseTelephoneNumber(String telephone_number)
Parse a telephone number return a parsed structure. |
GenericURI |
parseUrl(String url)
Parse a uri from a string and return a URI structure for it. |
static void |
setComputeContentLengthFromMessage(boolean computeContentLengthFromMessage)
|
void |
setParseExceptionListener(ParseExceptionListener pexhandler)
Add a handler for header parsing errors. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StringMsgParser()
public StringMsgParser(ParseExceptionListener exhandler)
exhandler
- is the parse exception listener for the message parser.Method Detail |
---|
public void setParseExceptionListener(ParseExceptionListener pexhandler)
pexhandler
- is a class that implements the ParseExceptionListener
interface.public SIPMessage parseSIPMessage(byte[] msgBuffer) throws ParseException
msgBuffer
- a byte buffer containing the messages to be parsed. This can
consist of multiple SIP Messages concatenated together.
ParseException
- is thrown when an illegal message has been encountered
(and the rest of the buffer is discarded).ParseExceptionListener
public SIPMessage parseSIPMessage(String msgString) throws ParseException
msgString
- a String containing the messages to be parsed. This can
consist of multiple SIP Messages concatenated together.
ParseException
- is thrown when an illegal message has been encountered
(and the rest of the buffer is discarded).ParseExceptionListener
public AddressImpl parseAddress(String address) throws ParseException
address
- is a String containing the address to be parsed.
ParseException
- when the address is badly formatted.public gov.nist.core.Host parseHost(String host) throws ParseException
host
- is a String containing the host name to be parsed
ParseException
- a ParseException when the hostname is badly formatted.public TelephoneNumber parseTelephoneNumber(String telephone_number) throws ParseException
telephone_number
- is a String containing the telephone # to be parsed
ParseException
- a ParseException when the address is badly formatted.public SipUri parseSIPUrl(String url) throws ParseException
url
- a String containing the URI structure to be parsed.
ParseException
- if there was an error parsing the message.public GenericURI parseUrl(String url) throws ParseException
url
- a String containing the URI structure to be parsed.
ParseException
- if there was an error parsing the message.public SIPHeader parseSIPHeader(String header) throws ParseException
header
- String containing the SIP header.
ParseException
- if there was an error parsing the message.public RequestLine parseSIPRequestLine(String requestLine) throws ParseException
requestLine
- a String containing the request line to be parsed.
ParseException
- if there was an error parsing the requestLine.public StatusLine parseSIPStatusLine(String statusLine) throws ParseException
statusLine
- a String containing the Status line to be parsed.
ParseException
- if there was an error parsingStatusLine
public static void setComputeContentLengthFromMessage(boolean computeContentLengthFromMessage)
public static void main(String[] args) throws ParseException
ParseException
|
NIST-SIP: The Reference Implementation for JAIN-SIP 1.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |