Class CMsghdr

All Implemented Interfaces:
AutoCloseable, NativeResource, Pointer

public class CMsghdr extends Struct<CMsghdr> implements NativeResource

 struct cmsghdr {
     socklen_t cmsg_len;
     int cmsg_level;
     int cmsg_type;
     char cmsg_data[0];
 }
  • Field Details

    • SIZEOF

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

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

      public static final int CMSG_LEN
      The struct member offsets.
    • CMSG_LEVEL

      public static final int CMSG_LEVEL
      The struct member offsets.
    • CMSG_TYPE

      public static final int CMSG_TYPE
      The struct member offsets.
    • CMSG_DATA

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

    • CMsghdr

      public CMsghdr(ByteBuffer container)
      Creates a CMsghdr 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<CMsghdr>
    • cmsg_len

      public int cmsg_len()
      Returns:
      the value of the cmsg_len field.
    • cmsg_level

      public int cmsg_level()
      Returns:
      the value of the cmsg_level field.
    • cmsg_type

      public int cmsg_type()
      Returns:
      the value of the cmsg_type field.
    • cmsg_data

      public ByteBuffer cmsg_data()
      Returns:
      a ByteBuffer view of the cmsg_data field.
    • cmsg_data

      public byte cmsg_data(int index)
      Returns:
      the value at the specified index of the cmsg_data field.
    • cmsg_len

      public CMsghdr cmsg_len(int value)
      Sets the specified value to the cmsg_len field.
    • cmsg_level

      public CMsghdr cmsg_level(int value)
      Sets the specified value to the cmsg_level field.
    • cmsg_type

      public CMsghdr cmsg_type(int value)
      Sets the specified value to the cmsg_type field.
    • cmsg_data

      public CMsghdr cmsg_data(ByteBuffer value)
      Copies the specified ByteBuffer to the cmsg_data field.
    • cmsg_data

      public CMsghdr cmsg_data(int index, byte value)
      Sets the specified value at the specified index of the cmsg_data field.
    • set

      public CMsghdr set(int cmsg_len, int cmsg_level, int cmsg_type, ByteBuffer cmsg_data)
      Initializes this struct with the specified values.
    • set

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      public static CMsghdr.Buffer calloc(int capacity, MemoryStack stack)
      Returns a new CMsghdr.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
    • ncmsg_len

      public static int ncmsg_len(long struct)
      Unsafe version of cmsg_len().
    • ncmsg_level

      public static int ncmsg_level(long struct)
      Unsafe version of cmsg_level().
    • ncmsg_type

      public static int ncmsg_type(long struct)
      Unsafe version of cmsg_type().
    • ncmsg_data

      public static ByteBuffer ncmsg_data(long struct)
      Unsafe version of cmsg_data().
    • ncmsg_data

      public static byte ncmsg_data(long struct, int index)
      Unsafe version of cmsg_data.
    • ncmsg_len

      public static void ncmsg_len(long struct, int value)
      Unsafe version of cmsg_len.
    • ncmsg_level

      public static void ncmsg_level(long struct, int value)
      Unsafe version of cmsg_level.
    • ncmsg_type

      public static void ncmsg_type(long struct, int value)
      Unsafe version of cmsg_type.
    • ncmsg_data

      public static void ncmsg_data(long struct, ByteBuffer value)
      Unsafe version of cmsg_data.
    • ncmsg_data

      public static void ncmsg_data(long struct, int index, byte value)
      Unsafe version of cmsg_data.