1 /*
2  * Copyright (C) 2020 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <interface/coverage/aggregator.h>
20 #include <interface/coverage/client.h>
21 #include <lk/compiler.h>
22 #include <stdint.h>
23 #include <trusty_ipc.h>
24 
25 __BEGIN_CDECLS
26 
27 /**
28  * coverage_send() - send a buffer and a handle
29  * @chan:    channel to send message over
30  * @msg:     buffer containing message
31  * @msg_len: length of @msg
32  * @h:       pointer to handle to be sent
33  *
34  * Return: 0 on success, negative error code on error
35  */
36 int coverage_send(handle_t chan, void* msg, size_t msg_len, handle_t* h);
37 
38 /**
39  * coverage_recv() - receive a buffers and a handle
40  * @chan:    channel to receive message over
41  * @msg:     buffer containing message
42  * @msg_len: length of @msg
43  * @h:       pointer to handle to be received
44  *
45  * Return: 0 on success, negative error code on error
46  */
47 int coverage_recv(handle_t chan, void* msg, size_t msg_len, handle_t* h);
48 
49 /**
50  * coverage_aggregator_rpc() - make an RPC to coverage aggregator
51  * @chan:   channel to perform RPC over
52  * @req:    request to be sent
53  * @req_h:  pointer to handle to be sent
54  * @resp:   response to be received
55  * @resp_h: pointer to handle to be received
56  *
57  * Return: 0 on success, negative error code on error
58  */
59 int coverage_aggregator_rpc(handle_t chan,
60                             struct coverage_aggregator_req* req,
61                             handle_t* req_h,
62                             struct coverage_aggregator_resp* resp,
63                             handle_t* resp_h);
64 
65 /**
66  * coverage_client_rpc() - make an RPC to coverage client
67  * @chan:   channel to perform RPC over
68  * @req:    request to be sent
69  * @req_h:  pointer to handle to be sent
70  * @resp:   response to be received
71  * @resp_h: pointer to handle to be received
72  *
73  * Return: 0 on success, negative error code on error
74  */
75 int coverage_client_rpc(handle_t chan,
76                         struct coverage_client_req* req,
77                         handle_t* req_h,
78                         struct coverage_client_resp* resp,
79                         handle_t* resp_h);
80 
81 __END_CDECLS
82