local.server
Class ServerEngine

java.lang.Object
  |
  +--local.server.ServerEngine
All Implemented Interfaces:
org.zoolu.sip.provider.SipProviderListener
Direct Known Subclasses:
Registrar

public abstract class ServerEngine
extends java.lang.Object
implements org.zoolu.sip.provider.SipProviderListener

Class ServerEngine implement a stateless abstract SIP Server. The ServerEngine can act as SIP Proxy Server, SIP Registrar Server or both.

For each incoming message, the ServerEngine fires one of the following abstract methods:

depending of the type of received message.


Field Summary
protected  org.zoolu.tools.Log log
          Event logger.
protected static java.lang.String Loop_Tag
          Name of the Loop-Tag header field.
protected  ServerProfile server_profile
          ServerProfile of the server.
protected  org.zoolu.sip.provider.SipProvider sip_provider
          SipProvider used by the server.
 
Constructor Summary
protected ServerEngine()
          Costructs a void ServerEngine
  ServerEngine(org.zoolu.sip.provider.SipProvider provider, ServerProfile profile)
          Costructs a new ServerEngine on SipProvider provider, and adds it as SipProviderListener.
 
Method Summary
protected  java.lang.String getLocalDomains()
          Gets a String of the list of local domain names.
protected  boolean isResponsibleFor(org.zoolu.sip.message.Message req)
          Whether the server is responsible for the request-uri of the request req.
protected  boolean isResponsibleFor(java.lang.String domain, int port)
          Whether the server is responsible for the given domain (i.e. the domain is included in the local domain names list) and port (if >0) matches the local server port.
 void onReceivedMessage(org.zoolu.sip.provider.SipProvider provider, org.zoolu.sip.message.Message msg)
          When a new message is received by the SipProvider.
abstract  void processRequestToLocalServer(org.zoolu.sip.message.Message req)
          When a new request request is received for the local server
abstract  void processRequestToLocalUser(org.zoolu.sip.message.Message req)
          When a new request message is received for a locally registered user
abstract  void processRequestToRemoteUA(org.zoolu.sip.message.Message req)
          When a new request message is received for a remote UA
abstract  void processResponse(org.zoolu.sip.message.Message resp)
          When a new response message is received
protected  org.zoolu.sip.message.Message validateRequest(org.zoolu.sip.message.Message msg)
          Validates the message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Loop_Tag

protected static final java.lang.String Loop_Tag
Name of the Loop-Tag header field. It is used as temporary filed for carry loop detection information, added to the via branch parameter of the forwarded requests.

log

protected org.zoolu.tools.Log log
Event logger.

server_profile

protected ServerProfile server_profile
ServerProfile of the server.

sip_provider

protected org.zoolu.sip.provider.SipProvider sip_provider
SipProvider used by the server.
Constructor Detail

ServerEngine

protected ServerEngine()
Costructs a void ServerEngine

ServerEngine

public ServerEngine(org.zoolu.sip.provider.SipProvider provider,
                    ServerProfile profile)
Costructs a new ServerEngine on SipProvider provider, and adds it as SipProviderListener.
Method Detail

processRequestToRemoteUA

public abstract void processRequestToRemoteUA(org.zoolu.sip.message.Message req)
When a new request message is received for a remote UA

processRequestToLocalUser

public abstract void processRequestToLocalUser(org.zoolu.sip.message.Message req)
When a new request message is received for a locally registered user

processRequestToLocalServer

public abstract void processRequestToLocalServer(org.zoolu.sip.message.Message req)
When a new request request is received for the local server

processResponse

public abstract void processResponse(org.zoolu.sip.message.Message resp)
When a new response message is received

onReceivedMessage

public void onReceivedMessage(org.zoolu.sip.provider.SipProvider provider,
                              org.zoolu.sip.message.Message msg)
When a new message is received by the SipProvider. If the received message is a request, it cheks for loops,
Specified by:
onReceivedMessage in interface org.zoolu.sip.provider.SipProviderListener

isResponsibleFor

protected boolean isResponsibleFor(java.lang.String domain,
                                   int port)
Whether the server is responsible for the given domain (i.e. the domain is included in the local domain names list) and port (if >0) matches the local server port.

isResponsibleFor

protected boolean isResponsibleFor(org.zoolu.sip.message.Message req)
Whether the server is responsible for the request-uri of the request req.

getLocalDomains

protected java.lang.String getLocalDomains()
Gets a String of the list of local domain names.

validateRequest

protected org.zoolu.sip.message.Message validateRequest(org.zoolu.sip.message.Message msg)
Validates the message.
Returns:
It returns 0 if the message validation successes, otherwise return the error code.