blob: e90c940e6da955f036507f573c24879314ab284d [file] [log] [blame]
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -05001#pragma once
2
Shantappa Teekappanavarb64983f2022-02-01 09:28:10 -06003#include "ffdc_file.hpp"
4
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -05005#include <sdbusplus/bus.hpp>
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -05006
7#include <string>
8
9namespace watchdog
10{
11namespace dump
12{
13
14enum ReturnCodes
15{
16 RC_SUCCESS = 0,
17 RC_NOT_HANDLED = 1,
18 RC_DBUS_ERROR = 2
19};
20
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -050021/**
22 * @brief Create a dbus method
23 *
24 * Find the dbus service associated with the dbus object path and create
25 * a dbus method for calling the specified dbus interface and function.
26 *
27 * @param path - dbus object path
28 * @param interface - dbus method interface
29 * @param function - dbus interface function
30 * @param method - method that is created
31 * @param extended - optional for extended methods
32 * @return non-zero if error
33 *
34 **/
35int dbusMethod(const std::string& path, const std::string& interface,
Patrick Williamsfc437562022-07-22 19:26:52 -050036 const std::string& function, sdbusplus::message_t& method,
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -050037 const std::string& extended = "");
38
39/**
40 * @brief Create a PEL for the specified event type
41 *
42 * The additional data provided in the map will be placed in a user data
43 * section of the PEL.
44 *
45 * @param eventType - the event type
46 * @param additional - map of additional data
47 * @param ffdc - vector of ffdc data
48 * @return Platform log id or 0 if error
49 */
50uint32_t createPel(const std::string& eventType,
51 std::map<std::string, std::string>& additional,
52 const std::vector<FFDCTuple>& ffdc);
53
Shantappa Teekappanavare6978e52022-03-03 18:34:25 -060054/**
55 * @brief Query host state
56 *
57 * @return true if the CurrentHostState is 'Running'
58 */
59bool isHostStateRunning();
60
Shantappa Teekappanavar1ac61622021-06-22 19:07:29 -050061} // namespace dump
62} // namespace watchdog