• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * This file is part of the openHiTLS project.
3  *
4  * openHiTLS is licensed under the Mulan PSL v2.
5  * You can use this software according to the terms and conditions of the Mulan PSL v2.
6  * You may obtain a copy of Mulan PSL v2 at:
7  *
8  *     http://license.coscl.org.cn/MulanPSL2
9  *
10  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
11  * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
12  * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
13  * See the Mulan PSL v2 for more details.
14  */
15 
16 #ifndef FRAME_IO_H
17 #define FRAME_IO_H
18 
19 #include "bsl_errno.h"
20 #include "bsl_uio.h"
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 #define MAX_RECORD_LENTH (20 * 1024) // Simulates the bottom-layer sending and receiving processing of the DT framework.
27 
28 typedef struct FrameUioUserData_ FrameUioUserData;
29 
30 /**
31  * @brief SCTP bottom-layer I/O function, which is used to simulate the SCTP message sending interface.
32  *
33  * @par Description:
34  * SCTP bottom-layer I/O function, which is used to simulate the SCTP message sending interface.
35  *
36  * @attention
37  * @return If the operation is successful, success is returned. Otherwise, other values are returned. In this framework,
38  *         a success message is returned without special reasons.
39  */
40 int32_t FRAME_Write(BSL_UIO *uio, const void *buf, uint32_t len, uint32_t *writeLen);
41 
42 
43 /**
44  * @brief SCTP bottom-layer I/O function, which is used to simulate the SCTP message receiving interface.
45  *
46  * @par Description:
47  * SCTP bottom-layer I/O function, which is used to simulate the SCTP message receiving interface.
48  *
49  * @attention
50  * @return If the operation is successful, success is returned. Otherwise, other values are returned.
51  */
52 int32_t FRAME_Read(BSL_UIO *uio, void *buf, uint32_t len, uint32_t *readLen);
53 
54 
55 /**
56  * @brief SCTP bottom-layer I/O function, which is used to simulate the SCTP control interface.
57  *
58  * @par Description:
59  * SCTP bottom-layer I/O function, which is used to simulate the SCTP control interface.
60  *
61  * @attention
62  * @return If the operation is successful, success is returned. Otherwise, other values are returned.
63  */
64 int32_t FRAME_Ctrl(BSL_UIO *uio, int32_t cmd, int32_t larg, void *param);
65 
66 /**
67 * @brief  Create a UIO user data. The user data must be used when the I/O of the test framework is used. The user data
68 *         stores the data to be sent and received by the I/O.
69 *
70 * @return If the operation is successful, the pointer of userdata is returned.
71 */
72 FrameUioUserData *FRAME_IO_CreateUserData(void);
73 
74 /**
75 * @brief  Releases userdata created by the Frame_IO_CreateUserData function.
76 *
77 * @return  NA
78 */
79 void FRAME_IO_FreeUserData(FrameUioUserData *userData);
80 
81 /**
82 * @brief  Frame_TransportSendMsg sends the messages in the sending buffer in the I/O.
83 *
84 * @return  If the operation is successful, 0 is returned. Otherwise, another value is returned.
85 */
86 int32_t FRAME_TransportSendMsg(BSL_UIO *uio, void *buf, uint32_t len, uint32_t *readLen);
87 
88 /**
89 * @brief  Frame_TransportRecMsg simulates receiving messages from the I/O.
90 *
91 * @return  If the operation is successful, 0 is returned. Otherwise, another value is returned.
92 */
93 int32_t FRAME_TransportRecMsg(BSL_UIO *uio, void *buf, uint32_t len);
94 #ifdef __cplusplus
95 }
96 #endif
97 
98 #endif // FRAME_IO_H
99