blob: 2d72740bf1ddbbfdc6a727398e89837d24d00e8a [file] [log] [blame]
Ben Tyner188f1092021-02-01 09:33:06 -06001#pragma once
2
3#include <sdbusplus/bus.hpp>
4#include <util/ffdc_file.hpp>
5
6#include <string>
7
8namespace attn
9{
10
11/**
Ben Tyner5c5db652021-02-22 18:22:35 -060012 * Create a dbus method
13 *
14 * Find the dbus service associated with the dbus object path and create
15 * a dbus method for calling the specified dbus interface and function.
16 *
17 * @param i_path - dbus object path
18 * @param i_interface - dbus method interface
19 * @param i_function - dbus interface function
20 * @param o_method - method that is created
Ben Tyner5c5db652021-02-22 18:22:35 -060021 * @return non-zero if error
22 *
23 **/
24int dbusMethod(const std::string& i_path, const std::string& i_interface,
25 const std::string& i_function,
Ben Tynera0982102022-02-16 14:19:41 -060026 sdbusplus::message::message& o_method);
Ben Tyner5c5db652021-02-22 18:22:35 -060027
28/**
Ben Tyner188f1092021-02-01 09:33:06 -060029 * Create a PEL for the specified event type
30 *
31 * The additional data provided in the map will be placed in a user data
32 * section of the PEL and may additionally contain key words to trigger
33 * certain behaviors by the backend logging code. Each set of data described
34 * in the vector of ffdc data will be placed in additional user data
35 * sections.
36 *
37 * @param i_event - the event type
38 * @param i_additional - map of additional data
39 * @param i_ffdc - vector of ffdc data
40 * @return Platform log id or 0 if error
41 */
42uint32_t createPel(const std::string& i_event,
43 std::map<std::string, std::string>& i_additional,
44 const std::vector<util::FFDCTuple>& i_ffdc);
45
46/**
47 * Create a PEL from raw PEL data
48 *
49 * Create a PEL based on the pel defined in the data buffer specified.
50 *
51 * @param i_buffer - buffer containing a raw PEL
52 */
53void createPelRaw(const std::vector<uint8_t>& i_buffer);
54
55/**
56 * Get file descriptor of exisitng PEL
57 *
58 * The backend logging code will search for a PEL having the provided pel id
59 * and return a file descriptor of a file containing this pel in raw form.
60 *
61 * @param i_pelid - the PEL ID
62 * @return file descriptor or -1 if error
63 */
64int getPel(const uint32_t i_pelId);
65
Ben Tyner188f1092021-02-01 09:33:06 -060066} // namespace attn