Package io.grpc.alts.internal
Class NettyTsiHandshaker
- java.lang.Object
-
- io.grpc.alts.internal.NettyTsiHandshaker
-
public final class NettyTsiHandshaker extends java.lang.Object
A wrapper for aTsiHandshaker
that accepts nettyByteBuf
s.
-
-
Field Summary
Fields Modifier and Type Field Description private TsiHandshaker
internalHandshaker
private BufUnwrapper
unwrapper
-
Constructor Summary
Constructors Constructor Description NettyTsiHandshaker(TsiHandshaker handshaker)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
close()
(package private) TsiFrameProtector
createFrameProtector(int maxFrameSize, io.netty.buffer.ByteBufAllocator alloc)
Creates a frame protector from a completed handshake.(package private) TsiFrameProtector
createFrameProtector(io.netty.buffer.ByteBufAllocator alloc)
Creates a frame protector from a completed handshake.(package private) TsiPeer
extractPeer()
Returns the peer extracted from a completed handshake.(package private) java.lang.Object
extractPeerObject()
Returns the peer extracted from a completed handshake.(package private) void
getBytesToSendToPeer(io.netty.buffer.ByteBuf out)
Gets data that is ready to be sent to the to the remote peer.(package private) boolean
isInProgress()
Returns true if and only if the handshake is still in progress.(package private) boolean
processBytesFromPeer(io.netty.buffer.ByteBuf data)
Process handshake data received from the remote peer.
-
-
-
Field Detail
-
unwrapper
private BufUnwrapper unwrapper
-
internalHandshaker
private final TsiHandshaker internalHandshaker
-
-
Constructor Detail
-
NettyTsiHandshaker
public NettyTsiHandshaker(TsiHandshaker handshaker)
-
-
Method Detail
-
getBytesToSendToPeer
void getBytesToSendToPeer(io.netty.buffer.ByteBuf out) throws java.security.GeneralSecurityException
Gets data that is ready to be sent to the to the remote peer. This should be called in a loop until no bytes are written to the output buffer.- Parameters:
out
- the buffer to receive the bytes.- Throws:
java.security.GeneralSecurityException
-
processBytesFromPeer
boolean processBytesFromPeer(io.netty.buffer.ByteBuf data) throws java.security.GeneralSecurityException
Process handshake data received from the remote peer.- Returns:
true
, if the handshake has all the data it needs to process andfalse
, if the method must be called again to complete processing.- Throws:
java.security.GeneralSecurityException
-
isInProgress
boolean isInProgress()
Returns true if and only if the handshake is still in progress.- Returns:
- true, if the handshake is still in progress, false otherwise.
-
extractPeer
TsiPeer extractPeer() throws java.security.GeneralSecurityException
Returns the peer extracted from a completed handshake.- Returns:
- the extracted peer.
- Throws:
java.security.GeneralSecurityException
-
extractPeerObject
java.lang.Object extractPeerObject() throws java.security.GeneralSecurityException
Returns the peer extracted from a completed handshake.- Returns:
- the extracted peer.
- Throws:
java.security.GeneralSecurityException
-
createFrameProtector
TsiFrameProtector createFrameProtector(int maxFrameSize, io.netty.buffer.ByteBufAllocator alloc)
Creates a frame protector from a completed handshake. No other methods may be called after the frame protector is created.- Parameters:
maxFrameSize
- the requested max frame size, the callee is free to ignore.- Returns:
- a new
TsiFrameProtector
.
-
createFrameProtector
TsiFrameProtector createFrameProtector(io.netty.buffer.ByteBufAllocator alloc)
Creates a frame protector from a completed handshake. No other methods may be called after the frame protector is created.- Returns:
- a new
TsiFrameProtector
.
-
close
void close()
-
-