nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches
ssf_client.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
7#ifndef SSF_CLIENT_H__
8#define SSF_CLIENT_H__
9
10#include <stddef.h>
11#include <stdint.h>
12
14
19 uint8_t *data;
20 size_t len;
21};
22
27typedef int (*request_encoder)(uint8_t *payload, size_t payload_len, void *input,
28 size_t *payload_len_out);
29
34typedef int (*response_decoder)(const uint8_t *payload, size_t payload_len, void *result,
35 size_t *payload_len_out);
36
41 /* Service ID (unique) */
42 uint16_t id;
43 /* Client's version number */
44 uint16_t version;
45 /* Request encoder */
47 /* Response decoder */
49 /* Request buffer size */
51};
52
62#define SSF_CLIENT_SERVICE_DEFINE(_name, _srvc_name, _req_encode, _rsp_decode) \
63 static const struct ssf_client_srvc _name = { \
64 .id = (CONFIG_SSF_##_srvc_name##_SERVICE_ID), \
65 .version = (CONFIG_SSF_##_srvc_name##_SERVICE_VERSION), \
66 .req_encode = (request_encoder)_req_encode, \
67 .rsp_decode = (response_decoder)_rsp_decode, \
68 .req_buf_size = (CONFIG_SSF_##_srvc_name##_SERVICE_BUFFER_SIZE) \
69 }
70
79
108int ssf_client_send_request(const struct ssf_client_srvc *srvc, void *req, void *decoded_rsp,
109 const uint8_t **rsp_pkt);
110
130 struct ssf_client_raw_data raw_req,
131 struct ssf_client_raw_data *raw_rsp);
132
143void ssf_client_decode_done(const uint8_t *rsp_pkt);
144
145#endif /* SSF_CLIENT_H__ */
int ssf_client_init(void)
Initialize SDFW Service Framework. This will initialize underlying transport and wait for remote doma...
int ssf_client_send_raw_request(const struct ssf_client_srvc *srvc, struct ssf_client_raw_data raw_req, struct ssf_client_raw_data *raw_rsp)
Send a raw byte string request and wait for a response.
int(* request_encoder)(uint8_t *payload, size_t payload_len, void *input, size_t *payload_len_out)
SSF request encode function prototype. Function of this type are typically generated from cddl with z...
Definition: ssf_client.h:27
int(* response_decoder)(const uint8_t *payload, size_t payload_len, void *result, size_t *payload_len_out)
SSF response decode function prototype. Function of this type are typically generated from cddl with ...
Definition: ssf_client.h:34
int ssf_client_send_request(const struct ssf_client_srvc *srvc, void *req, void *decoded_rsp, const uint8_t **rsp_pkt)
Send a request and wait for a response.
void ssf_client_decode_done(const uint8_t *rsp_pkt)
Free transport layer response buffer when decoding of response is finished.
uint8_t * data
Definition: ssf_client.h:19
size_t len
Definition: ssf_client.h:20
Structure to hold a raw request or response.
Definition: ssf_client.h:18
uint16_t version
Definition: ssf_client.h:44
request_encoder req_encode
Definition: ssf_client.h:46
uint16_t id
Definition: ssf_client.h:42
response_decoder rsp_decode
Definition: ssf_client.h:48
size_t req_buf_size
Definition: ssf_client.h:50
SSF service definition (client).
Definition: ssf_client.h:40