| java.lang.Object gov.nist.siplite.stack.MessageChannel gov.nist.siplite.stack.UDPMessageChannel
UDPMessageChannel | public class UDPMessageChannel extends MessageChannel implements ParseExceptionListener,Runnable(Code) | | This is the UDP Message handler that gets created when a UDP message
needs to be processed. The message is processed by creating a String
Message parser and invoking it on the message read from the UPD socket.
The parsed structure is handed off via a SIP stack request for further
processing. This stack structure isolates the message handling logic
from the mechanics of sending and recieving messages (which could
be either udp or tcp.
Acknowledgement:
Kim Kirby of Keyvoice suggested that duplicate checking should be added
to the stack.
See Also: gov.nist.siplite.parser.StringMsgParser See Also: gov.nist.siplite.stack.SIPServerRequestInterface since: v1.0 |
Method Summary | |
public void | close() Closes the message channel. | public boolean | equals(Object other) Compares two UDP Message channels for equality.
Parameters: other - The other message channel with which to compare oursleves. | public String | getHost() Gets the stack address for the stack that received this message. | public String | getKey() Gets the key. | public String | getPeerAddress() Gets the peer address of the machine that sent us this message. | public int | getPeerPort() Gets the sender port (the port of the other end that sent me
the message). | public int | getPort() Gets the port. | public SIPMessageStack | getSIPStack() Gets the stack pointer. | public String | getTransport() Returns a transport string. | public String | getViaHost() Gets the logical originator of the message (from the top via header). | public int | getViaPort() Gets the logical port of the message orginator (from the top via hdr). | public void | handleException(SIPServerException ex) Handles an exception - construct a sip reply and send it back to the
caller. | public void | handleException(ParseException ex, Message sipMessage, Class hdrClass, String headerText, String messageText) This gets called from the parser when a parse error is generated.
The handler is supposed to introspect on the error class and
header name to handle the error appropriately. | public boolean | isReliable() | public boolean | isSecure() Returns true if this is a secure channel. | public void | run() Runs method specified by runnnable. | public void | sendMessage(Message sipMessage) Returns a reply from a pre-constructed reply. | protected void | sendMessage(byte[] msg, String receiverAddress, int receiverPort) Sends a message to a specified receiver address. | protected void | sendMessage(byte[] msg, String receiverAddress, int receiverPort, String receiverProtocol) Sends a message to a specified receiver address. |
duplicates | protected static Hashtable duplicates(Code) | | Pool of duplicate messages.
|
UDPMessageChannel | public UDPMessageChannel(Datagram packet, SIPMessageStack sipStack, MessageProcessor messageProcessor)(Code) | | Constructor - takes a datagram packet and a stack structure
Extracts the address of the other from the datagram packet and
stashes away the pointer to the passed stack structure.
Parameters: packet - is the UDP Packet that contains the request. Parameters: sipStack - stack is the shared SipStack structure Parameters: messageProcessor - the UDP input message channel |
UDPMessageChannel | public UDPMessageChannel(String targetAddr, int port, SIPMessageStack sipStack, UDPMessageProcessor processor)(Code) | | Constructor. We create one of these when we send out a message.
Parameters: targetAddr - internet address of the place where we want to sendmessages. Parameters: port - target port (where we want to send the message). Parameters: sipStack - our SIP Stack. Parameters: processor - inbound message processor |
close | public void close()(Code) | | Closes the message channel.
|
equals | public boolean equals(Object other)(Code) | | Compares two UDP Message channels for equality.
Parameters: other - The other message channel with which to compare oursleves. true if the objects match |
getHost | public String getHost()(Code) | | Gets the stack address for the stack that received this message.
The stack address for our stack. |
getPeerAddress | public String getPeerAddress()(Code) | | Gets the peer address of the machine that sent us this message.
a string contianing the ip address or host name of the senderof the message. |
getPeerPort | public int getPeerPort()(Code) | | Gets the sender port (the port of the other end that sent me
the message).
the remote port number |
getPort | public int getPort()(Code) | | Gets the port.
Our port (on which we are getting datagrampackets). |
getSIPStack | public SIPMessageStack getSIPStack()(Code) | | Gets the stack pointer.
The sip stack for this channel. |
getTransport | public String getTransport()(Code) | | Returns a transport string.
the string "udp" in this case. |
getViaHost | public String getViaHost()(Code) | | Gets the logical originator of the message (from the top via header).
topmost via header sentby field |
getViaPort | public int getViaPort()(Code) | | Gets the logical port of the message orginator (from the top via hdr).
the via port from the topmost via header. |
handleException | public void handleException(SIPServerException ex)(Code) | | Handles an exception - construct a sip reply and send it back to the
caller.
Parameters: ex - The exception thrown at us by ourapplication. |
handleException | public void handleException(ParseException ex, Message sipMessage, Class hdrClass, String headerText, String messageText) throws ParseException(Code) | | This gets called from the parser when a parse error is generated.
The handler is supposed to introspect on the error class and
header name to handle the error appropriately. The error can
be handled by :
- 1. Re-throwing an exception and aborting the parse.
- 2. Ignoring the header (attach the unparseable header to
the Message being parsed).
- 3. Re-Parsing the bad header and adding it to the sipMessage
Parameters: ex - parse exception being processed. Parameters: sipMessage - sip message being processed. Parameters: hdrClass - header parsing class Parameters: headerText - header/RL/SL text being parsed. Parameters: messageText - message where this header was detected. |
isReliable | public boolean isReliable()(Code) | | Checks if the transport is reliable
always false |
isSecure | public boolean isSecure()(Code) | | Returns true if this is a secure channel.
always false |
run | public void run()(Code) | | Runs method specified by runnnable.
|
sendMessage | public void sendMessage(Message sipMessage) throws IOException(Code) | | Returns a reply from a pre-constructed reply. This sends the message
back to the entity who caused us to create this channel in the
first place.
Parameters: sipMessage - Message string to send. throws: IOException - If there is a problem with sending themessage. |
sendMessage | protected void sendMessage(byte[] msg, String receiverAddress, int receiverPort) throws IOException(Code) | | Sends a message to a specified receiver address.
Parameters: msg - message string to send. Parameters: receiverAddress - Address of the place to send it to. Parameters: receiverPort - the port to send it to. throws: IOException - If there is trouble sending this message. |
sendMessage | protected void sendMessage(byte[] msg, String receiverAddress, int receiverPort, String receiverProtocol) throws IOException(Code) | | Sends a message to a specified receiver address.
Parameters: msg - message string to send. Parameters: receiverAddress - Address of the place to send it to. Parameters: receiverPort - the port to send it to. Parameters: receiverProtocol - protocol to use to send. throws: IOException - If there is trouble sending this message. |
Methods inherited from gov.nist.siplite.stack.MessageChannel | abstract public void close()(Code)(Java Doc) public String getHost()(Code)(Java Doc) public HostPort getHostPort()(Code)(Java Doc) abstract public String getKey()(Code)(Java Doc) public static String getKey(String inetAddr, int port, String transport)(Code)(Java Doc) public MessageProcessor getMessageProcessor()(Code)(Java Doc) abstract public String getPeerAddress()(Code)(Java Doc) public HostPort getPeerHostPort()(Code)(Java Doc) abstract public int getPeerPort()(Code)(Java Doc) public int getPort()(Code)(Java Doc) abstract public SIPMessageStack getSIPStack()(Code)(Java Doc) abstract public String getTransport()(Code)(Java Doc) public ViaHeader getViaHeader()(Code)(Java Doc) abstract public String getViaHost()(Code)(Java Doc) public HostPort getViaHostPort()(Code)(Java Doc) abstract public int getViaPort()(Code)(Java Doc) abstract public void handleException(SIPServerException ex)(Code)(Java Doc) abstract public boolean isReliable()(Code)(Java Doc) abstract public boolean isSecure()(Code)(Java Doc) protected void logMessage(Message sipMessage, String address, int port, long time)(Code)(Java Doc) public void logResponse(Response sipResponse, long receptionTime, String status)(Code)(Java Doc) abstract public void sendMessage(Message sipMessage) throws IOException(Code)(Java Doc) abstract protected void sendMessage(byte[] message, String receiverAddress, int receiverPort) throws IOException(Code)(Java Doc) public void sendMessage(Message sipMessage, String receiverAddress, int receiverPort) throws IOException(Code)(Java Doc)
|
|
|