MOS Source Code
|
Go to the source code of this file.
Classes | |
struct | rpc_function_info_t |
Macros | |
#define | RPC_MAX_ARGS 16 |
Typedefs | |
typedef struct _rpc_server | rpc_server_t |
typedef void(* | rpc_server_on_connect_t) (rpc_context_t *context) |
typedef void(* | rpc_server_on_disconnect_t) (rpc_context_t *context) |
typedef rpc_result_code_t(* | rpc_function_t) (rpc_context_t *context) |
Functions | |
MOSAPI rpc_server_t * | rpc_server_create (const char *server_name, void *data) |
Create a new RPC server. | |
MOSAPI void | rpc_server_set_on_connect (rpc_server_t *server, rpc_server_on_connect_t on_connect) |
Sets the callback function to be called when a client connects to the RPC server. | |
MOSAPI void | rpc_server_set_on_disconnect (rpc_server_t *server, rpc_server_on_disconnect_t on_disconnect) |
Sets the callback function to be called when a client disconnects from the RPC server. | |
MOSAPI void | rpc_server_set_data (rpc_server_t *server, void *data) |
Set the user data for the server. | |
MOSAPI void * | rpc_server_get_data (rpc_server_t *server) |
Get the user data for the server. | |
MOSAPI void | rpc_server_exec (rpc_server_t *server) |
Run the server, this function will not return until the server is destroyed. | |
MOSAPI bool | rpc_server_register_functions (rpc_server_t *server, const rpc_function_info_t *functions, size_t count) |
Register multiple functions with the server. | |
MOSAPI void | rpc_server_close (rpc_server_t *server) |
Close the RPC server. | |
MOSAPI void | rpc_server_destroy (rpc_server_t *server) |
Destroy the RPC server. | |
MOSAPI void * | rpc_context_get_data (const rpc_context_t *context) |
Get the context data for an RPC context. | |
MOSAPI void * | rpc_context_set_data (rpc_context_t *context, void *data) |
Set the context data for an RPC client. | |
MOSAPI rpc_server_t * | rpc_context_get_server (const rpc_context_t *context) |
Get the RPC server instance for an RPC call context. | |
MOSAPI int | rpc_context_get_function_id (const rpc_context_t *context) |
Get the function ID for an RPC call context. | |
MOSAPI const void * | rpc_arg_next (rpc_context_t *args, size_t *size) |
Iterate to the next argument. | |
MOSAPI const void * | rpc_arg_sized_next (rpc_context_t *context, size_t expected_size) |
Iterate to the next argument, and check that the size is as expected. | |
MOSAPI u8 | rpc_arg_next_u8 (rpc_context_t *args) |
MOSAPI u16 | rpc_arg_next_u16 (rpc_context_t *args) |
MOSAPI u32 | rpc_arg_next_u32 (rpc_context_t *args) |
MOSAPI u64 | rpc_arg_next_u64 (rpc_context_t *args) |
MOSAPI s8 | rpc_arg_next_s8 (rpc_context_t *args) |
MOSAPI s16 | rpc_arg_next_s16 (rpc_context_t *args) |
MOSAPI s32 | rpc_arg_next_s32 (rpc_context_t *args) |
MOSAPI s64 | rpc_arg_next_s64 (rpc_context_t *args) |
MOSAPI const char * | rpc_arg_next_string (rpc_context_t *context) |
MOSAPI const void * | rpc_arg (const rpc_context_t *context, size_t iarg, rpc_argtype_t type, size_t *argsize) |
MOSAPI u8 | rpc_arg_u8 (const rpc_context_t *context, size_t iarg) |
MOSAPI u16 | rpc_arg_u16 (const rpc_context_t *context, size_t iarg) |
MOSAPI u32 | rpc_arg_u32 (const rpc_context_t *context, size_t iarg) |
MOSAPI u64 | rpc_arg_u64 (const rpc_context_t *context, size_t iarg) |
MOSAPI s8 | rpc_arg_s8 (const rpc_context_t *context, size_t iarg) |
MOSAPI s16 | rpc_arg_s16 (const rpc_context_t *context, size_t iarg) |
MOSAPI s32 | rpc_arg_s32 (const rpc_context_t *context, size_t iarg) |
MOSAPI s64 | rpc_arg_s64 (const rpc_context_t *context, size_t iarg) |
MOSAPI const char * | rpc_arg_string (const rpc_context_t *context, size_t iarg) |
MOSAPI void | rpc_write_result (rpc_context_t *context, const void *data, size_t size) |
Write a result to the reply. | |
MOSAPI bool | rpc_arg_pb (rpc_context_t *context, const pb_msgdesc_t *type_fields, void *val, size_t argid) |
MOSAPI void | rpc_write_result_pb (rpc_context_t *context, const pb_msgdesc_t *type_fields, const void *val) |
#define RPC_MAX_ARGS 16 |
Definition at line 10 of file rpc_server.h.
Referenced by rpc_handle_client().
typedef struct _rpc_server rpc_server_t |
Definition at line 12 of file rpc_server.h.
typedef void(* rpc_server_on_connect_t) (rpc_context_t *context) |
Definition at line 15 of file rpc_server.h.
typedef void(* rpc_server_on_disconnect_t) (rpc_context_t *context) |
Definition at line 16 of file rpc_server.h.
typedef rpc_result_code_t(* rpc_function_t) (rpc_context_t *context) |
Definition at line 17 of file rpc_server.h.
MOSAPI rpc_server_t * rpc_server_create | ( | const char * | server_name, |
void * | data ) |
Create a new RPC server.
server_name | The name of the server |
data | A pointer to user data, which will be passed to the function |
Definition at line 213 of file rpc_server.c.
Referenced by RPCServer::RPCServer(), and userfs_manager_server_exec().
MOSAPI void rpc_server_set_on_connect | ( | rpc_server_t * | server, |
rpc_server_on_connect_t | on_connect ) |
Sets the callback function to be called when a client connects to the RPC server.
server | The RPC server instance. |
on_connect | The callback function to be called when a client connects. |
Definition at line 236 of file rpc_server.c.
Referenced by RPCServer::RPCServer().
MOSAPI void rpc_server_set_on_disconnect | ( | rpc_server_t * | server, |
rpc_server_on_disconnect_t | on_disconnect ) |
Sets the callback function to be called when a client disconnects from the RPC server.
server | The RPC server instance. |
on_disconnect | The callback function to be called when a client disconnects. |
Definition at line 241 of file rpc_server.c.
Referenced by RPCServer::RPCServer().
MOSAPI void rpc_server_set_data | ( | rpc_server_t * | server, |
void * | data ) |
Set the user data for the server.
server | The server to set the data for |
data | The data to set |
Definition at line 261 of file rpc_server.c.
MOSAPI void * rpc_server_get_data | ( | rpc_server_t * | server | ) |
Get the user data for the server.
server | The server to get the data for |
Definition at line 266 of file rpc_server.c.
Referenced by RPCServer::RPCServer().
MOSAPI void rpc_server_exec | ( | rpc_server_t * | server | ) |
Run the server, this function will not return until the server is destroyed.
server | The server to run |
Definition at line 271 of file rpc_server.c.
Referenced by RPCServer::run(), and userfs_manager_server_exec().
MOSAPI bool rpc_server_register_functions | ( | rpc_server_t * | server, |
const rpc_function_info_t * | functions, | ||
size_t | count ) |
Register multiple functions with the server.
server | The server to register the functions with |
functions | An array of function info structures |
count | The number of functions to register |
Definition at line 299 of file rpc_server.c.
Referenced by RPCServer::RPCServer(), and userfs_manager_server_exec().
MOSAPI void rpc_server_close | ( | rpc_server_t * | server | ) |
Close the RPC server.
server | The server to close |
Definition at line 246 of file rpc_server.c.
Referenced by RPCServer::~RPCServer().
MOSAPI void rpc_server_destroy | ( | rpc_server_t * | server | ) |
Destroy the RPC server.
server | The server to destroy |
Definition at line 252 of file rpc_server.c.
Get the context data for an RPC context.
context | The context to get the data for |
Definition at line 308 of file rpc_server.c.
Referenced by RPCServer::get_data().
Set the context data for an RPC client.
context | The context to set the data for |
data | The data to set |
Definition at line 313 of file rpc_server.c.
Referenced by RPCServer::set_data().
MOSAPI rpc_server_t * rpc_context_get_server | ( | const rpc_context_t * | context | ) |
Get the RPC server instance for an RPC call context.
context | The context to get the server for |
Definition at line 320 of file rpc_server.c.
Referenced by RPCServer::RPCServer().
Get the function ID for an RPC call context.
context | The context to get the function ID for |
Definition at line 325 of file rpc_server.c.
Referenced by RPCServer::RPCServer().
Iterate to the next argument.
args | The argument iterator |
size | A pointer to the size of the argument |
Definition at line 332 of file rpc_server.c.
Referenced by rpc_arg_next_string(), and rpc_arg_sized_next().
Iterate to the next argument, and check that the size is as expected.
context | The RPC call context |
expected_size | The expected size of the argument |
Definition at line 354 of file rpc_server.c.
Definition at line 369 of file rpc_server.c.
Definition at line 370 of file rpc_server.c.
Definition at line 371 of file rpc_server.c.
Definition at line 372 of file rpc_server.c.
Definition at line 373 of file rpc_server.c.
Definition at line 374 of file rpc_server.c.
Definition at line 375 of file rpc_server.c.
Definition at line 376 of file rpc_server.c.
MOSAPI const char * rpc_arg_next_string | ( | rpc_context_t * | context | ) |
MOSAPI const void * rpc_arg | ( | const rpc_context_t * | context, |
size_t | iarg, | ||
rpc_argtype_t | type, | ||
size_t * | argsize ) |
Definition at line 383 of file rpc_server.c.
Referenced by rpc_arg_pb(), and rpc_arg_string().
Definition at line 408 of file rpc_server.c.
Definition at line 409 of file rpc_server.c.
Definition at line 410 of file rpc_server.c.
Definition at line 411 of file rpc_server.c.
Definition at line 412 of file rpc_server.c.
Definition at line 413 of file rpc_server.c.
Definition at line 414 of file rpc_server.c.
Definition at line 415 of file rpc_server.c.
Write a result to the reply.
context | The RPC call context |
data | The data to write |
size | The size of the data to write |
Definition at line 422 of file rpc_server.c.
Referenced by rpc_write_result_pb().