mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-29 11:06:18 +00:00
ipc: Move ipc_message_channel functions to own files
What actually happened: copy src/xrt/ipc/shared/{ipc_utils.h => ipc_message_channel.h} (95%) rename src/xrt/ipc/shared/{ipc_utils_unix.c => ipc_message_channel_unix.c} (99%) rename src/xrt/ipc/shared/{ipc_utils_windows.cpp => ipc_message_channel_windows.cpp} (99%) rewrite src/xrt/ipc/shared/ipc_utils.h (94%)
This commit is contained in:
parent
850e57a002
commit
2d7041c797
|
@ -29,6 +29,7 @@ endforeach()
|
|||
|
||||
set(IPC_COMMON_SOURCES
|
||||
${CMAKE_CURRENT_BINARY_DIR}/ipc_protocol_generated.h
|
||||
shared/ipc_message_channel.h
|
||||
shared/ipc_shmem.c
|
||||
shared/ipc_shmem.h
|
||||
shared/ipc_utils.c
|
||||
|
@ -41,9 +42,9 @@ target_include_directories(
|
|||
)
|
||||
|
||||
if(WIN32)
|
||||
target_sources(ipc_shared PRIVATE shared/ipc_utils_windows.cpp)
|
||||
target_sources(ipc_shared PRIVATE shared/ipc_message_channel_windows.cpp)
|
||||
else()
|
||||
target_sources(ipc_shared PRIVATE shared/ipc_utils_unix.c)
|
||||
target_sources(ipc_shared PRIVATE shared/ipc_message_channel_unix.c)
|
||||
endif()
|
||||
|
||||
target_link_libraries(ipc_shared PRIVATE aux_util)
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include "util/u_logging.h"
|
||||
|
||||
#include "shared/ipc_protocol.h"
|
||||
#include "shared/ipc_utils.h"
|
||||
#include "shared/ipc_message_channel.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "util/u_git_tag.h"
|
||||
#include "util/u_system_helpers.h"
|
||||
|
||||
#include "shared/ipc_utils.h"
|
||||
#include "shared/ipc_protocol.h"
|
||||
#include "client/ipc_client_connection.h"
|
||||
|
||||
|
|
|
@ -15,15 +15,16 @@
|
|||
#include "xrt/xrt_system.h"
|
||||
#include "xrt/xrt_space.h"
|
||||
|
||||
#include "util/u_logging.h"
|
||||
|
||||
#include "os/os_threading.h"
|
||||
|
||||
#include "util/u_logging.h"
|
||||
|
||||
#include "shared/ipc_protocol.h"
|
||||
#include "shared/ipc_utils.h"
|
||||
#include "shared/ipc_message_channel.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "util/u_file.h"
|
||||
#include "util/u_windows.h"
|
||||
|
||||
#include "shared/ipc_utils.h"
|
||||
#include "shared/ipc_shmem.h"
|
||||
#include "server/ipc_server.h"
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "util/u_misc.h"
|
||||
#include "util/u_trace_marker.h"
|
||||
|
||||
#include "shared/ipc_utils.h"
|
||||
#include "server/ipc_server.h"
|
||||
#include "ipc_server_generated.h"
|
||||
|
||||
|
|
340
src/xrt/ipc/shared/ipc_message_channel.h
Normal file
340
src/xrt/ipc/shared/ipc_message_channel.h
Normal file
|
@ -0,0 +1,340 @@
|
|||
// Copyright 2020-2023, Collabora, Ltd.
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
/*!
|
||||
* @file
|
||||
* @brief IPC message channel functions.
|
||||
* @author Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||
* @ingroup ipc_shared
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <xrt/xrt_handles.h>
|
||||
#include <xrt/xrt_results.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "util/u_logging.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* Wrapper for a socket and flags.
|
||||
*/
|
||||
struct ipc_message_channel
|
||||
{
|
||||
xrt_ipc_handle_t ipc_handle;
|
||||
enum u_logging_level log_level;
|
||||
};
|
||||
|
||||
/*!
|
||||
* Close an IPC message channel
|
||||
*
|
||||
* @public @memberof ipc_message_channel
|
||||
*/
|
||||
void
|
||||
ipc_message_channel_close(struct ipc_message_channel *imc);
|
||||
|
||||
/*!
|
||||
* Send a bare message over the IPC channel.
|
||||
*
|
||||
* There are other functions if you have handles, not just scalar/aggregate
|
||||
* data.
|
||||
*
|
||||
* @param imc Message channel to use
|
||||
* @param[in] data Pointer to the data buffer to send. Must not be
|
||||
* null: use a filler message if necessary.
|
||||
* @param[in] size Size of data pointed-to by @p data, must be greater than 0
|
||||
*
|
||||
* @public @memberof ipc_message_channel
|
||||
*/
|
||||
xrt_result_t
|
||||
ipc_send(struct ipc_message_channel *imc, const void *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.
|
||||
*
|
||||
* @param imc Message channel to use
|
||||
* @param[out] out_data Pointer to the buffer to fill with data. Must not be
|
||||
* null.
|
||||
* @param[in] size Maximum size to read, must be greater than 0
|
||||
*
|
||||
* @public @memberof ipc_message_channel
|
||||
*/
|
||||
xrt_result_t
|
||||
ipc_receive(struct ipc_message_channel *imc, void *out_data, size_t size);
|
||||
|
||||
/*!
|
||||
* @name File Descriptor or HANDLE utilities
|
||||
* @brief These are typically called from within the send/receive_handles
|
||||
* functions.
|
||||
* @{
|
||||
*/
|
||||
#ifdef XRT_OS_UNIX
|
||||
|
||||
/*!
|
||||
* Receive a message along with a known number of file descriptors over the IPC
|
||||
* channel.
|
||||
*
|
||||
* @param imc Message channel to use
|
||||
* @param[out] out_data Pointer to the buffer to fill with data. Must not be
|
||||
* null.
|
||||
* @param[in] size Maximum size to read, must be greater than 0
|
||||
* @param[out] out_fds Array of file descriptors to populate. Must not be null.
|
||||
* @param[in] fd_count Number of elements to receive into @p out_fds, must be
|
||||
* greater than 0 and must match the value provided at the
|
||||
* other end.
|
||||
*
|
||||
* @public @memberof ipc_message_channel
|
||||
*/
|
||||
xrt_result_t
|
||||
ipc_receive_fds(struct ipc_message_channel *imc, void *out_data, size_t size, int *out_fds, uint32_t fd_count);
|
||||
|
||||
/*!
|
||||
* Send a message along with file descriptors over the IPC channel.
|
||||
*
|
||||
* @param imc Message channel to use
|
||||
* @param[in] data Pointer to the data buffer to send. Must not be
|
||||
* null: use a filler message if necessary.
|
||||
* @param[in] size Size of data pointed-to by @p data, must be greater than 0.
|
||||
* @param[out] fds Array of file descriptors to send. Must not benull.
|
||||
* @param[in] fd_count Number of elements in @p 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.
|
||||
*
|
||||
* @public @memberof ipc_message_channel
|
||||
*/
|
||||
xrt_result_t
|
||||
ipc_send_fds(struct ipc_message_channel *imc, const void *data, size_t size, const int *fds, uint32_t fd_count);
|
||||
|
||||
#elif defined(XRT_OS_WINDOWS)
|
||||
|
||||
/*!
|
||||
* Receive a message along with a known number of file HANDLEs over the IPC
|
||||
* channel.
|
||||
*
|
||||
* @param imc Message channel to use
|
||||
* @param[out] out_data Pointer to the buffer to fill with data. Must not be
|
||||
* null.
|
||||
* @param[in] size Maximum size to read, must be greater than 0
|
||||
* @param[out] out_handles Array of file HANDLEs to populate. Must not be
|
||||
* null.
|
||||
* @param[in] handle_count Number of elements to receive into @p out_handles,
|
||||
* must be greater than 0 and must match the value provided at the other end.
|
||||
*
|
||||
* @public @memberof ipc_message_channel
|
||||
*/
|
||||
xrt_result_t
|
||||
ipc_receive_handles(
|
||||
struct ipc_message_channel *imc, void *out_data, size_t size, HANDLE *out_handles, uint32_t handle_count);
|
||||
|
||||
/*!
|
||||
* Send a message along with file HANDLEs over the IPC channel.
|
||||
*
|
||||
* @param imc Message channel to use
|
||||
* @param[in] data Pointer to the data buffer to send. Must not be
|
||||
* null: use a filler message if necessary.
|
||||
* @param[in] size Size of data pointed-to by @p data, must be greater than 0
|
||||
* @param[out] handles Array of file HANDLEs to send. Must not be
|
||||
* null.
|
||||
* @param[in] handle_count Number of elements in @p 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.
|
||||
*
|
||||
* @public @memberof ipc_message_channel
|
||||
*/
|
||||
xrt_result_t
|
||||
ipc_send_handles(
|
||||
struct ipc_message_channel *imc, const void *data, size_t size, const HANDLE *handles, uint32_t handle_count);
|
||||
|
||||
#endif // XRT_OS_UNIX
|
||||
/*!
|
||||
* @}
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @name Shared memory handle utilities
|
||||
* @brief Send/receive shared memory handles along with scalar/aggregate message
|
||||
* data.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Receive a message along with a known number of shared memory handles over the
|
||||
* IPC channel.
|
||||
*
|
||||
* @param imc Message channel to use
|
||||
* @param[out] out_data Pointer to the buffer to fill with data. Must not be
|
||||
* null.
|
||||
* @param[in] size Maximum size to read, must be greater than 0
|
||||
* @param[out] out_handles Array of shared memory handles to populate. Must not
|
||||
* be null.
|
||||
* @param[in] handle_count Number of elements to receive into @p out_handles,
|
||||
* must be greater than 0 and must match the value provided at the other end.
|
||||
*
|
||||
* @public @memberof ipc_message_channel
|
||||
* @see xrt_shmem_handle_t
|
||||
*/
|
||||
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);
|
||||
|
||||
|
||||
/*!
|
||||
* Send a message along with shared memory handles over the IPC channel.
|
||||
*
|
||||
* @param imc Message channel to use
|
||||
* @param[in] data Pointer to the data buffer to send. Must not be
|
||||
* null: use a filler message if necessary.
|
||||
* @param[in] size Size of data pointed-to by @p data, must be greater than 0
|
||||
* @param[out] handles Array of shared memory handles to send. Must not be
|
||||
* null.
|
||||
* @param[in] handle_count Number of elements in @p 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.
|
||||
*
|
||||
* @public @memberof ipc_message_channel
|
||||
* @see xrt_shmem_handle_t
|
||||
*/
|
||||
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);
|
||||
/*!
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
* @name Graphics buffer handle utilities
|
||||
* @brief Send/receive graphics buffer handles along with scalar/aggregate
|
||||
* message data.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Receive a message along with a known number of graphics buffer handles over
|
||||
* the IPC channel.
|
||||
*
|
||||
* @param imc Message channel to use
|
||||
* @param[out] out_data Pointer to the buffer to fill with data. Must not be
|
||||
* null.
|
||||
* @param[in] size Maximum size to read, must be greater than 0
|
||||
* @param[out] out_handles Array of graphics buffer handles to populate. Must
|
||||
* not be null.
|
||||
* @param[in] handle_count Number of elements to receive into @p out_handles,
|
||||
* must be greater than 0 and must match the value provided at the other end.
|
||||
*
|
||||
* @public @memberof ipc_message_channel
|
||||
* @see xrt_graphics_buffer_handle_t
|
||||
*/
|
||||
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);
|
||||
|
||||
|
||||
/*!
|
||||
* Send a message along with native graphics buffer handles over the IPC
|
||||
* channel.
|
||||
*
|
||||
* @param imc Message channel to use
|
||||
* @param[in] data Pointer to the data buffer to send. Must not be
|
||||
* null: use a filler message if necessary.
|
||||
* @param[in] size Size of data pointed-to by @p data, must be greater than 0
|
||||
* @param[out] handles Array of graphics buffer handles to send. Must not be
|
||||
* null.
|
||||
* @param[in] handle_count Number of elements in @p 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.
|
||||
*
|
||||
* @public @memberof ipc_message_channel
|
||||
* @see xrt_graphics_buffer_handle_t
|
||||
*/
|
||||
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);
|
||||
|
||||
/*!
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
* @name Graphics buffer handle utilities
|
||||
* @brief Send/receive graphics buffer handles along with scalar/aggregate
|
||||
* message data.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Receive a message along with a known number of graphics sync handles over
|
||||
* the IPC channel.
|
||||
*
|
||||
* @param imc Message channel to use
|
||||
* @param[out] out_data Pointer to the sync to fill with data. Must not be null.
|
||||
* @param[in] size Maximum size to read, must be greater than 0
|
||||
* @param[out] out_handles Array of graphics sync handles to populate. Must not
|
||||
* be null.
|
||||
* @param[in] handle_count Number of elements to receive into @p out_handles,
|
||||
* must be greater than 0 and must match the value provided at the other end.
|
||||
*
|
||||
* @public @memberof ipc_message_channel
|
||||
* @see xrt_graphics_sync_handle_t
|
||||
*/
|
||||
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);
|
||||
|
||||
/*!
|
||||
* Send a message along with native graphics sync handles over the IPC channel.
|
||||
*
|
||||
* @param imc Message channel to use
|
||||
* @param[in] data Pointer to the data sync to send. Must not be null: use a
|
||||
* filler message if necessary.
|
||||
* @param[in] size Size of data pointed-to by @p data, must be greater than 0
|
||||
* @param[out] handles Array of graphics sync handles to send. Must not be
|
||||
* null.
|
||||
* @param[in] handle_count Number of elements in @p 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.
|
||||
*
|
||||
* @public @memberof ipc_message_channel
|
||||
* @see xrt_graphics_sync_handle_t
|
||||
*/
|
||||
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);
|
||||
|
||||
/*!
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -2,7 +2,7 @@
|
|||
// SPDX-License-Identifier: BSL-1.0
|
||||
/*!
|
||||
* @file
|
||||
* @brief IPC util helpers, for internal use only
|
||||
* @brief IPC message channel functions for UNIX platforms.
|
||||
* @author Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||
* @author Pete Black <pblack@collabora.com>
|
||||
* @author Jakob Bornecrantz <jakob@collabora.com>
|
||||
|
@ -18,8 +18,8 @@
|
|||
#include "util/u_logging.h"
|
||||
#include "util/u_pretty_print.h"
|
||||
|
||||
#include "shared/ipc_utils.h"
|
||||
#include "shared/ipc_protocol.h"
|
||||
#include "shared/ipc_message_channel.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/socket.h>
|
|
@ -3,7 +3,7 @@
|
|||
// SPDX-License-Identifier: BSL-1.0
|
||||
/*!
|
||||
* @file
|
||||
* @brief IPC util helpers on Windows, for internal use only
|
||||
* @brief IPC message channel functions for Windows.
|
||||
* @author Julian Petrov <jpetrov@magicleap.com>
|
||||
* @author Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||
* @author Pete Black <pblack@collabora.com>
|
||||
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "shared/ipc_utils.h"
|
||||
#include "shared/ipc_protocol.h"
|
||||
#include "shared/ipc_message_channel.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
|
@ -1,22 +1,22 @@
|
|||
// Copyright 2020, Collabora, Ltd.
|
||||
// Copyright 2020-2023, Collabora, Ltd.
|
||||
// Copyright 2022, Magic Leap, Inc.
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
/*!
|
||||
* @file
|
||||
* @brief IPC util helpers, for internal use only
|
||||
* @author Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||
* @author Julian Petrov <jpetrov@magicleap.com>
|
||||
* @author Jakob Bornecrantz <jakob@collabora.com>
|
||||
* @ingroup ipc_shared
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <xrt/xrt_handles.h>
|
||||
#include <xrt/xrt_results.h>
|
||||
#include "xrt/xrt_config_os.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#ifdef XRT_OS_WINDOWS
|
||||
#include "util/u_windows.h"
|
||||
#endif
|
||||
|
||||
#include "util/u_logging.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -44,324 +44,6 @@ ipc_winerror(DWORD err);
|
|||
#endif
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Channel functions.
|
||||
*
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Wrapper for a socket and flags.
|
||||
*/
|
||||
struct ipc_message_channel
|
||||
{
|
||||
xrt_ipc_handle_t ipc_handle;
|
||||
enum u_logging_level log_level;
|
||||
};
|
||||
|
||||
/*!
|
||||
* Close an IPC message channel
|
||||
*
|
||||
* @public @memberof ipc_message_channel
|
||||
*/
|
||||
void
|
||||
ipc_message_channel_close(struct ipc_message_channel *imc);
|
||||
|
||||
/*!
|
||||
* Send a bare message over the IPC channel.
|
||||
*
|
||||
* There are other functions if you have handles, not just scalar/aggregate
|
||||
* data.
|
||||
*
|
||||
* @param imc Message channel to use
|
||||
* @param[in] data Pointer to the data buffer to send. Must not be
|
||||
* null: use a filler message if necessary.
|
||||
* @param[in] size Size of data pointed-to by @p data, must be greater than 0
|
||||
*
|
||||
* @public @memberof ipc_message_channel
|
||||
*/
|
||||
xrt_result_t
|
||||
ipc_send(struct ipc_message_channel *imc, const void *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.
|
||||
*
|
||||
* @param imc Message channel to use
|
||||
* @param[out] out_data Pointer to the buffer to fill with data. Must not be
|
||||
* null.
|
||||
* @param[in] size Maximum size to read, must be greater than 0
|
||||
*
|
||||
* @public @memberof ipc_message_channel
|
||||
*/
|
||||
xrt_result_t
|
||||
ipc_receive(struct ipc_message_channel *imc, void *out_data, size_t size);
|
||||
|
||||
/*!
|
||||
* @name File Descriptor or HANDLE utilities
|
||||
* @brief These are typically called from within the send/receive_handles
|
||||
* functions.
|
||||
* @{
|
||||
*/
|
||||
#ifdef XRT_OS_UNIX
|
||||
|
||||
/*!
|
||||
* Receive a message along with a known number of file descriptors over the IPC
|
||||
* channel.
|
||||
*
|
||||
* @param imc Message channel to use
|
||||
* @param[out] out_data Pointer to the buffer to fill with data. Must not be
|
||||
* null.
|
||||
* @param[in] size Maximum size to read, must be greater than 0
|
||||
* @param[out] out_fds Array of file descriptors to populate. Must not be null.
|
||||
* @param[in] fd_count Number of elements to receive into @p out_fds, must be
|
||||
* greater than 0 and must match the value provided at the
|
||||
* other end.
|
||||
*
|
||||
* @public @memberof ipc_message_channel
|
||||
*/
|
||||
xrt_result_t
|
||||
ipc_receive_fds(struct ipc_message_channel *imc, void *out_data, size_t size, int *out_fds, uint32_t fd_count);
|
||||
|
||||
/*!
|
||||
* Send a message along with file descriptors over the IPC channel.
|
||||
*
|
||||
* @param imc Message channel to use
|
||||
* @param[in] data Pointer to the data buffer to send. Must not be
|
||||
* null: use a filler message if necessary.
|
||||
* @param[in] size Size of data pointed-to by @p data, must be greater than 0.
|
||||
* @param[out] fds Array of file descriptors to send. Must not benull.
|
||||
* @param[in] fd_count Number of elements in @p 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.
|
||||
*
|
||||
* @public @memberof ipc_message_channel
|
||||
*/
|
||||
xrt_result_t
|
||||
ipc_send_fds(struct ipc_message_channel *imc, const void *data, size_t size, const int *fds, uint32_t fd_count);
|
||||
|
||||
#elif defined(XRT_OS_WINDOWS)
|
||||
|
||||
/*!
|
||||
* Receive a message along with a known number of file HANDLEs over the IPC
|
||||
* channel.
|
||||
*
|
||||
* @param imc Message channel to use
|
||||
* @param[out] out_data Pointer to the buffer to fill with data. Must not be
|
||||
* null.
|
||||
* @param[in] size Maximum size to read, must be greater than 0
|
||||
* @param[out] out_handles Array of file HANDLEs to populate. Must not be
|
||||
* null.
|
||||
* @param[in] handle_count Number of elements to receive into @p out_handles,
|
||||
* must be greater than 0 and must match the value provided at the other end.
|
||||
*
|
||||
* @public @memberof ipc_message_channel
|
||||
*/
|
||||
xrt_result_t
|
||||
ipc_receive_handles(
|
||||
struct ipc_message_channel *imc, void *out_data, size_t size, HANDLE *out_handles, uint32_t handle_count);
|
||||
|
||||
/*!
|
||||
* Send a message along with file HANDLEs over the IPC channel.
|
||||
*
|
||||
* @param imc Message channel to use
|
||||
* @param[in] data Pointer to the data buffer to send. Must not be
|
||||
* null: use a filler message if necessary.
|
||||
* @param[in] size Size of data pointed-to by @p data, must be greater than 0
|
||||
* @param[out] handles Array of file HANDLEs to send. Must not be
|
||||
* null.
|
||||
* @param[in] handle_count Number of elements in @p 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.
|
||||
*
|
||||
* @public @memberof ipc_message_channel
|
||||
*/
|
||||
xrt_result_t
|
||||
ipc_send_handles(
|
||||
struct ipc_message_channel *imc, const void *data, size_t size, const HANDLE *handles, uint32_t handle_count);
|
||||
|
||||
#endif // XRT_OS_UNIX
|
||||
/*!
|
||||
* @}
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @name Shared memory handle utilities
|
||||
* @brief Send/receive shared memory handles along with scalar/aggregate message
|
||||
* data.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Receive a message along with a known number of shared memory handles over the
|
||||
* IPC channel.
|
||||
*
|
||||
* @param imc Message channel to use
|
||||
* @param[out] out_data Pointer to the buffer to fill with data. Must not be
|
||||
* null.
|
||||
* @param[in] size Maximum size to read, must be greater than 0
|
||||
* @param[out] out_handles Array of shared memory handles to populate. Must not
|
||||
* be null.
|
||||
* @param[in] handle_count Number of elements to receive into @p out_handles,
|
||||
* must be greater than 0 and must match the value provided at the other end.
|
||||
*
|
||||
* @public @memberof ipc_message_channel
|
||||
* @see xrt_shmem_handle_t
|
||||
*/
|
||||
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);
|
||||
|
||||
|
||||
/*!
|
||||
* Send a message along with shared memory handles over the IPC channel.
|
||||
*
|
||||
* @param imc Message channel to use
|
||||
* @param[in] data Pointer to the data buffer to send. Must not be
|
||||
* null: use a filler message if necessary.
|
||||
* @param[in] size Size of data pointed-to by @p data, must be greater than 0
|
||||
* @param[out] handles Array of shared memory handles to send. Must not be
|
||||
* null.
|
||||
* @param[in] handle_count Number of elements in @p 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.
|
||||
*
|
||||
* @public @memberof ipc_message_channel
|
||||
* @see xrt_shmem_handle_t
|
||||
*/
|
||||
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);
|
||||
/*!
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
* @name Graphics buffer handle utilities
|
||||
* @brief Send/receive graphics buffer handles along with scalar/aggregate
|
||||
* message data.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Receive a message along with a known number of graphics buffer handles over
|
||||
* the IPC channel.
|
||||
*
|
||||
* @param imc Message channel to use
|
||||
* @param[out] out_data Pointer to the buffer to fill with data. Must not be
|
||||
* null.
|
||||
* @param[in] size Maximum size to read, must be greater than 0
|
||||
* @param[out] out_handles Array of graphics buffer handles to populate. Must
|
||||
* not be null.
|
||||
* @param[in] handle_count Number of elements to receive into @p out_handles,
|
||||
* must be greater than 0 and must match the value provided at the other end.
|
||||
*
|
||||
* @public @memberof ipc_message_channel
|
||||
* @see xrt_graphics_buffer_handle_t
|
||||
*/
|
||||
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);
|
||||
|
||||
|
||||
/*!
|
||||
* Send a message along with native graphics buffer handles over the IPC
|
||||
* channel.
|
||||
*
|
||||
* @param imc Message channel to use
|
||||
* @param[in] data Pointer to the data buffer to send. Must not be
|
||||
* null: use a filler message if necessary.
|
||||
* @param[in] size Size of data pointed-to by @p data, must be greater than 0
|
||||
* @param[out] handles Array of graphics buffer handles to send. Must not be
|
||||
* null.
|
||||
* @param[in] handle_count Number of elements in @p 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.
|
||||
*
|
||||
* @public @memberof ipc_message_channel
|
||||
* @see xrt_graphics_buffer_handle_t
|
||||
*/
|
||||
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);
|
||||
|
||||
/*!
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
* @name Graphics buffer handle utilities
|
||||
* @brief Send/receive graphics buffer handles along with scalar/aggregate
|
||||
* message data.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Receive a message along with a known number of graphics sync handles over
|
||||
* the IPC channel.
|
||||
*
|
||||
* @param imc Message channel to use
|
||||
* @param[out] out_data Pointer to the sync to fill with data. Must not be null.
|
||||
* @param[in] size Maximum size to read, must be greater than 0
|
||||
* @param[out] out_handles Array of graphics sync handles to populate. Must not
|
||||
* be null.
|
||||
* @param[in] handle_count Number of elements to receive into @p out_handles,
|
||||
* must be greater than 0 and must match the value provided at the other end.
|
||||
*
|
||||
* @public @memberof ipc_message_channel
|
||||
* @see xrt_graphics_sync_handle_t
|
||||
*/
|
||||
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);
|
||||
|
||||
/*!
|
||||
* Send a message along with native graphics sync handles over the IPC channel.
|
||||
*
|
||||
* @param imc Message channel to use
|
||||
* @param[in] data Pointer to the data sync to send. Must not be null: use a
|
||||
* filler message if necessary.
|
||||
* @param[in] size Size of data pointed-to by @p data, must be greater than 0
|
||||
* @param[out] handles Array of graphics sync handles to send. Must not be
|
||||
* null.
|
||||
* @param[in] handle_count Number of elements in @p 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.
|
||||
*
|
||||
* @public @memberof ipc_message_channel
|
||||
* @see xrt_graphics_sync_handle_t
|
||||
*/
|
||||
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);
|
||||
|
||||
/*!
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue