Monado OpenXR Runtime
ipc_message_channel Struct Reference

Wrapper for a socket and flags. More...

#include </builds/monado/monado/src/xrt/ipc/shared/ipc_message_channel.h>

Collaboration diagram for ipc_message_channel:

Public Member Functions

void ipc_message_channel_close (struct ipc_message_channel *imc)
 Close an IPC message channel. More...
 
xrt_result_t ipc_send (struct ipc_message_channel *imc, const void *data, size_t size)
 Send a bare message over the IPC channel. More...
 
xrt_result_t ipc_receive (struct ipc_message_channel *imc, void *out_data, size_t size)
 Receive a bare message over the IPC channel. More...
 
File Descriptor or HANDLE utilities

These are typically called from within the send/receive_handles functions.

xrt_result_t ipc_receive_fds (struct ipc_message_channel *imc, void *out_data, size_t size, int *out_fds, uint32_t fd_count)
 Receive a message along with a known number of file descriptors over the IPC channel. More...
 
xrt_result_t ipc_send_fds (struct ipc_message_channel *imc, const void *data, size_t size, const int *fds, uint32_t fd_count)
 Send a message along with file descriptors over the IPC channel. More...
 
Shared memory handle utilities

Send/receive shared memory handles along with scalar/aggregate message data.

xrt_result_t ipc_receive_handles_shmem (struct ipc_message_channel *imc, void *out_data, size_t size, xrt_shmem_handle_t *out_handles, uint32_t handle_count)
 Receive a message along with a known number of shared memory handles over the IPC channel. More...
 
xrt_result_t ipc_send_handles_shmem (struct ipc_message_channel *imc, const void *data, size_t size, const xrt_shmem_handle_t *handles, uint32_t handle_count)
 Send a message along with shared memory handles over the IPC channel. More...
 
Graphics buffer handle utilities

Send/receive graphics buffer handles along with scalar/aggregate message data.

xrt_result_t ipc_receive_handles_graphics_buffer (struct ipc_message_channel *imc, void *out_data, size_t size, xrt_graphics_buffer_handle_t *out_handles, uint32_t handle_count)
 Receive a message along with a known number of graphics buffer handles over the IPC channel. More...
 
xrt_result_t ipc_send_handles_graphics_buffer (struct ipc_message_channel *imc, const void *data, size_t size, const xrt_graphics_buffer_handle_t *handles, uint32_t handle_count)
 Send a message along with native graphics buffer handles over the IPC channel. More...
 
xrt_result_t ipc_receive_handles_graphics_sync (struct ipc_message_channel *imc, void *out_data, size_t size, xrt_graphics_sync_handle_t *out_handles, uint32_t handle_count)
 Receive a message along with a known number of graphics sync handles over the IPC channel. More...
 
xrt_result_t ipc_send_handles_graphics_sync (struct ipc_message_channel *imc, const void *data, size_t size, const xrt_graphics_sync_handle_t *handles, uint32_t handle_count)
 Send a message along with native graphics sync handles over the IPC channel. More...
 

Data Fields

xrt_ipc_handle_t ipc_handle
 
enum u_logging_level log_level
 

Detailed Description

Wrapper for a socket and flags.

Member Function Documentation

◆ ipc_message_channel_close()

void ipc_message_channel_close ( struct ipc_message_channel imc)

Close an IPC message channel.

Referenced by ipc_client_connection_fini().

◆ ipc_receive()

xrt_result_t ipc_receive ( struct ipc_message_channel imc,
void *  out_data,
size_t  size 
)

Receive a bare message over the IPC channel.

There are other functions if you have handles, not just scalar/aggregate data.

Parameters
imcMessage channel to use
[out]out_dataPointer to the buffer to fill with data. Must not be null.
[in]sizeMaximum size to read, must be greater than 0

◆ ipc_receive_fds()

xrt_result_t ipc_receive_fds ( struct ipc_message_channel imc,
void *  out_data,
size_t  size,
int *  out_fds,
uint32_t  fd_count 
)

Receive a message along with a known number of file descriptors over the IPC channel.

Parameters
imcMessage channel to use
[out]out_dataPointer to the buffer to fill with data. Must not be null.
[in]sizeMaximum size to read, must be greater than 0
[out]out_fdsArray of file descriptors to populate. Must not be null.
[in]fd_countNumber of elements to receive into out_fds, must be greater than 0 and must match the value provided at the other end.

Referenced by ipc_receive_handles_shmem().

◆ ipc_receive_handles_graphics_buffer()

xrt_result_t ipc_receive_handles_graphics_buffer ( struct ipc_message_channel imc,
void *  out_data,
size_t  size,
xrt_graphics_buffer_handle_t out_handles,
uint32_t  handle_count 
)

Receive a message along with a known number of graphics buffer handles over the IPC channel.

Parameters
imcMessage channel to use
[out]out_dataPointer to the buffer to fill with data. Must not be null.
[in]sizeMaximum size to read, must be greater than 0
[out]out_handlesArray of graphics buffer handles to populate. Must not be null.
[in]handle_countNumber of elements to receive into out_handles, must be greater than 0 and must match the value provided at the other end.
See also
xrt_graphics_buffer_handle_t

◆ ipc_receive_handles_graphics_sync()

xrt_result_t ipc_receive_handles_graphics_sync ( struct ipc_message_channel imc,
void *  out_data,
size_t  size,
xrt_graphics_sync_handle_t out_handles,
uint32_t  handle_count 
)

Receive a message along with a known number of graphics sync handles over the IPC channel.

Parameters
imcMessage channel to use
[out]out_dataPointer to the sync to fill with data. Must not be null.
[in]sizeMaximum size to read, must be greater than 0
[out]out_handlesArray of graphics sync handles to populate. Must not be null.
[in]handle_countNumber of elements to receive into out_handles, must be greater than 0 and must match the value provided at the other end.
See also
xrt_graphics_sync_handle_t

◆ ipc_receive_handles_shmem()

xrt_result_t ipc_receive_handles_shmem ( struct ipc_message_channel imc,
void *  out_data,
size_t  size,
xrt_shmem_handle_t out_handles,
uint32_t  handle_count 
)

Receive a message along with a known number of shared memory handles over the IPC channel.

Parameters
imcMessage channel to use
[out]out_dataPointer to the buffer to fill with data. Must not be null.
[in]sizeMaximum size to read, must be greater than 0
[out]out_handlesArray of shared memory handles to populate. Must not be null.
[in]handle_countNumber of elements to receive into out_handles, must be greater than 0 and must match the value provided at the other end.
See also
xrt_shmem_handle_t

References ipc_receive_fds().

◆ ipc_send()

xrt_result_t ipc_send ( struct ipc_message_channel imc,
const void *  data,
size_t  size 
)

Send a bare message over the IPC channel.

There are other functions if you have handles, not just scalar/aggregate data.

Parameters
imcMessage channel to use
[in]dataPointer to the data buffer to send. Must not be null: use a filler message if necessary.
[in]sizeSize of data pointed-to by data, must be greater than 0

◆ ipc_send_fds()

xrt_result_t ipc_send_fds ( struct ipc_message_channel imc,
const void *  data,
size_t  size,
const int *  fds,
uint32_t  fd_count 
)

Send a message along with file descriptors over the IPC channel.

Parameters
imcMessage channel to use
[in]dataPointer to the data buffer to send. Must not be null: use a filler message if necessary.
[in]sizeSize of data pointed-to by data, must be greater than 0.
[out]fdsArray of file descriptors to send. Must not benull.
[in]fd_countNumber of elements in fds, must be greater than 0. If this is variable, it must also be separately transmitted ahead of time, because the receiver must have the same value in its receive call.

◆ ipc_send_handles_graphics_buffer()

xrt_result_t ipc_send_handles_graphics_buffer ( struct ipc_message_channel imc,
const void *  data,
size_t  size,
const xrt_graphics_buffer_handle_t handles,
uint32_t  handle_count 
)

Send a message along with native graphics buffer handles over the IPC channel.

Parameters
imcMessage channel to use
[in]dataPointer to the data buffer to send. Must not be null: use a filler message if necessary.
[in]sizeSize of data pointed-to by data, must be greater than 0
[out]handlesArray of graphics buffer handles to send. Must not be null.
[in]handle_countNumber of elements in handles, must be greater than 0. If this is variable, it must also be separately transmitted ahead of time, because the receiver must have the same value in its receive call.
See also
xrt_graphics_buffer_handle_t

◆ ipc_send_handles_graphics_sync()

xrt_result_t ipc_send_handles_graphics_sync ( struct ipc_message_channel imc,
const void *  data,
size_t  size,
const xrt_graphics_sync_handle_t handles,
uint32_t  handle_count 
)

Send a message along with native graphics sync handles over the IPC channel.

Parameters
imcMessage channel to use
[in]dataPointer to the data sync to send. Must not be null: use a filler message if necessary.
[in]sizeSize of data pointed-to by data, must be greater than 0
[out]handlesArray of graphics sync handles to send. Must not be null.
[in]handle_countNumber of elements in handles, must be greater than 0. If this is variable, it must also be separately transmitted ahead of time, because the receiver must have the same value in its receive call.
See also
xrt_graphics_sync_handle_t

◆ ipc_send_handles_shmem()

xrt_result_t ipc_send_handles_shmem ( struct ipc_message_channel imc,
const void *  data,
size_t  size,
const xrt_shmem_handle_t handles,
uint32_t  handle_count 
)

Send a message along with shared memory handles over the IPC channel.

Parameters
imcMessage channel to use
[in]dataPointer to the data buffer to send. Must not be null: use a filler message if necessary.
[in]sizeSize of data pointed-to by data, must be greater than 0
[out]handlesArray of shared memory handles to send. Must not be null.
[in]handle_countNumber of elements in handles, must be greater than 0. If this is variable, it must also be separately transmitted ahead of time, because the receiver must have the same value in its receive call.
See also
xrt_shmem_handle_t

The documentation for this struct was generated from the following file: