Package org.gnome.gio
Class InputMessage
java.lang.Object
org.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.
- Since:
- 2.48
-
Constructor Summary
ConstructorsConstructorDescriptionAllocate 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 MemoryLayoutThe memory layout of the native struct.readAddress(int length) Read the value of the fieldaddress.longRead the value of the fieldbytes_received.@Nullable SocketControlMessage @Nullable []Read the value of the fieldcontrol_messages.intRead the value of the fieldflags.Read the value of the fieldnum_control_messages.intRead the value of the fieldnum_vectors.@Nullable InputVector @Nullable []Read the value of the fieldvectors.voidwriteAddress(SocketAddress[] address, Arena _arena) Write a value in the fieldaddress.voidwriteBytesReceived(long bytesReceived) Write a value in the fieldbytes_received.voidwriteControlMessages(@Nullable SocketControlMessage @Nullable [] controlMessages, Arena _arena) Write a value in the fieldcontrol_messages.voidwriteFlags(int flags) Write a value in the fieldflags.voidwriteNumControlMessages(MemorySegment numControlMessages) Write a value in the fieldnum_control_messages.voidwriteNumVectors(int numVectors) Write a value in the fieldnum_vectors.voidwriteVectors(@Nullable InputVector @Nullable [] vectors, Arena _arena) Write a value in the fieldvectors.Methods inherited from class org.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 fieldaddressvectors- value for the fieldvectorsnumVectors- value for the fieldnumVectorsbytesReceived- value for the fieldbytesReceivedflags- value for the fieldflagscontrolMessages- value for the fieldcontrolMessagesnumControlMessages- value for the fieldnumControlMessagesarena- 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 fieldaddressvectors- value for the fieldvectorsnumVectors- value for the fieldnumVectorsbytesReceived- value for the fieldbytesReceivedflags- value for the fieldflagscontrolMessages- value for the fieldcontrolMessagesnumControlMessages- 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 ofaddressto 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
public void writeControlMessages(@Nullable SocketControlMessage @Nullable [] controlMessages, Arena _arena) 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
-