MOS Source Code
Loading...
Searching...
No Matches
rpc_client.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-3.0-or-later
2// RPC library client-side definitions
3
4#pragma once
5
6#include <librpc/rpc.h>
7#include <mos/types.h>
8#include <stdarg.h>
9
10typedef struct rpc_server_stub rpc_server_stub_t;
11typedef struct rpc_call rpc_call_t;
12
13typedef struct
14{
15 void *data;
16 size_t size;
18
25MOSAPI rpc_server_stub_t *rpc_client_create(const char *server_name);
26
33
48MOSAPI rpc_result_code_t rpc_simple_call(rpc_server_stub_t *stub, u32 funcid, rpc_result_t *result, const char *argspec, ...);
49
60MOSAPI rpc_result_code_t rpc_simple_callv(rpc_server_stub_t *stub, u32 funcid, rpc_result_t *result, const char *argspec, va_list args);
61
70
79MOSAPI void rpc_call_arg(rpc_call_t *call, rpc_argtype_t argtype, const void *data, size_t size);
80
81MOSAPI void rpc_call_arg_u8(rpc_call_t *call, u8 arg);
83MOSAPI void rpc_call_arg_u32(rpc_call_t *call, u32 arg);
84MOSAPI void rpc_call_arg_u64(rpc_call_t *call, u64 arg);
85MOSAPI void rpc_call_arg_s8(rpc_call_t *call, s8 arg);
87MOSAPI void rpc_call_arg_s32(rpc_call_t *call, s32 arg);
88MOSAPI void rpc_call_arg_s64(rpc_call_t *call, s64 arg);
89MOSAPI void rpc_call_arg_string(rpc_call_t *call, const char *arg);
90
101MOSAPI rpc_result_code_t rpc_call_exec(rpc_call_t *call, void **result_data, size_t *result_size);
102
109
110typedef struct pb_msgdesc_s pb_msgdesc_t;
111
123MOSAPI 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);
124
125#define rpc_pb_call(stub, funcid, reqt, req, respt, resp) rpc_do_pb_call(stub, funcid, reqt##_fields, req, respt##_fields, resp)
char args[3][16]
Definition avr_io.c:16
#define MOSAPI
Definition mos_global.h:102
rpc_argtype_t
Definition rpc.h:9
rpc_result_code_t
Definition rpc.h:25
MOSAPI 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.
Definition rpc_client.c:231
MOSAPI 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.
Definition rpc_client.c:222
MOSAPI void rpc_call_arg_s8(rpc_call_t *call, s8 arg)
Definition rpc_client.c:135
MOSAPI void rpc_call_arg_u64(rpc_call_t *call, u64 arg)
Definition rpc_client.c:134
MOSAPI void rpc_call_arg_s16(rpc_call_t *call, s16 arg)
MOSAPI void rpc_call_arg_s64(rpc_call_t *call, s64 arg)
Definition rpc_client.c:137
MOSAPI void rpc_call_arg_s32(rpc_call_t *call, s32 arg)
Definition rpc_client.c:136
MOSAPI void rpc_call_arg_string(rpc_call_t *call, const char *arg)
Definition rpc_client.c:139
MOSAPI void rpc_call_destroy(rpc_call_t *call)
Destroy a call.
Definition rpc_client.c:103
MOSAPI rpc_call_t * rpc_call_create(rpc_server_stub_t *server, u32 function_id)
Manually create a new RPC call.
Definition rpc_client.c:88
MOSAPI rpc_server_stub_t * rpc_client_create(const char *server_name)
Create a new RPC client stub for the given server.
Definition rpc_client.c:65
MOSAPI rpc_result_code_t rpc_call_exec(rpc_call_t *call, void **result_data, size_t *result_size)
Execute a call.
Definition rpc_client.c:144
MOSAPI void rpc_client_destroy(rpc_server_stub_t *server)
Destroy a server stub.
Definition rpc_client.c:81
MOSAPI 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)
Definition rpc_client.c:298
MOSAPI void rpc_call_arg(rpc_call_t *call, rpc_argtype_t argtype, const void *data, size_t size)
Add an argument to a call.
Definition rpc_client.c:110
MOSAPI void rpc_call_arg_u32(rpc_call_t *call, u32 arg)
Definition rpc_client.c:133
MOSAPI void rpc_call_arg_u16(rpc_call_t *call, u16 arg)
MOSAPI void rpc_call_arg_u8(rpc_call_t *call, u8 arg)
Definition rpc_client.c:132
size_t size
Definition slab.c:30
void * data
Definition rpc_client.h:15
size_t size
Definition rpc_client.h:16
signed int s32
Definition types.h:15
unsigned int u32
Definition types.h:21
signed char s8
Definition types.h:13
signed long long int s64
Definition types.h:17
signed short s16
Definition types.h:14
unsigned short u16
Definition types.h:20
unsigned long long u64
Definition types.h:23
unsigned char u8
Definition types.h:19