bios_table.hpp (29683b53872f96e68df2255be118c15997196b14) bios_table.hpp (d965934f04f9d9e0edd13f8bba1207fb2936712c)
1#pragma once
2
3#include <stdint.h>
4
5#include <filesystem>
1#pragma once
2
3#include <stdint.h>
4
5#include <filesystem>
6#include <optional>
6#include <string>
7#include <vector>
8
9#include "libpldm/bios.h"
10#include "libpldm/bios_table.h"
11
12namespace pldm
13{

--- 118 unchanged lines hidden (view full) ---

132
133 private:
134 Table stringTable;
135};
136
137namespace table
138{
139
7#include <string>
8#include <vector>
9
10#include "libpldm/bios.h"
11#include "libpldm/bios_table.h"
12
13namespace pldm
14{

--- 118 unchanged lines hidden (view full) ---

133
134 private:
135 Table stringTable;
136};
137
138namespace table
139{
140
141/** @brief Append Pad and Checksum
142 *
143 * @param[in,out] table - table to be appended with pad and checksum
144 */
145void appendPadAndChecksum(Table& table);
146
140namespace string
141{
142
143/** @brief Get the string handle for the entry
144 * @param[in] entry - Pointer to a bios string table entry
145 * @return Handle to identify a string in the bios string table
146 */
147uint16_t decodeHandle(const pldm_bios_string_table_entry* entry);
148
149/** @brief Get the string from the entry
150 * @param[in] entry - Pointer to a bios string table entry
151 * @return The String
152 */
153std::string decodeString(const pldm_bios_string_table_entry* entry);
154
147namespace string
148{
149
150/** @brief Get the string handle for the entry
151 * @param[in] entry - Pointer to a bios string table entry
152 * @return Handle to identify a string in the bios string table
153 */
154uint16_t decodeHandle(const pldm_bios_string_table_entry* entry);
155
156/** @brief Get the string from the entry
157 * @param[in] entry - Pointer to a bios string table entry
158 * @return The String
159 */
160std::string decodeString(const pldm_bios_string_table_entry* entry);
161
162/** @brief construct entry of string table at the end of the given
163 * table
164 * @param[in,out] table - The given table
165 * @param[in] str - string itself
166 * @return pointer to the constructed entry
167 */
168const pldm_bios_string_table_entry* constructEntry(Table& table,
169 const std::string& str);
170
155} // namespace string
156
157namespace attribute
158{
159
160/** @struct TableHeader
161 * @brief Header of attribute table
162 */

--- 5 unchanged lines hidden (view full) ---

168};
169
170/** @brief Decode header of attribute table entry
171 * @param[in] entry - Pointer to an attribute table entry
172 * @return Attribute table header
173 */
174TableHeader decodeHeader(const pldm_bios_attr_table_entry* entry);
175
171} // namespace string
172
173namespace attribute
174{
175
176/** @struct TableHeader
177 * @brief Header of attribute table
178 */

--- 5 unchanged lines hidden (view full) ---

184};
185
186/** @brief Decode header of attribute table entry
187 * @param[in] entry - Pointer to an attribute table entry
188 * @return Attribute table header
189 */
190TableHeader decodeHeader(const pldm_bios_attr_table_entry* entry);
191
192/** @brief Find attribute entry by handle
193 * @param[in] table - attribute table
194 * @param[in] handle - attribute handle
195 * @return Pointer to the attribute table entry
196 */
197const pldm_bios_attr_table_entry* findByHandle(const Table& table,
198 uint16_t handle);
199
176/** @struct StringField
177 * @brief String field of attribute table
178 */
179struct StringField
180{
181 uint8_t stringType;
182 uint16_t minLength;
183 uint16_t maxLength;

--- 50 unchanged lines hidden (view full) ---

234 * @param[in] attrType - attribute type
235 * @param[in] str - The string
236 * @return Pointer to the constructed entry
237 */
238const pldm_bios_attr_val_table_entry*
239 constructStringEntry(Table& table, uint16_t attrHandle, uint8_t attrType,
240 const std::string& str);
241
200/** @struct StringField
201 * @brief String field of attribute table
202 */
203struct StringField
204{
205 uint8_t stringType;
206 uint16_t minLength;
207 uint16_t maxLength;

--- 50 unchanged lines hidden (view full) ---

258 * @param[in] attrType - attribute type
259 * @param[in] str - The string
260 * @return Pointer to the constructed entry
261 */
262const pldm_bios_attr_val_table_entry*
263 constructStringEntry(Table& table, uint16_t attrHandle, uint8_t attrType,
264 const std::string& str);
265
266/** @brief construct a table with an new entry
267 * @param[in] table - the table need to be updated
268 * @param[in] entry - the new attribute value entry
269 * @param[in] size - size of the new entry
270 * @return newly constructed table, std::nullopt if failed
271 */
272std::optional<Table> updateTable(const Table& table, const void* entry,
273 size_t size);
274
242} // namespace attribute_value
243
244} // namespace table
245
246} // namespace bios
247} // namespace responder
248} // namespace pldm
275} // namespace attribute_value
276
277} // namespace table
278
279} // namespace bios
280} // namespace responder
281} // namespace pldm