Package org.apache.sshd.common.io
Interface PacketWriter
-
- All Superinterfaces:
java.lang.AutoCloseable
,java.nio.channels.Channel
,java.io.Closeable
- All Known Subinterfaces:
Channel
,ClientChannel
,ClientSession
,IoOutputStream
,IoSession
,ServerChannel
,ServerSession
,Session
- All Known Implementing Classes:
AbstractChannel
,AbstractClientChannel
,AbstractClientSession
,AbstractServerChannel
,AbstractServerSession
,AbstractSession
,AgentForwardedChannel
,BufferedIoOutputStream
,ChannelAgentForwarding
,ChannelAsyncOutputStream
,ChannelDirectTcpip
,ChannelExec
,ChannelForwardedX11
,ChannelSession
,ChannelSession
,ChannelShell
,ChannelSubsystem
,ClientSessionImpl
,Nio2Session
,PtyCapableChannelSession
,ServerSessionImpl
,SessionHelper
,TcpipClientChannel
,TcpipServerChannel
public interface PacketWriter extends java.nio.channels.Channel
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static int
calculatePadLength(int len, int blockSize, boolean etmMode)
IoWriteFuture
writePacket(Buffer buffer)
Encode and send the given buffer.
-
-
-
Method Detail
-
writePacket
IoWriteFuture writePacket(Buffer buffer) throws java.io.IOException
Encode and send the given buffer. Note: for session packets the buffer has to have 5 bytes free at the beginning to allow the encoding to take place. Also, the write position of the buffer has to be set to the position of the last byte to write.- Parameters:
buffer
- the buffer to encode and send. NOTE: the buffer must not be touched until the returned write future is completed.- Returns:
- An
IoWriteFuture
that can be used to check when the packet has actually been sent - Throws:
java.io.IOException
- if an error occurred when encoding sending the packet
-
calculatePadLength
static int calculatePadLength(int len, int blockSize, boolean etmMode)
- Parameters:
len
- The packet payload sizeblockSize
- The cipher block sizeetmMode
- Whether using "encrypt-then-MAC" mode- Returns:
- The required padding length
-
-