Class MemcacheProtocolVerificationHandler

  • All Implemented Interfaces:
    com.couchbase.client.core.deps.io.netty.channel.ChannelHandler, com.couchbase.client.core.deps.io.netty.channel.ChannelInboundHandler, com.couchbase.client.core.deps.io.netty.channel.ChannelOutboundHandler

    public class MemcacheProtocolVerificationHandler
    extends com.couchbase.client.core.deps.io.netty.channel.ChannelDuplexHandler
    This handler makes sure that the KV protocol packets passed around are not malformed.

    This handler is purely here for defense in-depth against malformed packets. For performance reasons, it only checks the basic structure and length fields and cannot do any deep-packet inspection.

    • Nested Class Summary

      • Nested classes/interfaces inherited from interface com.couchbase.client.core.deps.io.netty.channel.ChannelHandler

        com.couchbase.client.core.deps.io.netty.channel.ChannelHandler.Sharable
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void channelRead​(com.couchbase.client.core.deps.io.netty.channel.ChannelHandlerContext ctx, Object response)
      Makes sure that incoming responses are valid.
      void write​(com.couchbase.client.core.deps.io.netty.channel.ChannelHandlerContext ctx, Object request, com.couchbase.client.core.deps.io.netty.channel.ChannelPromise promise)
      Makes sure that outgoing requests are valid.
      • Methods inherited from class com.couchbase.client.core.deps.io.netty.channel.ChannelDuplexHandler

        bind, close, connect, deregister, disconnect, flush, read
      • Methods inherited from class com.couchbase.client.core.deps.io.netty.channel.ChannelInboundHandlerAdapter

        channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
      • Methods inherited from class com.couchbase.client.core.deps.io.netty.channel.ChannelHandlerAdapter

        ensureNotSharable, handlerAdded, handlerRemoved, isSharable
      • Methods inherited from interface com.couchbase.client.core.deps.io.netty.channel.ChannelHandler

        handlerAdded, handlerRemoved
    • Constructor Detail

      • MemcacheProtocolVerificationHandler

        public MemcacheProtocolVerificationHandler​(EndpointContext endpointContext)
        Parameters:
        endpointContext - the core context used to refer to values like the core id.
    • Method Detail

      • write

        public void write​(com.couchbase.client.core.deps.io.netty.channel.ChannelHandlerContext ctx,
                          Object request,
                          com.couchbase.client.core.deps.io.netty.channel.ChannelPromise promise)
        Makes sure that outgoing requests are valid.
        Specified by:
        write in interface com.couchbase.client.core.deps.io.netty.channel.ChannelOutboundHandler
        Overrides:
        write in class com.couchbase.client.core.deps.io.netty.channel.ChannelDuplexHandler
        Parameters:
        ctx - the context to use.
        request - the request to check.
        promise - the write promise.
      • channelRead

        public void channelRead​(com.couchbase.client.core.deps.io.netty.channel.ChannelHandlerContext ctx,
                                Object response)
        Makes sure that incoming responses are valid.
        Specified by:
        channelRead in interface com.couchbase.client.core.deps.io.netty.channel.ChannelInboundHandler
        Overrides:
        channelRead in class com.couchbase.client.core.deps.io.netty.channel.ChannelInboundHandlerAdapter
        Parameters:
        ctx - the context to use.
        response - the response to check.