MOS Source Code
|
#include "librpc/rpc_client.h"
#include "librpc/internal.h"
#include "librpc/rpc.h"
#include <libipc/ipc.h>
#include <mos/types.h>
#include <pb_decode.h>
#include <pb_encode.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <mos/syscall/usermode.h>
#include <pthread.h>
Go to the source code of this file.
Classes | |
struct | rpc_server_stub_t |
struct | rpc_call_t |
Macros | |
#define | memzero(ptr, size) |
#define | mutex_acquire(mutex) |
#define | mutex_release(mutex) |
#define | mos_warn(...) |
#define | MOS_LIB_UNREACHABLE() |
#define | RPC_CLIENT_SMH_SIZE MOS_PAGE_SIZE |
#define | RPC_CALL_ARG_IMPL(type, TYPE) |
Typedefs | |
typedef pthread_mutex_t | mutex_t |
Functions | |
rpc_server_stub_t * | rpc_client_create (const char *server_name) |
Create a new RPC client stub for the given server. | |
void | rpc_client_destroy (rpc_server_stub_t *server) |
Destroy a server stub. | |
rpc_call_t * | rpc_call_create (rpc_server_stub_t *server, u32 function_id) |
Manually create a new RPC call. | |
void | rpc_call_destroy (rpc_call_t *call) |
Destroy a call. | |
void | rpc_call_arg (rpc_call_t *call, rpc_argtype_t argtype, const void *data, size_t size) |
Add an argument to a call. | |
void | rpc_call_arg_u8 (rpc_call_t *call, u8 arg) |
void | rpc_call_arg_u32 (rpc_call_t *call, u32 arg) |
void | rpc_call_arg_u64 (rpc_call_t *call, u64 arg) |
void | rpc_call_arg_s8 (rpc_call_t *call, s8 arg) |
void | rpc_call_arg_s32 (rpc_call_t *call, s32 arg) |
void | rpc_call_arg_s64 (rpc_call_t *call, s64 arg) |
void | rpc_call_arg_string (rpc_call_t *call, const char *arg) |
rpc_result_code_t | rpc_call_exec (rpc_call_t *call, void **result_data, size_t *data_size) |
Execute a call. | |
rpc_result_code_t | rpc_simple_call (rpc_server_stub_t *stub, u32 funcid, rpc_result_t *result, const char *argspec,...) |
Call a function on the server. | |
rpc_result_code_t | rpc_simple_callv (rpc_server_stub_t *stub, u32 funcid, rpc_result_t *result, const char *argspec, va_list args) |
Call a function on the server. | |
rpc_result_code_t | rpc_do_pb_call (rpc_server_stub_t *stub, u32 funcid, const pb_msgdesc_t *reqm, const void *req, const pb_msgdesc_t *respm, void *resp) |
Call a function on the server using protobuf (nanopb) | |
#define memzero | ( | ptr, | |
size ) |
Definition at line 40 of file rpc_client.c.
Referenced by bitmap_zero(), elf_map_segment(), hashmap_init(), mm_get_free_page(), pagetable_iter_init(), pmm_init(), process_do_execveat(), rpc_call_create(), rpc_client_create(), waitlist_init(), x86_cpu_initialise_caps(), x86_init_percpu_gdt(), x86_init_percpu_tss(), and zero_page().
#define mutex_acquire | ( | mutex | ) |
Definition at line 41 of file rpc_client.c.
Referenced by do_pagecache_flush(), inode_try_drop(), rpc_call_arg(), rpc_call_destroy(), rpc_call_exec(), rpc_client_destroy(), vfs_fault_handler(), vfs_read_pagecache(), and vfs_write_pagecache().
#define mutex_release | ( | mutex | ) |
Definition at line 42 of file rpc_client.c.
Referenced by do_pagecache_flush(), inode_try_drop(), rpc_call_arg(), rpc_call_exec(), vfs_fault_handler(), vfs_read_pagecache(), and vfs_write_pagecache().
#define mos_warn | ( | ... | ) |
Definition at line 43 of file rpc_client.c.
Referenced by rpc_simple_callv().
#define MOS_LIB_UNREACHABLE | ( | ) |
Definition at line 44 of file rpc_client.c.
Referenced by printf_diouxX(), rpc_simple_callv(), and vsnprintf().
#define RPC_CLIENT_SMH_SIZE MOS_PAGE_SIZE |
Definition at line 47 of file rpc_client.c.
Referenced by rpc_client_create().
#define RPC_CALL_ARG_IMPL | ( | type, | |
TYPE ) |
Definition at line 126 of file rpc_client.c.
typedef pthread_mutex_t mutex_t |
Definition at line 39 of file rpc_client.c.
rpc_server_stub_t * rpc_client_create | ( | const char * | server_name | ) |
Create a new RPC client stub for the given server.
server_name | The name of the server to connect to |
Definition at line 65 of file rpc_client.c.
Referenced by userfs_ensure_connected().
void rpc_client_destroy | ( | rpc_server_stub_t * | server | ) |
Destroy a server stub.
server | The server stub to destroy |
Definition at line 81 of file rpc_client.c.
rpc_call_t * rpc_call_create | ( | rpc_server_stub_t * | server, |
u32 | function_id ) |
Manually create a new RPC call.
server | The server stub to call |
function_id | The function ID to call |
Definition at line 88 of file rpc_client.c.
Referenced by rpc_do_pb_call(), and rpc_simple_callv().
void rpc_call_destroy | ( | rpc_call_t * | call | ) |
Destroy a call.
call | The call to destroy |
Definition at line 103 of file rpc_client.c.
Referenced by rpc_do_pb_call(), and rpc_simple_callv().
void rpc_call_arg | ( | rpc_call_t * | call, |
rpc_argtype_t | argtype, | ||
const void * | data, | ||
size_t | size ) |
Add an argument to a call.
call | The call to add the argument to |
argtype | The type of the argument |
data | A pointer to the argument data |
size | The size of the argument data |
Definition at line 110 of file rpc_client.c.
Referenced by rpc_call_arg_string(), rpc_do_pb_call(), and rpc_simple_callv().
void rpc_call_arg_u8 | ( | rpc_call_t * | call, |
u8 | arg ) |
Definition at line 132 of file rpc_client.c.
void rpc_call_arg_u32 | ( | rpc_call_t * | call, |
u32 | arg ) |
Definition at line 133 of file rpc_client.c.
void rpc_call_arg_u64 | ( | rpc_call_t * | call, |
u64 | arg ) |
Definition at line 134 of file rpc_client.c.
void rpc_call_arg_s8 | ( | rpc_call_t * | call, |
s8 | arg ) |
Definition at line 135 of file rpc_client.c.
void rpc_call_arg_s32 | ( | rpc_call_t * | call, |
s32 | arg ) |
Definition at line 136 of file rpc_client.c.
void rpc_call_arg_s64 | ( | rpc_call_t * | call, |
s64 | arg ) |
Definition at line 137 of file rpc_client.c.
void rpc_call_arg_string | ( | rpc_call_t * | call, |
const char * | arg ) |
rpc_result_code_t rpc_call_exec | ( | rpc_call_t * | call, |
void ** | result_data, | ||
size_t * | result_size ) |
Execute a call.
call | The call to execute |
result_data | A pointer to a pointer to the result data, or NULL if no result is expected |
result_size | A pointer to the size of the result data, or NULL if no result is expected |
Definition at line 144 of file rpc_client.c.
Referenced by rpc_do_pb_call(), and rpc_simple_callv().
rpc_result_code_t rpc_simple_call | ( | rpc_server_stub_t * | stub, |
u32 | funcid, | ||
rpc_result_t * | result, | ||
const char * | argspec, | ||
... ) |
Call a function on the server.
stub | The server stub to call |
funcid | The function ID to call |
result | A pointer to a result structure, or NULL if no result is expected |
argspec | An argument specification string, see spec.md for details |
... | The arguments to the function |
Definition at line 222 of file rpc_client.c.
rpc_result_code_t rpc_simple_callv | ( | rpc_server_stub_t * | stub, |
u32 | funcid, | ||
rpc_result_t * | result, | ||
const char * | argspec, | ||
va_list | args ) |
Call a function on the server.
stub | The server stub to call |
funcid | The function ID to call |
result | A pointer to a result structure, or NULL if no result is expected |
argspec | An argument specification string, see spec.md for details |
args | The arguments to the function |
Definition at line 231 of file rpc_client.c.
Referenced by rpc_simple_call().
rpc_result_code_t rpc_do_pb_call | ( | rpc_server_stub_t * | stub, |
u32 | funcid, | ||
const pb_msgdesc_t * | reqm, | ||
const void * | req, | ||
const pb_msgdesc_t * | respm, | ||
void * | resp ) |
Call a function on the server using protobuf (nanopb)
stub | The server stub to call |
funcid | The function ID to call |
reqm | The protobuf message descriptor for the request |
req | The request message |
respm | The protobuf message descriptor for the response |
resp | The response message |
Definition at line 298 of file rpc_client.c.