1 /* 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 5 #include <libpldm/base.h> 6 7 #include <stddef.h> 8 #include <stdint.h> 9 #include <sys/timerfd.h> 10 11 #ifdef __cplusplus 12 extern "C" { 13 #endif 14 15 enum 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 21 struct pldm_transport_test_msg_send { 22 pldm_tid_t dst; 23 const void *msg; 24 size_t len; 25 }; 26 27 struct pldm_transport_test_msg_recv { 28 pldm_tid_t src; 29 const void *msg; 30 size_t len; 31 }; 32 33 struct 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 42 struct pldm_transport_test; 43 44 int pldm_transport_test_init(struct pldm_transport_test **ctx, 45 const struct pldm_transport_test_descriptor *seq, 46 size_t count); 47 void pldm_transport_test_destroy(struct pldm_transport_test *ctx); 48 struct pldm_transport * 49 pldm_transport_test_core(struct pldm_transport_test *ctx); 50 51 #if PLDM_HAS_POLL 52 struct pollfd; 53 int 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 62