1 /* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */
2 #ifndef LIBPLDM_OEM_META_FILE_IO_H
3 #define LIBPLDM_OEM_META_FILE_IO_H
4 
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8 
9 #include <stddef.h>
10 #include <stdint.h>
11 
12 struct pldm_msg;
13 /** @brief PLDM Commands in OEM META type
14  */
15 
16 enum pldm_oem_meta_fileio_commands {
17 	PLDM_OEM_META_FILEIO_CMD_WRITE_FILE = 0x2,
18 	PLDM_OEM_META_FILEIO_CMD_READ_FILE = 0x3,
19 };
20 
21 struct pldm_oem_meta_write_file_req {
22 	uint8_t file_handle;
23 	uint32_t length;
24 	uint8_t file_data[1];
25 };
26 
27 /** @brief Decode OEM meta file io req
28  *
29  *  @param[in] msg - Pointer to PLDM request message
30  *  @param[in] payload_length - Length of request payload
31  *  @param[out] file_handle - The handle of data
32  *  @param[out] length - Total size of data
33  *  @param[out] data - Message will be written to this
34  *  @return pldm_completion_codes
35  */
36 int decode_oem_meta_file_io_req(const struct pldm_msg *msg,
37 				size_t payload_length, uint8_t *file_handle,
38 				uint32_t *length, uint8_t *data);
39 
40 #ifdef __cplusplus
41 }
42 #endif
43 
44 #endif /*LIBPLDM_OEM_META_FILE_IO_H*/
45