All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class RouterLayer.Router.RegistrarSecurity

Abstract.Security
   |
   +----RouterLayer.Router.RegistrarSecurity

public class RegistrarSecurity
extends Security
Secure the connection. Check whether the register protocol is satisfied. Since there's no register protocol upon which all the agent communities agree, we are just suggesting the protocol,which is neither sufficient nor theoretically correct. We hope this problem to be resolved in the near future. This is our current register protocol messages
At first, upon request, Router will accept() and request identification to the connected agent using 'identify-self' performative. Then, the client will send its identification using 'whoiam'. If the 'whoiam' information is acceptable, the Router will send the 'accepted' message to the client. If not, the Router will disconnect the connection. For example:

See Also:
RegistrarRecvThread

Constructor Index

 o RegistrarSecurity()
Default constructor
 o RegistrarSecurity(RouterSecurity)
Constructor The RouterSecurity is passed as an argument to update the user list after registration is successful.

Method Index

 o denyConnection(ReceiverThread, String)
Error occurs from the connection process.
 o isValidAgent(Object)
Check the user is valid
 o processClientLogin(ReceiverThread, Address)
Opposite to the processServerLogin.
 o processClientLogout(ReceiverThread)
Registrar does not send out disconnect message
 o processErrorLogin(int, ReceiverThread, String)
According to the error condition, the processErrorLogin will be performed.
 o processServerLogin(ReceiverThread)
Security check process from the RegistrarServerThread.
 o registerAgent(String, String, String, String, String, String)
Register the agent to the agent list.
 o secureAgent(String, String)
Check the client send its name and the name is different from mine
 o startConnection(ReceiverThread, String, String)
Start conneciton.
 o SystemOut(String)
If you use GUI, override this method

Constructors

 o RegistrarSecurity
 public RegistrarSecurity()
Default constructor

 o RegistrarSecurity
 public RegistrarSecurity(RouterSecurity security)
Constructor The RouterSecurity is passed as an argument to update the user list after registration is successful.

Parameters:
security - Main Router security

Methods

 o processServerLogin
 public void processServerLogin(ReceiverThread con)
Security check process from the RegistrarServerThread. The connection is accepted and the security check is performed using this method. For error condition, the connection may be denied after sending error message.

For both registration and connection, the lowest level connection protocol is:
Router : 201 AMR "Router name"
or Router : 500 Internal Error
for any error conditions.

Then, the Agent will request register by sending "register-agent" protocol.
For example,
Agent : (register-agent :sender agent :receiver RouterRegistrar :password xxxxxx)
Router : (identify-self :sender RouterRegistrar :receiver agent)
Agent : (whoiam :sender agent :receiver RouterRegistrar :message-method AMR :KQML-extensions http://java.stanford.edu/myprotocol :description (advertize DesignAgent) :content (contact-information :host www.sun.com :port 1234 :email aaa@sun.com))
Router : (register-accepted :sender RouterRegistrar :receiver agent)>BR> The router will disconnect the connection just after the registration process is finished. The agent use "reconnect-agent" protocol to connect the agent, afterwards. For more information for the protocol, refer to processServerLogin in class Security

 o processErrorLogin
 protected boolean processErrorLogin(int errorCode,
                                     ReceiverThread con,
                                     String myid)
According to the error condition, the processErrorLogin will be performed. If the agent name is missing or if the agent name is the same as the Router name or if the password is missing(when passwordCheckBit is true) or if the password is mismatch(when passwordCheckBit is true), the Registrar will send 'error' message to the agent and will close the connection

Parameters:
errorCode - Error code which happens during connection process
con - ReceiverRecvThread, which wants to be connected
myid - The Router name
 o startConnection
 protected void startConnection(ReceiverThread con,
                                String agentid,
                                String myid)
Start conneciton. This does not mean that the connection will be established. After register, the agent should reconnect to the Router. This method will send 'register-accepted' message to the client and will be kill the RegistrarRecvThread

Parameters:
con - ReceiverThread to be started
agentid - The agent name
myid - The Router registrar name
 o denyConnection
 protected void denyConnection(ReceiverThread con,
                               String id)
Error occurs from the connection process. Send 'error' message to the agent and disconnect the conneciton

Parameters:
con - ReceiverThread to be disconnected
id - The RouterRegistrar name
 o secureAgent
 protected int secureAgent(String me,
                           String client)
Check the client send its name and the name is different from mine

Parameters:
me - My name, sent back from the client
client - The agent name
 o processClientLogin
 public void processClientLogin(ReceiverThread c,
                                Address serveraddress) throws ConnectionException
Opposite to the processServerLogin. The agent(me) wants to connect to the Router and it will send 'whoiam' message to the Router

Parameters:
c - ReceiverThread, which will connect to the Router
serveraddress - The Rotuer server address
Overrides:
processClientLogin in class Security
 o processClientLogout
 public void processClientLogout(ReceiverThread c)
Registrar does not send out disconnect message

Parameters:
c - RouterRecvThread to be disconnected
Overrides:
processClientLogout in class Security
 o registerAgent
 public int registerAgent(String id,
                          String host,
                          String port,
                          String type,
                          String description,
                          String password)
Register the agent to the agent list. The address table will be updated

Parameters:
id - Agent name
host - Internet host name
port - Port number
type - Message method
description - Agent description
password - Password for the agent to be checked afterwards
 o isValidAgent
 public boolean isValidAgent(Object o)
Check the user is valid

Parameters:
o - String argument, agent name and password
Returns:
True if the agent is valid
Overrides:
isValidAgent in class Security
 o SystemOut
 public void SystemOut(String str)
If you use GUI, override this method

Parameters:
str - String which will be displayed to the GUI or System.out

All Packages  Class Hierarchy  This Package  Previous  Next  Index