Class Msghdr

All Implemented Interfaces:
AutoCloseable, NativeResource, Pointer

public class Msghdr extends Struct<Msghdr> implements NativeResource

 struct msghdr {
     void * msg_name;
     socklen_t msg_namelen;
     {@link IOVec struct iovec} * msg_iov;
     size_t msg_iovlen;
     void * msg_control;
     size_t msg_controllen;
     int msg_flags;
 }
  • Field Details

    • SIZEOF

      public static final int SIZEOF
      The struct size in bytes.
    • ALIGNOF

      public static final int ALIGNOF
      The struct alignment in bytes.
    • MSG_NAME

      public static final int MSG_NAME
      The struct member offsets.
    • MSG_NAMELEN

      public static final int MSG_NAMELEN
      The struct member offsets.
    • MSG_IOV

      public static final int MSG_IOV
      The struct member offsets.
    • MSG_IOVLEN

      public static final int MSG_IOVLEN
      The struct member offsets.
    • MSG_CONTROL

      public static final int MSG_CONTROL
      The struct member offsets.
    • MSG_CONTROLLEN

      public static final int MSG_CONTROLLEN
      The struct member offsets.
    • MSG_FLAGS

      public static final int MSG_FLAGS
      The struct member offsets.
  • Constructor Details

    • Msghdr

      public Msghdr(ByteBuffer container)
      Creates a Msghdr instance at the current position of the specified ByteBuffer container. Changes to the buffer's content will be visible to the struct instance and vice versa.

      The created instance holds a strong reference to the container object.

  • Method Details

    • sizeof

      public int sizeof()
      Description copied from class: Struct
      Returns sizeof(struct).
      Specified by:
      sizeof in class Struct<Msghdr>
    • msg_name

      public ByteBuffer msg_name()
      Returns:
      a ByteBuffer view of the data pointed to by the msg_name field.
    • msg_namelen

      public int msg_namelen()
      Returns:
      the value of the msg_namelen field.
    • msg_iov

      public IOVec.Buffer msg_iov()
      Returns:
      a IOVec.Buffer view of the struct array pointed to by the msg_iov field.
    • msg_iovlen

      public long msg_iovlen()
      Returns:
      the value of the msg_iovlen field.
    • msg_control

      public ByteBuffer msg_control()
      Returns:
      a ByteBuffer view of the data pointed to by the msg_control field.
    • msg_controllen

      public long msg_controllen()
      Returns:
      the value of the msg_controllen field.
    • msg_flags

      public int msg_flags()
      Returns:
      the value of the msg_flags field.
    • msg_name

      public Msghdr msg_name(ByteBuffer value)
      Sets the address of the specified ByteBuffer to the msg_name field.
    • msg_iov

      public Msghdr msg_iov(IOVec.Buffer value)
      Sets the address of the specified IOVec.Buffer to the msg_iov field.
    • msg_control

      public Msghdr msg_control(ByteBuffer value)
      Sets the address of the specified ByteBuffer to the msg_control field.
    • msg_flags

      public Msghdr msg_flags(int value)
      Sets the specified value to the msg_flags field.
    • set

      public Msghdr set(ByteBuffer msg_name, IOVec.Buffer msg_iov, ByteBuffer msg_control, int msg_flags)
      Initializes this struct with the specified values.
    • set

      public Msghdr set(Msghdr src)
      Copies the specified struct data to this struct.
      Parameters:
      src - the source struct
      Returns:
      this struct
    • malloc

      public static Msghdr malloc()
      Returns a new Msghdr instance allocated with memAlloc. The instance must be explicitly freed.
    • calloc

      public static Msghdr calloc()
      Returns a new Msghdr instance allocated with memCalloc. The instance must be explicitly freed.
    • create

      public static Msghdr create()
      Returns a new Msghdr instance allocated with BufferUtils.
    • create

      public static Msghdr create(long address)
      Returns a new Msghdr instance for the specified memory address.
    • createSafe

      public static @Nullable Msghdr createSafe(long address)
      Like create, but returns null if address is NULL.
    • malloc

      public static Msghdr.Buffer malloc(int capacity)
      Returns a new Msghdr.Buffer instance allocated with memAlloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • calloc

      public static Msghdr.Buffer calloc(int capacity)
      Returns a new Msghdr.Buffer instance allocated with memCalloc. The instance must be explicitly freed.
      Parameters:
      capacity - the buffer capacity
    • create

      public static Msghdr.Buffer create(int capacity)
      Returns a new Msghdr.Buffer instance allocated with BufferUtils.
      Parameters:
      capacity - the buffer capacity
    • create

      public static Msghdr.Buffer create(long address, int capacity)
      Create a Msghdr.Buffer instance at the specified memory.
      Parameters:
      address - the memory address
      capacity - the buffer capacity
    • createSafe

      public static @Nullable Msghdr.Buffer createSafe(long address, int capacity)
      Like create, but returns null if address is NULL.
    • malloc

      public static Msghdr malloc(MemoryStack stack)
      Returns a new Msghdr instance allocated on the specified MemoryStack.
      Parameters:
      stack - the stack from which to allocate
    • calloc

      public static Msghdr calloc(MemoryStack stack)
      Returns a new Msghdr instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      stack - the stack from which to allocate
    • malloc

      public static Msghdr.Buffer malloc(int capacity, MemoryStack stack)
      Returns a new Msghdr.Buffer instance allocated on the specified MemoryStack.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • calloc

      public static Msghdr.Buffer calloc(int capacity, MemoryStack stack)
      Returns a new Msghdr.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.
      Parameters:
      capacity - the buffer capacity
      stack - the stack from which to allocate
    • nmsg_name

      public static ByteBuffer nmsg_name(long struct)
      Unsafe version of msg_name.
    • nmsg_namelen

      public static int nmsg_namelen(long struct)
      Unsafe version of msg_namelen().
    • nmsg_iov

      public static IOVec.Buffer nmsg_iov(long struct)
      Unsafe version of msg_iov().
    • nmsg_iovlen

      public static long nmsg_iovlen(long struct)
      Unsafe version of msg_iovlen().
    • nmsg_control

      public static ByteBuffer nmsg_control(long struct)
      Unsafe version of msg_control.
    • nmsg_controllen

      public static long nmsg_controllen(long struct)
      Unsafe version of msg_controllen().
    • nmsg_flags

      public static int nmsg_flags(long struct)
      Unsafe version of msg_flags().
    • nmsg_name

      public static void nmsg_name(long struct, ByteBuffer value)
      Unsafe version of msg_name.
    • nmsg_namelen

      public static void nmsg_namelen(long struct, int value)
      Sets the specified value to the msg_namelen field of the specified struct.
    • nmsg_iov

      public static void nmsg_iov(long struct, IOVec.Buffer value)
      Unsafe version of msg_iov.
    • nmsg_iovlen

      public static void nmsg_iovlen(long struct, long value)
      Sets the specified value to the msg_iovlen field of the specified struct.
    • nmsg_control

      public static void nmsg_control(long struct, ByteBuffer value)
      Unsafe version of msg_control.
    • nmsg_controllen

      public static void nmsg_controllen(long struct, long value)
      Sets the specified value to the msg_controllen field of the specified struct.
    • nmsg_flags

      public static void nmsg_flags(long struct, int value)
      Unsafe version of msg_flags.
    • validate

      public static void validate(long struct)
      Validates pointer members that should not be NULL.
      Parameters:
      struct - the struct to validate