Home / File/ MsgHdr.java — netty Source File

MsgHdr.java — netty Source File

Architecture documentation for MsgHdr.java, a java file in the netty codebase.

Entity Profile

Relationship Graph

Source Code

/*
 * Copyright 2024 The Netty Project
 *
 * The Netty Project licenses this file to you under the Apache License,
 * version 2.0 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at:
 *
 *   https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */
package io.netty.channel.uring;

import io.netty.channel.unix.Buffer;

import java.nio.ByteBuffer;

/**
 * <pre>{@code
 * struct msghdr {
 *     void         *msg_name;       // optional address
 *     socklen_t    msg_namelen;     // size of address
 *     struct       iovec*msg_iov;   // scatter/gather array
 *     size_t       msg_iovlen;      // # elements in msg_iov
 *     void*        msg_control;     // ancillary data, see below
 *     size_t       msg_controllen;  // ancillary data buffer len
 *     int          msg_flags;       // flags on received message
 * };
 * }</pre>
 */
final class MsgHdr {

    private MsgHdr() { }

    static void set(ByteBuffer memory, long iovMemory, int iovLength) {
        int memoryPosition = memory.position();
        memory.putInt(memoryPosition + Native.MSGHDR_OFFSETOF_MSG_NAMELEN, 0);
        if (Native.SIZEOF_SIZE_T == 4) {
            memory.putInt(memoryPosition + Native.MSGHDR_OFFSETOF_MSG_NAME, 0);
            memory.putInt(memoryPosition + Native.MSGHDR_OFFSETOF_MSG_IOV, (int) iovMemory);
            memory.putInt(memoryPosition + Native.MSGHDR_OFFSETOF_MSG_IOVLEN, iovLength);
            memory.putInt(memoryPosition + Native.MSGHDR_OFFSETOF_MSG_CONTROL, 0);
            memory.putInt(memoryPosition + Native.MSGHDR_OFFSETOF_MSG_CONTROLLEN, 0);
        } else {
            assert Native.SIZEOF_SIZE_T == 8;
            memory.putLong(memoryPosition + Native.MSGHDR_OFFSETOF_MSG_NAME, 0);
            memory.putLong(memoryPosition + Native.MSGHDR_OFFSETOF_MSG_IOV, iovMemory);
            memory.putLong(memoryPosition + Native.MSGHDR_OFFSETOF_MSG_IOVLEN, iovLength);
            memory.putLong(memoryPosition + Native.MSGHDR_OFFSETOF_MSG_CONTROL, 0);
            memory.putLong(memoryPosition + Native.MSGHDR_OFFSETOF_MSG_CONTROLLEN, 0);
        }
    }

    static void set(ByteBuffer memory, ByteBuffer sockAddrMemory, int addressSize, ByteBuffer iovMemory, int iovLength,
                    ByteBuffer msgControl, int cmsgHdrDataOffset, short segmentSize) {
        int memoryPosition = memory.position();
// ... (73 more lines)

Domain

Subdomains

Classes

Frequently Asked Questions

What does MsgHdr.java do?
MsgHdr.java is a source file in the netty codebase, written in java. It belongs to the Buffer domain, Telemetry subdomain.
Where is MsgHdr.java in the architecture?
MsgHdr.java is located at transport-classes-io_uring/src/main/java/io/netty/channel/uring/MsgHdr.java (domain: Buffer, subdomain: Telemetry, directory: transport-classes-io_uring/src/main/java/io/netty/channel/uring).

Analyze Your Own Codebase

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

Try Supermodel Free