1 /*
2  * Copyright (c) 2023 Legrand North America, LLC.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef ZEPHYR_TESTS_SUBSYS_TESTSUITE_FFF_FAKE_CONTEXTS_INCLUDE_ZEPHYR_CALLED_API_H_
8 #define ZEPHYR_TESTS_SUBSYS_TESTSUITE_FFF_FAKE_CONTEXTS_INCLUDE_ZEPHYR_CALLED_API_H_
9 
10 #include <errno.h>
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 /* A container struct for hidden instance data */
17 struct called_API_info;
18 
19 /**
20  * @brief Provide an instance handle to a session of the called_API.
21  *
22  * This API is defined for the code_under_test() example to call.
23  * It represents a routine which provides call-unique data to the caller
24  * as well as providing a return value.  This requires the _custom_fake
25  * implementation to serve the data from a custom_fake context struture,
26  * where each call needs to return a unique, configured value.
27  *
28  * @param instance_out Session instance handle for caller to use.
29  *
30  * @return zero(0) upon success, with *instance_out updated.
31  * @return -EINVAL if invalid parameter(s)
32  * @return -E2BIG  if more calls were made than expected.
33  */
34 int called_API_open(const struct called_API_info **instance_out);
35 
36 /**
37  * @brief Return an instance handle to a session of the called_API.
38  *
39  * This API is defined for the code_under_test() example to call.
40  * It represents a routine which requires specific data from the caller
41  * as well as providing a return value.  This is defined to
42  * have the code_under_test call multiple functions to illustrate
43  * a way to verify a specific calling sequence was made
44  *
45  * @param instance Session instance handle provided by called_API_open
46  *
47  * @return zero(0) upon success, with instance invalidated.
48  * @return -EINVAL if invalid parameter(s)
49  * @return -E2BIG  if more calls were made than expected.
50  */
51 int called_API_close(const struct called_API_info *instance);
52 
53 #ifdef __cplusplus
54 }
55 #endif
56 
57 #endif /* ZEPHYR_TESTS_SUBSYS_TESTSUITE_FFF_FAKE_CONTEXTS_INCLUDE_ZEPHYR_CALLED_API_H_ */
58