public abstract class ConnectionOrientedMessageChannel extends MessageChannel implements SIPMessageListener, Runnable, RawMessageChannel
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
isCached |
protected boolean |
isRunning |
protected String |
key |
protected String |
myAddress |
protected InputStream |
myClientInputStream |
protected PipelinedMsgParser |
myParser |
protected int |
myPort |
protected Socket |
mySock |
protected Thread |
mythread |
protected InetAddress |
peerAddress |
protected String |
peerAddressAdvertisedInHeaders |
protected int |
peerPort |
protected int |
peerPortAdvertisedInHeaders |
protected String |
peerProtocol |
protected SIPTransactionStack |
sipStack |
messageProcessor, useCount| Constructor and Description |
|---|
ConnectionOrientedMessageChannel(SIPTransactionStack sipStack) |
| Modifier and Type | Method and Description |
|---|---|
void |
cancelPingKeepAliveTimeoutTaskIfStarted() |
void |
close()
Close the message channel.
|
protected abstract void |
close(boolean removeSocket,
boolean stopKeepAliveTask) |
long |
getKeepAliveTimeout() |
String |
getKey()
Get an identifying key.
|
String |
getPeerAddress()
get the address of the client that sent the data to us.
|
protected InetAddress |
getPeerInetAddress() |
InetAddress |
getPeerPacketSourceAddress() |
int |
getPeerPacketSourcePort() |
int |
getPeerPort()
Get the port of the peer to whom we are sending messages.
|
String |
getPeerProtocol() |
SIPTransactionStack |
getSIPStack()
Get my SIP Stack.
|
String |
getViaHost()
Get the host to assign to outgoing messages.
|
int |
getViaPort()
Get the port for outgoing messages sent from the channel.
|
boolean |
isReliable()
Returns "true" as this is a reliable transport.
|
void |
processMessage(SIPMessage sipMessage)
Gets invoked by the parser as a callback on successful message parsing
(i.e.
|
void |
processMessage(SIPMessage sipMessage,
InetAddress address) |
void |
rescheduleKeepAliveTimeout(long newKeepAliveTimeout) |
void |
run()
This gets invoked when thread.start is called from the constructor.
|
protected abstract void |
sendMessage(byte[] msg,
boolean b) |
void |
sendMessage(SIPMessage sipMessage)
Return a formatted message to the client.
|
void |
sendSingleCLRF() |
void |
setKeepAliveTimeout(long keepAliveTimeout) |
protected void |
uncache()
Hook method, overridden by subclasses
|
createBadReqRes, getEncapsulatedClientTransaction, getHost, getHostPort, getKey, getKey, getMessageProcessor, getPeerHostPort, getPort, getRawIpSourceAddress, getTransport, getViaHeader, getViaHostPort, isSecure, logMessage, logResponse, sendMessage, sendMessage, sendMessage, setEncapsulatedClientTransactionclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithandleExceptionprotected SIPTransactionStack sipStack
protected Socket mySock
protected PipelinedMsgParser myParser
protected String key
protected InputStream myClientInputStream
protected boolean isRunning
protected boolean isCached
protected Thread mythread
protected String myAddress
protected int myPort
protected InetAddress peerAddress
protected int peerPortAdvertisedInHeaders
protected String peerAddressAdvertisedInHeaders
protected int peerPort
protected String peerProtocol
public ConnectionOrientedMessageChannel(SIPTransactionStack sipStack)
public boolean isReliable()
isReliable in class MessageChannelpublic void close()
close in class MessageChannelprotected abstract void close(boolean removeSocket,
boolean stopKeepAliveTask)
public SIPTransactionStack getSIPStack()
getSIPStack in class MessageChannelpublic String getPeerAddress()
getPeerAddress in class MessageChannelprotected InetAddress getPeerInetAddress()
getPeerInetAddress in class MessageChannelpublic String getPeerProtocol()
getPeerProtocol in class MessageChannelpublic void sendMessage(SIPMessage sipMessage) throws IOException
sendMessage in class MessageChannelsipMessage - Message to send.IOException - If there is an error sending the messageprotected abstract void sendMessage(byte[] msg,
boolean b)
throws IOException
IOExceptionpublic void processMessage(SIPMessage sipMessage, InetAddress address)
public void processMessage(SIPMessage sipMessage) throws Exception
processMessage in interface SIPMessageListenerprocessMessage in interface RawMessageChannelsipMessage - Message to process (this calls the application for processing
the message).
Jvb: note that this code is identical to TCPMessageChannel,
refactor some dayExceptionfor the method that gets called
on parse exception.public void run()
protected void uncache()
MessageChanneluncache in class MessageChannelpublic String getKey()
getKey in class MessageChannelpublic String getViaHost()
getViaHost in class MessageChannelpublic int getViaPort()
getViaPort in class MessageChannelpublic int getPeerPort()
getPeerPort in class MessageChannelpublic int getPeerPacketSourcePort()
getPeerPacketSourcePort in class MessageChannelpublic InetAddress getPeerPacketSourceAddress()
getPeerPacketSourceAddress in class MessageChannelpublic void sendSingleCLRF()
throws Exception
sendSingleCLRF in interface SIPMessageListenerExceptionpublic void cancelPingKeepAliveTimeoutTaskIfStarted()
public void setKeepAliveTimeout(long keepAliveTimeout)
public long getKeepAliveTimeout()
public void rescheduleKeepAliveTimeout(long newKeepAliveTimeout)
Copyright © 2014. All Rights Reserved.