blob: 966a2dfe3fb6ab5286054c46ac50d3ad461c225a [file] [log] [blame]
Jeremy Kerr3d36ee22019-05-30 11:15:37 +08001/* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */
2
Jeremy Kerr18925112019-03-13 15:43:08 +08003#ifndef _MCTP_TESTS_TEST_UTILS_H
4#define _MCTP_TESTS_TEST_UTILS_H
5
6#include <libmctp.h>
7
Jeremy Kerr1a4ec3c2019-09-03 11:01:50 +08008#ifndef container_of
9#define container_of(ptr, type, member) \
10 (type *)((char *)(ptr) - (char *)&((type *)0)->member)
11#endif
12
Jeremy Kerr18925112019-03-13 15:43:08 +080013/* test binding implementation */
14
15/* standard binding interface */
16struct mctp_binding_test *mctp_binding_test_init(void);
17void mctp_binding_test_register_bus(struct mctp_binding_test *binding,
18 struct mctp *mctp, mctp_eid_t eid);
19
20/* internal test binding interface */
21void mctp_binding_test_rx_raw(struct mctp_binding_test *test,
22 void *buf, size_t len);
23
24/* gerneral utility functions */
25
26/* create a MCTP stack, and add a test binding, using the specified EID */
27void mctp_test_stack_init(struct mctp **mctp,
28 struct mctp_binding_test **binding,
29 mctp_eid_t eid);
30
31#endif /* _MCTP_TESTS_TEST_UTILS_H */