Class MemcacheProtocolVerificationHandler

java.lang.Object
com.couchbase.client.core.deps.io.netty.channel.ChannelHandlerAdapter
com.couchbase.client.core.deps.io.netty.channel.ChannelInboundHandlerAdapter
com.couchbase.client.core.deps.io.netty.channel.ChannelDuplexHandler
com.couchbase.client.core.io.netty.kv.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
  • Constructor Summary

    Constructors
    Constructor
    Description
  • Method Summary

    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 class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.couchbase.client.core.deps.io.netty.channel.ChannelHandler

    handlerAdded, handlerRemoved
  • Constructor Details

    • MemcacheProtocolVerificationHandler

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

    • 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.