Class TsiHandshakeHandler

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.handler.codec.ByteToMessageDecoder
io.grpc.alts.internal.TsiHandshakeHandler
All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler

public final class TsiHandshakeHandler extends io.netty.handler.codec.ByteToMessageDecoder
Performs The TSI Handshake.
  • Field Details

    • HANDSHAKE_FRAME_SIZE

      private static final int HANDSHAKE_FRAME_SIZE
      See Also:
    • handshaker

      private final NettyTsiHandshaker handshaker
    • handshakeValidator

      private final TsiHandshakeHandler.HandshakeValidator handshakeValidator
    • next

      private final io.netty.channel.ChannelHandler next
    • semaphore

      private final AsyncSemaphore semaphore
    • pne

      private io.grpc.netty.ProtocolNegotiationEvent pne
    • semaphoreAcquired

      private boolean semaphoreAcquired
    • negotiationLogger

      private final io.grpc.ChannelLogger negotiationLogger
  • Constructor Details

    • TsiHandshakeHandler

      public TsiHandshakeHandler(io.netty.channel.ChannelHandler next, NettyTsiHandshaker handshaker, TsiHandshakeHandler.HandshakeValidator handshakeValidator, io.grpc.ChannelLogger negotiationLogger)
      Constructs a TsiHandshakeHandler.
    • TsiHandshakeHandler

      public TsiHandshakeHandler(io.netty.channel.ChannelHandler next, NettyTsiHandshaker handshaker, TsiHandshakeHandler.HandshakeValidator handshakeValidator, AsyncSemaphore semaphore, io.grpc.ChannelLogger negotiationLogger)
      Constructs a TsHandshakeHandler. If a semaphore is provided, a permit from the semaphore is required to start the handshake and is returned when the handshake ends.
  • Method Details

    • decodeLast

      protected void decodeLast(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf in, List<Object> out) throws Exception
      Overrides:
      decodeLast in class io.netty.handler.codec.ByteToMessageDecoder
      Throws:
      Exception
    • decode

      protected void decode(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf in, List<Object> out) throws Exception
      Specified by:
      decode in class io.netty.handler.codec.ByteToMessageDecoder
      Throws:
      Exception
    • userEventTriggered

      public void userEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt) throws Exception
      Specified by:
      userEventTriggered in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      userEventTriggered in class io.netty.handler.codec.ByteToMessageDecoder
      Throws:
      Exception
    • fireProtocolNegotiationEvent

      private void fireProtocolNegotiationEvent(io.netty.channel.ChannelHandlerContext ctx, TsiPeer peer, Object authContext, TsiHandshakeHandler.HandshakeValidator.SecurityDetails details)
    • sendHandshake

      private void sendHandshake(io.netty.channel.ChannelHandlerContext ctx) throws GeneralSecurityException
      Sends as many bytes as are available from the handshaker to the remote peer.
      Throws:
      GeneralSecurityException
    • handlerRemoved0

      protected void handlerRemoved0(io.netty.channel.ChannelHandlerContext ctx) throws Exception
      Overrides:
      handlerRemoved0 in class io.netty.handler.codec.ByteToMessageDecoder
      Throws:
      Exception
    • semaphoreAcquire

      private io.netty.channel.ChannelFuture semaphoreAcquire(io.netty.channel.ChannelHandlerContext ctx)
    • semaphoreRelease

      private void semaphoreRelease()