Home / Class/ CmsgHdr Class — netty Architecture

CmsgHdr Class — netty Architecture

Architecture documentation for the CmsgHdr class in CmsgHdr.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  111a3db5_f15e_0e90_7c29_bf659eb23b98["CmsgHdr"]
  39c40da4_10e2_081d_7110_2e888f05c56c["CmsgHdr.java"]
  111a3db5_f15e_0e90_7c29_bf659eb23b98 -->|defined in| 39c40da4_10e2_081d_7110_2e888f05c56c
  a4968da3_0ea6_b28e_eddf_d5c09f3013fe["CmsgHdr()"]
  111a3db5_f15e_0e90_7c29_bf659eb23b98 -->|method| a4968da3_0ea6_b28e_eddf_d5c09f3013fe
  1007e84c_8778_80fb_a244_5d8ea3ab00a6["write()"]
  111a3db5_f15e_0e90_7c29_bf659eb23b98 -->|method| 1007e84c_8778_80fb_a244_5d8ea3ab00a6
  fb90a876_5c2e_f3a3_7f07_6fdec455c613["writeScmRights()"]
  111a3db5_f15e_0e90_7c29_bf659eb23b98 -->|method| fb90a876_5c2e_f3a3_7f07_6fdec455c613
  2673c143_9fbd_fa3f_21ef_ed72f20b0ef6["readScmRights()"]
  111a3db5_f15e_0e90_7c29_bf659eb23b98 -->|method| 2673c143_9fbd_fa3f_21ef_ed72f20b0ef6

Relationship Graph

Source Code

transport-classes-io_uring/src/main/java/io/netty/channel/uring/CmsgHdr.java lines 30–64

final class CmsgHdr {

    private CmsgHdr() { }

    static void write(ByteBuffer cmsghdr, int cmsgHdrDataOffset,
                      int cmsgLen, int cmsgLevel, int cmsgType, short segmentSize) {
        int cmsghdrPosition = cmsghdr.position();
        if (Native.SIZEOF_SIZE_T == 4) {
            cmsghdr.putInt(cmsghdrPosition + Native.CMSG_OFFSETOF_CMSG_LEN, cmsgLen);
        } else {
            assert Native.SIZEOF_SIZE_T == 8;
            cmsghdr.putLong(cmsghdrPosition + Native.CMSG_OFFSETOF_CMSG_LEN, cmsgLen);
        }
        cmsghdr.putInt(cmsghdrPosition + Native.CMSG_OFFSETOF_CMSG_LEVEL, cmsgLevel);
        cmsghdr.putInt(cmsghdrPosition + Native.CMSG_OFFSETOF_CMSG_TYPE, cmsgType);
        cmsghdr.putShort(cmsghdrPosition + cmsgHdrDataOffset, segmentSize);
    }

    static void writeScmRights(ByteBuffer cmsghdr, int cmsgHdrDataOffset, int fd) {
        int cmsghdrPosition = cmsghdr.position();
        if (Native.SIZEOF_SIZE_T == 4) {
            cmsghdr.putInt(cmsghdrPosition + Native.CMSG_OFFSETOF_CMSG_LEN, Native.CMSG_LEN_FOR_FD);
        } else {
            assert Native.SIZEOF_SIZE_T == 8;
            cmsghdr.putLong(cmsghdrPosition + Native.CMSG_OFFSETOF_CMSG_LEN, Native.CMSG_LEN_FOR_FD);
        }
        cmsghdr.putInt(cmsghdrPosition + Native.CMSG_OFFSETOF_CMSG_LEVEL, Native.SOL_SOCKET);
        cmsghdr.putInt(cmsghdrPosition + Native.CMSG_OFFSETOF_CMSG_TYPE, Native.SCM_RIGHTS);
        cmsghdr.putInt(cmsghdrPosition + cmsgHdrDataOffset, fd);
    }

    static int readScmRights(ByteBuffer cmsghdr, int cmsgHdrDataOffset) {
        return cmsghdr.getInt(cmsghdr.position() + cmsgHdrDataOffset);
    }
}

Frequently Asked Questions

What is the CmsgHdr class?
CmsgHdr is a class in the netty codebase, defined in transport-classes-io_uring/src/main/java/io/netty/channel/uring/CmsgHdr.java.
Where is CmsgHdr defined?
CmsgHdr is defined in transport-classes-io_uring/src/main/java/io/netty/channel/uring/CmsgHdr.java at line 30.

Analyze Your Own Codebase

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

Try Supermodel Free