libtransistor
A userland library for the Nintendo Switch
|
Interprocess Communication data structures and functions. More...
#include <libtransistor/types.h>
Go to the source code of this file.
Data Structures | |
struct | ipc_domain_t |
Represents an IPC object domain. More... | |
struct | ipc_object_t |
Represents either an object within an IPC domain or a standalone object. More... | |
struct | ipc_multi_session_node_t |
struct | ipc_multi_session_t |
A wrapper around a session that will clone it for use from multiple threads when necessary. More... | |
struct | ipc_buffer_t |
Buffer for transfer over IPC. More... | |
struct | ipc_request_t |
Represents an unmarshalled outgoing IPC request. More... | |
struct | ipc_request_fmt_t |
Describes format expectations for an incoming IPC request. More... | |
struct | ipc_response_t |
Represents an unmarshalled outgoing IPC response. More... | |
struct | ipc_response_fmt_t |
Describes format expectations for an incoming IPC response. More... | |
struct | ipc_message_t |
Describes an incoming IPC message. Used as an intermediate during unpacking. More... | |
Typedefs | |
typedef struct ipc_multi_session_node_t | ipc_multi_session_node_t |
Enumerations | |
enum | ipc_debug_level_t { IPC_DEBUG_LEVEL_NONE, IPC_DEBUG_LEVEL_UNPACKING_ERRORS, IPC_DEBUG_LEVEL_UNFLATTENING_ERRORS, IPC_DEBUG_LEVEL_FLIGHT_ERRORS, IPC_DEBUG_LEVEL_ALL } |
Functions | |
result_t | ipc_pack_request (uint32_t *buffer, const ipc_request_t *rq, ipc_object_t object) |
Packs the IPC request described by rq and object into buffer . More... | |
result_t | ipc_pack_response (uint32_t *buffer, const ipc_response_t *rs, struct ipc_server_object_t *object) |
Packs the IPC response described by rs and object into buffer . More... | |
result_t | ipc_unpack (uint32_t *buffer, ipc_message_t *msg) |
Unpacks the IPC message from buffer , filling out msg . More... | |
result_t | ipc_unflatten_request (ipc_message_t *msg, ipc_request_fmt_t *rs, struct ipc_server_object_t *object) |
Unflattens the IPC request described by rq from msg More... | |
result_t | ipc_unflatten_response (ipc_message_t *msg, ipc_response_fmt_t *rs, ipc_object_t object) |
Unflattens the IPC response described by rs from msg . More... | |
result_t | ipc_send (ipc_object_t object, ipc_request_t *rq, ipc_response_fmt_t *rs) |
Send a request described by rq to object and then unpack the response. More... | |
result_t | ipc_send_multi (ipc_multi_session_t *multi, ipc_request_t *rq, ipc_response_fmt_t *rs) |
Send a requst described by rq to multi and then unpack the response See ipc_send. NOTE: may call malloc if multiple threads are used. | |
result_t | ipc_convert_to_domain (ipc_object_t *session, ipc_domain_t *domain) |
Converts session to a domain object and initializes domain . domain is only initialized if RESULT_OK is returned. More... | |
result_t | ipc_convert_to_multi (ipc_multi_session_t *multi, ipc_object_t *object) |
Converts a session to a multi session. | |
result_t | ipc_clone_current_object (ipc_object_t source, ipc_object_t *clone) |
Clones a session. | |
result_t | ipc_close (ipc_object_t object) |
Closes the object More... | |
result_t | ipc_close_domain (ipc_domain_t domain) |
Closes the whole domain More... | |
result_t | ipc_close_multi (ipc_multi_session_t *multi) |
Closes a multi session. More... | |
Variables | |
ipc_request_t | ipc_default_request |
An IPC request with default values set. More... | |
ipc_response_t | ipc_default_response |
An IPC response with default values set. More... | |
ipc_request_fmt_t | ipc_default_request_fmt |
An IPC request format with default values set. More... | |
ipc_response_fmt_t | ipc_default_response_fmt |
An IPC response format with default values set. More... | |
ipc_object_t | ipc_null_object |
An IPC object with default NULL values set. More... | |
ipc_debug_level_t | ipc_debug_level |
Default: IPC_DEBUG_LEVEL_NONE. | |
Interprocess Communication data structures and functions.
This file contains some of the types and functions required for IPC server functionality. The remaining functionality is found in ipcserver.h
enum ipc_debug_level_t |
result_t ipc_close | ( | ipc_object_t | object | ) |
Closes the object
object | Object to close |
result_t ipc_close_domain | ( | ipc_domain_t | domain | ) |
Closes the whole domain
domain | Domain to close |
result_t ipc_close_multi | ( | ipc_multi_session_t * | multi | ) |
Closes a multi session.
It is illegal to call this while any threads are still using the multi session.
result_t ipc_convert_to_domain | ( | ipc_object_t * | session, |
ipc_domain_t * | domain | ||
) |
Converts session
to a domain object and initializes domain
. domain
is only initialized if RESULT_OK is returned.
session | Object to convert to a domain object |
domain | Domain to initialize |
result_t ipc_pack_request | ( | uint32_t * | buffer, |
const ipc_request_t * | rq, | ||
ipc_object_t | object | ||
) |
Packs the IPC request described by rq
and object
into buffer
.
buffer | Target for marshalled IPC request |
rq | Request to pack |
object | Object to send the request to |
result_t ipc_pack_response | ( | uint32_t * | buffer, |
const ipc_response_t * | rs, | ||
struct ipc_server_object_t * | object | ||
) |
Packs the IPC response described by rs
and object
into buffer
.
Used by IPC server.
buffer | Target for marshalled IPC response |
rs | Response to pack |
object | Object to send the response from |
result_t ipc_send | ( | ipc_object_t | object, |
ipc_request_t * | rq, | ||
ipc_response_fmt_t * | rs | ||
) |
Send a request described by rq
to object
and then unpack the response.
object | Object to send request to |
rq | Request to send |
rs | Response expectations |
result_t ipc_unflatten_request | ( | ipc_message_t * | msg, |
ipc_request_fmt_t * | rs, | ||
struct ipc_server_object_t * | object | ||
) |
Unflattens the IPC request described by rq
from msg
It is expected that the decision for which object to dispatch to can be made based off of the fields in ipc_message_t alone, without having to unflatten it fully.
Used by IPC server.
msg | IPC message to unflatten |
rs | Format expectations for incoming request |
object | Object that the request is destined for. |
result_t ipc_unflatten_response | ( | ipc_message_t * | msg, |
ipc_response_fmt_t * | rs, | ||
ipc_object_t | object | ||
) |
Unflattens the IPC response described by rs
from msg
.
buffer | Marshalled IPC message |
rs | Response format expectations |
object | Object that the response was received from |
result_t ipc_unpack | ( | uint32_t * | buffer, |
ipc_message_t * | msg | ||
) |
Unpacks the IPC message from buffer
, filling out msg
.
buffer | Packed IPC message |
msg | Partially unpacked IPC message |
ipc_request_t ipc_default_request |
An IPC request with default values set.
type | Default: 4 |
num_buffers | Default: 0 |
buffers | Default: NULL |
request_id | Default: 0 |
raw_data | Default: 0 |
raw_data_size | Default: 0 |
send_pid | Default: 0 |
num_copy_handles | Default: 0 |
num_move_handles | Default: 0 |
num_objects | Default: 0 |
copy_handles | Default: NULL |
move_handles | Default: NULL |
objects | Default: NULL |
close_object | Default: false |
ipc_request_fmt_t ipc_default_request_fmt |
An IPC request format with default values set.
Used for IPC server.
ipc_response_t ipc_default_response |
An IPC response with default values set.
Used for IPC server.
ipc_response_fmt_t ipc_default_response_fmt |
An IPC response format with default values set.
num_copy_handles | Default: 0 |
num_move_handles | Default: 0 |
num_objects | Default: 0 |
copy_handles | Default: NULL |
move_handles | Default: NULL |
objects | Default: NULL |
raw_data_size | Default: 0 |
raw_data | Default: 0 |
has_pid | Default: false |
pid | Default: 0 |
ipc_object_t ipc_null_object |
An IPC object with default NULL values set.
session | Default: 0 |
object_id | Default: 1 |