blob: 378175512853a8aa04a09a49747467a0895fb16c [file] [log] [blame]
Andrew Jeffery9a6ba892023-07-18 22:22:14 +09301/* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */
2#ifndef LIBPLDM_TRANSPORT_TEST_H
3#define LIBPLDM_TRANSPORT_TEST_H
4
Andrew Jefferyefb40062023-11-10 13:48:39 +10305#include <libpldm/base.h>
Andrew Jeffery9a6ba892023-07-18 22:22:14 +09306
7#include <stddef.h>
8#include <stdint.h>
9#include <sys/timerfd.h>
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15enum pldm_transport_test_element {
16 PLDM_TRANSPORT_TEST_ELEMENT_MSG_SEND,
17 PLDM_TRANSPORT_TEST_ELEMENT_MSG_RECV,
18 PLDM_TRANSPORT_TEST_ELEMENT_LATENCY,
19};
20
21struct pldm_transport_test_msg_send {
22 pldm_tid_t dst;
23 const void *msg;
24 size_t len;
25};
26
27struct pldm_transport_test_msg_recv {
28 pldm_tid_t src;
29 const void *msg;
30 size_t len;
31};
32
33struct pldm_transport_test_descriptor {
34 enum pldm_transport_test_element type;
35 union {
36 struct pldm_transport_test_msg_send send_msg;
37 struct pldm_transport_test_msg_recv recv_msg;
38 struct itimerspec latency;
39 };
40};
41
42struct pldm_transport_test;
43
44int pldm_transport_test_init(struct pldm_transport_test **ctx,
45 const struct pldm_transport_test_descriptor *seq,
46 size_t count);
47void pldm_transport_test_destroy(struct pldm_transport_test *ctx);
48struct pldm_transport *
49pldm_transport_test_core(struct pldm_transport_test *ctx);
50
51#if PLDM_HAS_POLL
52struct pollfd;
53int pldm_transport_test_init_pollfd(struct pldm_transport *ctx,
54 struct pollfd *pollfd);
55#endif
56
57#ifdef __cplusplus
58}
59#endif
60
61#endif