All Packages Class Hierarchy This Package Previous Next Index
Class KQMLLayer.KQMLSecurity
Abstract.Security
|
+----KQMLLayer.KQMLSecurity
- public class KQMLSecurity
- extends Security
Secure the connection. Check whether the register,unregister protocol
is satisfied. No password check will be performed. You can extend Security
class to perform more complex security check include password check.
Typical process for the KQML agents' protocol is :
At first, upon request, ServerSocket(BServerThread) will accept()
and introduce itself. Then, the client will receive the introduction and
send the client's introduction. If the message is legal, the Security
will send accepted message.
- Server send message to the client
(connected :sender server :receiver client :host java.stanford.edu
:port 1234 :type BServerThread :description (Example test))
- Client will response
(register :sender client :receiver server :host aaa.ggg.com
:port 4321 :type BRecvThread :description (Client test))
- Server will send message
- (accepted :sender server :receiver client)
The address table for this class should be defined. When you construct
your agent, the address table should be created before construct
the KQMLSecurity object.To pass address table for the KQMLSecurity
constructor is preferable not to forget set address table to the
KQMLSecurity object.
-
KQMLSecurity()
- Default constructor
-
KQMLSecurity(AddressTable)
- Constructor with AddressTable
-
denyConnection(ReceiverThread, String)
- Deny connection since error.
-
isValidAgent(Object)
- No checking on the validity, user name check
-
processClientLogin(ReceiverThread, Address)
- Opposite to the processServerLogin.
-
processClientLogout(ReceiverThread)
- Send disconnect message to the BRecvThread for some reasons such as
timeout, or reboot the Server,etc.
-
processErrorLogin(int, ReceiverThread, String)
- Process error state.
-
processServerLogin(ReceiverThread)
- Override processServerLogin since KMQL use different register process
By request, server will kindly introduce itself.
-
secureAgent(String, String)
- Check the client send its name and the name is different from mine
No password check.
-
startConnection(ReceiverThread, String, String)
- Start connection.
KQMLSecurity
public KQMLSecurity()
- Default constructor
KQMLSecurity
public KQMLSecurity(AddressTable addresses)
- Constructor with AddressTable
- Parameters:
- addresses - AddressTable , which will be maintained by this.
processServerLogin
public void processServerLogin(ReceiverThread con)
- Override processServerLogin since KMQL use different register process
By request, server will kindly introduce itself. Then wait for the
client introduction. If it matches the protocol, receiver thread
will be started. If the first message from client has not 'register'
performative, accession will be denied. If the first message's content
does not satisfy the security check, this method will give a chance
to the client to correct. If the corrected response is still wrong,
access will be denied. No password cross-check will be performed.
- Parameters:
- con - BRecvThread, will be started
- Overrides:
- processServerLogin in class Security
processErrorLogin
protected boolean processErrorLogin(int errorCode,
ReceiverThread con,
String myid)
- Process error state. If the error is CLIENTNAMEMISSING or CLIENTSAMENAME, it will
give one more chance to get the response from the end connection. If still fails
it will close the connection and kill the ReceiverThread
- Parameters:
- errorCode - error code
- con - ReceiverThread, which is checked
- myid - My name in agent society
startConnection
protected void startConnection(ReceiverThread con,
String agentid,
String myid) throws ConnectionException
- Start connection. All protocol is satisfied. Add the ReceiverThread to the
ConnectionTable
- Parameters:
- con - ReceiverThread, to be checked
- agentid - Other agent name
- myid - My name
- Throws: ConnectionException
- If write a message to the connection fails
denyConnection
protected void denyConnection(ReceiverThread con,
String id) throws ConnectionException
- Deny connection since error. Send error message and disconnect
- Parameters:
- con - ReceiverThread, to be killed
- id - Other agent name
- Throws: ConnectionException
- If write a message to the connection fails
secureAgent
protected int secureAgent(String me,
String client)
- Check the client send its name and the name is different from mine
No password check.
- Parameters:
- me - My name, sent back from the client
- client - Client agent name
processClientLogin
public void processClientLogin(ReceiverThread c,
Address serveraddress) throws ConnectionException
- Opposite to the processServerLogin. Connection should be added to the
connection table, by caller. The KQMLTCPRecvThread generator should
specify the Server name and Password. The description
- Parameters:
- c - BRecvThread, which will connect to the other server
- serveraddress - Server address to whom I want to connect
- Overrides:
- processClientLogin in class Security
processClientLogout
public void processClientLogout(ReceiverThread c)
- Send disconnect message to the BRecvThread for some reasons such as
timeout, or reboot the Server,etc. This method will be invoked by
BRecvThread or AgentAction. The processClientLogin does not kill the ReceiverThread
- Parameters:
- c - BRecvThread to be disconnected
- Overrides:
- processClientLogout in class Security
isValidAgent
public boolean isValidAgent(Object o)
- No checking on the validity, user name check
- Overrides:
- isValidAgent in class Security
All Packages Class Hierarchy This Package Previous Next Index