Package org.gnome.gio
Class InputMessage
java.lang.Object
io.github.jwharm.javagi.base.ProxyInstance
org.gnome.gio.InputMessage
- All Implemented Interfaces:
Proxy
Structure used for scatter/gather data input when receiving multiple
messages or packets in one go. You generally pass in an array of empty
GInputVectors
and the operation will use all the buffers as if they
were one buffer, and will set bytesReceived
to the total number of bytes
received across all GInputVectors
.
This structure closely mirrors struct mmsghdr
and struct msghdr
from
the POSIX sockets API (see man 2 recvmmsg
).
If address
is non-null
then it is set to the source address the message
was received from, and the caller must free it afterwards.
If controlMessages
is non-null
then it is set to an array of control
messages received with the message (if any), and the caller must free it
afterwards. numControlMessages
is set to the number of elements in
this array, which may be zero.
Flags relevant to this message will be returned in flags
. For example,
MSG_EOR
or MSG_TRUNC
.
-
Constructor Summary
ConstructorDescriptionAllocate a new InputMessage.InputMessage
(Arena arena) Allocate a new InputMessage.InputMessage
(MemorySegment address) Create a InputMessage proxy instance for the provided memory address.InputMessage
(SocketAddress[] address, InputVector[] vectors, int numVectors, long bytesReceived, int flags, SocketControlMessage[] controlMessages, MemorySegment numControlMessages) Allocate a new InputMessage with the fields set to the provided values.InputMessage
(SocketAddress[] address, InputVector[] vectors, int numVectors, long bytesReceived, int flags, SocketControlMessage[] controlMessages, MemorySegment numControlMessages, Arena arena) Allocate a new InputMessage with the fields set to the provided values. -
Method Summary
Modifier and TypeMethodDescriptionstatic MemoryLayout
The memory layout of the native struct.readAddress
(int length) Read the value of the fieldaddress
.long
Read the value of the fieldbytes_received
.Read the value of the fieldcontrol_messages
.int
Read the value of the fieldflags
.Read the value of the fieldnum_control_messages
.int
Read the value of the fieldnum_vectors
.Read the value of the fieldvectors
.void
writeAddress
(SocketAddress[] address, Arena _arena) Write a value in the fieldaddress
.void
writeBytesReceived
(long bytesReceived) Write a value in the fieldbytes_received
.void
writeControlMessages
(SocketControlMessage[] controlMessages, Arena _arena) Write a value in the fieldcontrol_messages
.void
writeFlags
(int flags) Write a value in the fieldflags
.void
writeNumControlMessages
(MemorySegment numControlMessages) Write a value in the fieldnum_control_messages
.void
writeNumVectors
(int numVectors) Write a value in the fieldnum_vectors
.void
writeVectors
(InputVector[] vectors, Arena _arena) Write a value in the fieldvectors
.Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
InputMessage
Create a InputMessage proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
InputMessage
Allocate a new InputMessage.- Parameters:
arena
- to control the memory allocation scope
-
InputMessage
public InputMessage()Allocate a new InputMessage. The memory is allocated withArena.ofAuto()
. -
InputMessage
public InputMessage(SocketAddress[] address, InputVector[] vectors, int numVectors, long bytesReceived, int flags, SocketControlMessage[] controlMessages, MemorySegment numControlMessages, Arena arena) Allocate a new InputMessage with the fields set to the provided values.- Parameters:
address
- value for the fieldaddress
vectors
- value for the fieldvectors
numVectors
- value for the fieldnumVectors
bytesReceived
- value for the fieldbytesReceived
flags
- value for the fieldflags
controlMessages
- value for the fieldcontrolMessages
numControlMessages
- value for the fieldnumControlMessages
arena
- to control the memory allocation scope
-
InputMessage
public InputMessage(SocketAddress[] address, InputVector[] vectors, int numVectors, long bytesReceived, int flags, SocketControlMessage[] controlMessages, MemorySegment numControlMessages) Allocate a new InputMessage with the fields set to the provided values. The memory is allocated withArena.ofAuto()
.- Parameters:
address
- value for the fieldaddress
vectors
- value for the fieldvectors
numVectors
- value for the fieldnumVectors
bytesReceived
- value for the fieldbytesReceived
flags
- value for the fieldflags
controlMessages
- value for the fieldcontrolMessages
numControlMessages
- value for the fieldnumControlMessages
-
-
Method Details
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
readAddress
Read the value of the fieldaddress
.- Parameters:
length
- the number ofaddress
to read@return The value of the fieldaddress
-
writeAddress
Write a value in the fieldaddress
.- Parameters:
address
- The new value for the fieldaddress
_arena
- to control the memory allocation scope
-
readVectors
Read the value of the fieldvectors
.- Returns:
- The value of the field
vectors
-
writeVectors
Write a value in the fieldvectors
.- Parameters:
vectors
- The new value for the fieldvectors
_arena
- to control the memory allocation scope
-
readNumVectors
public int readNumVectors()Read the value of the fieldnum_vectors
.- Returns:
- The value of the field
num_vectors
-
writeNumVectors
public void writeNumVectors(int numVectors) Write a value in the fieldnum_vectors
.- Parameters:
numVectors
- The new value for the fieldnum_vectors
-
readBytesReceived
public long readBytesReceived()Read the value of the fieldbytes_received
.- Returns:
- The value of the field
bytes_received
-
writeBytesReceived
public void writeBytesReceived(long bytesReceived) Write a value in the fieldbytes_received
.- Parameters:
bytesReceived
- The new value for the fieldbytes_received
-
readFlags
public int readFlags()Read the value of the fieldflags
.- Returns:
- The value of the field
flags
-
writeFlags
public void writeFlags(int flags) Write a value in the fieldflags
.- Parameters:
flags
- The new value for the fieldflags
-
readControlMessages
Read the value of the fieldcontrol_messages
.- Returns:
- The value of the field
control_messages
-
writeControlMessages
Write a value in the fieldcontrol_messages
.- Parameters:
controlMessages
- The new value for the fieldcontrol_messages
_arena
- to control the memory allocation scope
-
readNumControlMessages
Read the value of the fieldnum_control_messages
.- Returns:
- The value of the field
num_control_messages
-
writeNumControlMessages
Write a value in the fieldnum_control_messages
.- Parameters:
numControlMessages
- The new value for the fieldnum_control_messages
-