Openfire 3.9.3 Javadoc

org.jivesoftware.openfire.session
Class LocalOutgoingServerSession

java.lang.Object
  extended by org.jivesoftware.openfire.session.LocalSession
      extended by org.jivesoftware.openfire.session.LocalOutgoingServerSession
All Implemented Interfaces:
ChannelHandler, RoutableChannelHandler, OutgoingServerSession, Session

public class LocalOutgoingServerSession
extends LocalSession
implements OutgoingServerSession

Server-to-server communication is done using two TCP connections between the servers. One connection is used for sending packets while the other connection is used for receiving packets. The OutgoingServerSession represents the connection to a remote server that will only be used for sending packets.

Currently only the Server Dialback method is being used for authenticating with the remote server. Use authenticateDomain(String, String) to create a new connection to a remote server that will be used for sending packets to the remote server from the specified domain. Only the authenticated domains with the remote server will be able to effectively send packets to the remote server. The remote server will reject and close the connection if a non-authenticated domain tries to send a packet through this connection.

Once the connection has been established with the remote server and at least a domain has been authenticated then a new route will be added to the routing table for this connection. For optimization reasons the same outgoing connection will be used even if the remote server has several hostnames. However, different routes will be created in the routing table for each hostname of the remote server.

Author:
Gaston Dombiak

Field Summary
 
Fields inherited from class org.jivesoftware.openfire.session.LocalSession
CHARSET, conn, sessionManager, status
 
Fields inherited from interface org.jivesoftware.openfire.session.Session
MAJOR_VERSION, MINOR_VERSION, STATUS_AUTHENTICATED, STATUS_CLOSED, STATUS_CONNECTED
 
Constructor Summary
LocalOutgoingServerSession(String serverName, Connection connection, OutgoingServerSocketReader socketReader, StreamID streamID)
           
 
Method Summary
 void addAuthenticatedDomain(String domain)
          Adds a new authenticated domain, subdomain or virtual host to the list of authenticated domains for the remote server.
 void addHostname(String hostname)
          Adds a new hostname to the list of known hostnames of the remote server.
static boolean authenticateDomain(String domain, String hostname)
          Creates a new outgoing connection to the specified hostname if no one exists.
 boolean authenticateSubdomain(String domain, String hostname)
          Authenticates a subdomain of this server with the specified remote server over an exsiting outgoing connection.
 Collection<String> getAuthenticatedDomains()
          Returns a collection with all the domains, subdomains and virtual hosts that where authenticated.
 String getAvailableStreamFeatures()
          Returns a text with the available stream features.
 Collection<String> getHostnames()
          Returns the list of hostnames related to the remote server.
 boolean isUsingServerDialback()
          Returns true if this outgoing session was established using server dialback.
 
Methods inherited from class org.jivesoftware.openfire.session.LocalSession
close, decodeVersion, deliverRawText, getAddress, getConnection, getCreationDate, getHostAddress, getHostName, getLastActiveDate, getNumClientPackets, getNumServerPackets, getServerName, getSessionData, getStatus, getStreamID, incrementClientPacketCount, incrementServerPacketCount, isClosed, isSecure, isUsingSelfSignedCertificate, process, removeSessionData, setAddress, setSessionData, setStatus, toString, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jivesoftware.openfire.session.Session
close, deliverRawText, getAddress, getCreationDate, getHostAddress, getHostName, getLastActiveDate, getNumClientPackets, getNumServerPackets, getServerName, getStatus, getStreamID, isClosed, isSecure, process, validate
 

Constructor Detail

LocalOutgoingServerSession

public LocalOutgoingServerSession(String serverName,
                                  Connection connection,
                                  OutgoingServerSocketReader socketReader,
                                  StreamID streamID)
Method Detail

authenticateDomain

public static boolean authenticateDomain(String domain,
                                         String hostname)
Creates a new outgoing connection to the specified hostname if no one exists. The port of the remote server could be configured by setting the xmpp.server.socket.remotePort property or otherwise the standard port 5269 will be used. Either a new connection was created or already existed the specified hostname will be authenticated with the remote server. Once authenticated the remote server will start accepting packets from the specified domain.

The Server Dialback method is currently the only implemented method for server-to-server authentication. This implies that the remote server will ask the Authoritative Server to verify the domain to authenticate. Most probably this (local) server will act as the Authoritative Server. See IncomingServerSession for more information.

Parameters:
domain - the local domain to authenticate with the remote server.
hostname - the hostname of the remote server.
Returns:
True if the domain was authenticated by the remote server.

authenticateSubdomain

public boolean authenticateSubdomain(String domain,
                                     String hostname)
Description copied from interface: OutgoingServerSession
Authenticates a subdomain of this server with the specified remote server over an exsiting outgoing connection. If the existing session was using server dialback then a new db:result is going to be sent to the remote server. But if the existing session was TLS+SASL based then just assume that the subdomain was authenticated by the remote server.

Specified by:
authenticateSubdomain in interface OutgoingServerSession
Parameters:
domain - the local subdomain to authenticate with the remote server.
hostname - the hostname of the remote server.
Returns:
True if the subdomain was authenticated by the remote server.

getAuthenticatedDomains

public Collection<String> getAuthenticatedDomains()
Description copied from interface: OutgoingServerSession
Returns a collection with all the domains, subdomains and virtual hosts that where authenticated. The remote server will accept packets sent from any of these domains, subdomains and virtual hosts.

Specified by:
getAuthenticatedDomains in interface OutgoingServerSession
Returns:
domains, subdomains and virtual hosts that where validated.

addAuthenticatedDomain

public void addAuthenticatedDomain(String domain)
Description copied from interface: OutgoingServerSession
Adds a new authenticated domain, subdomain or virtual host to the list of authenticated domains for the remote server. The remote server will accept packets sent from this new authenticated domain.

Specified by:
addAuthenticatedDomain in interface OutgoingServerSession
Parameters:
domain - the new authenticated domain, subdomain or virtual host to add.

getHostnames

public Collection<String> getHostnames()
Description copied from interface: OutgoingServerSession
Returns the list of hostnames related to the remote server. This tracking is useful for reusing the same session for the same remote server even if the server has many names.

Specified by:
getHostnames in interface OutgoingServerSession
Returns:
the list of hostnames related to the remote server.

addHostname

public void addHostname(String hostname)
Description copied from interface: OutgoingServerSession
Adds a new hostname to the list of known hostnames of the remote server. This tracking is useful for reusing the same session for the same remote server even if the server has many names.

Specified by:
addHostname in interface OutgoingServerSession
Parameters:
hostname - the new known name of the remote server

getAvailableStreamFeatures

public String getAvailableStreamFeatures()
Description copied from class: LocalSession
Returns a text with the available stream features. Each subclass may return different values depending whether the session has been authenticated or not.

Specified by:
getAvailableStreamFeatures in class LocalSession
Returns:
a text with the available stream features or null to add nothing.

isUsingServerDialback

public boolean isUsingServerDialback()
Description copied from interface: OutgoingServerSession
Returns true if this outgoing session was established using server dialback.

Specified by:
isUsingServerDialback in interface OutgoingServerSession
Returns:
true if this outgoing session was established using server dialback.

Openfire 3.9.3 Javadoc

Copyright © 2003-2008 Jive Software.