|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface SshMessage
This interface provides a callback for writing SSH messages into the outgoing
buffer. When a message is to be sent you should call
TransportProtocol.sendMessage(SshMessage) with an implementation of
this interface. When the socket is ready for writing and your message is the
next available in the outgoing queue your implementation of
writeMessageIntoBuffer(ByteBuffer) will be called. You should write
the SSH message into the ByteBuffer and return. When the message has been
written out to the socket messageSent() will be called.
The following code demonstrates how the interface is used by the transport
protocol to send the SSH_MSG_NEWKEYS.
sendMessage(new SshMessage() {
public void writeMessageIntoBuffer(ByteBuffer buf) {
buf.put((byte) TransportProtocol.SSH_MSG_NEWKEYS);
}
public void messageSent() {
// Potentially we could generate the keys if we have received SSH_MSG_NEWKEYS
synchronized (keyExchange) {
EventLog.LogEvent(this,"Sent SSH_MSG_NEWKEYS");
keyExchange.sentNewKeys = true;
generateNewKeys();
}
}
});
For most server implementations it will not be required to implement this interface. It is essentially for internal use but may be used if you develop a custom authentication mechanism that requires additional messages to be sent to the client
| Method Summary | |
|---|---|
void |
messageSent()
|
boolean |
writeMessageIntoBuffer(java.nio.ByteBuffer buf)
Write the SSH message data into a ByteBuffer. |
| Method Detail |
|---|
boolean writeMessageIntoBuffer(java.nio.ByteBuffer buf)
buf -
void messageSent()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||