Home / Function/ handleTCP() — netty Function Reference

handleTCP() — netty Function Reference

Architecture documentation for the handleTCP() function in PcapWriteHandler.java from the netty codebase.

Function java Buffer Allocators calls 1 called by 2

Entity Profile

Dependency Diagram

graph TD
  56402456_64d5_e1dd_9d6f_c6dfc0490e45["handleTCP()"]
  59f0289b_ecfd_de3c_3397_4cf08e2047d1["PcapWriteHandler"]
  56402456_64d5_e1dd_9d6f_c6dfc0490e45 -->|defined in| 59f0289b_ecfd_de3c_3397_4cf08e2047d1
  ad9aed33_ce6c_03a6_768d_de9fb726fba9["channelRead()"]
  ad9aed33_ce6c_03a6_768d_de9fb726fba9 -->|calls| 56402456_64d5_e1dd_9d6f_c6dfc0490e45
  2fb87f56_9808_98f7_33ce_8ee757b86601["write()"]
  2fb87f56_9808_98f7_33ce_8ee757b86601 -->|calls| 56402456_64d5_e1dd_9d6f_c6dfc0490e45
  320d8848_c045_6f15_fc6c_77ec890cc385["handleTcpPacket()"]
  56402456_64d5_e1dd_9d6f_c6dfc0490e45 -->|calls| 320d8848_c045_6f15_fc6c_77ec890cc385
  style 56402456_64d5_e1dd_9d6f_c6dfc0490e45 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler/src/main/java/io/netty/handler/pcap/PcapWriteHandler.java lines 337–363

    private void handleTCP(ChannelHandlerContext ctx, Object msg, boolean isWriteOperation) {
        if (msg instanceof ByteBuf) {

            // If bytes are 0 and `captureZeroByte` is false, we won't capture this.
            int totalBytes = ((ByteBuf) msg).readableBytes();
            if (totalBytes == 0 && !captureZeroByte) {
                logger.debug("Discarding Zero Byte TCP Packet. isWriteOperation {}", isWriteOperation);
                return;
            }

            ByteBufAllocator byteBufAllocator = ctx.alloc();
            if (totalBytes == 0) {
                handleTcpPacket(ctx, (ByteBuf) msg, isWriteOperation, byteBufAllocator);
                return;
            }

            // If the payload exceeds the max size of that can fit in a single TCP IPv4 packet, fragment the payload
            int maxTcpPayload = 65495;

            for (int i = 0; i < totalBytes; i += maxTcpPayload) {
                ByteBuf packet = ((ByteBuf) msg).slice(i, Math.min(maxTcpPayload, totalBytes - i));
                handleTcpPacket(ctx, packet, isWriteOperation, byteBufAllocator);
            }
        } else {
            logger.debug("Discarding Pcap Write for TCP Object: {}", msg);
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does handleTCP() do?
handleTCP() is a function in the netty codebase, defined in handler/src/main/java/io/netty/handler/pcap/PcapWriteHandler.java.
Where is handleTCP() defined?
handleTCP() is defined in handler/src/main/java/io/netty/handler/pcap/PcapWriteHandler.java at line 337.
What does handleTCP() call?
handleTCP() calls 1 function(s): handleTcpPacket.
What calls handleTCP()?
handleTCP() is called by 2 function(s): channelRead, write.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free