Ratan Gupta | 212f53e | 2018-04-30 17:28:05 +0530 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Ratan Gupta | 212f53e | 2018-04-30 17:28:05 +0530 | [diff] [blame] | 3 | #include "snmp_client.hpp" |
| 4 | |
Ratan Gupta | 34d129a | 2021-12-04 21:04:51 +0530 | [diff] [blame] | 5 | #include <filesystem> |
Patrick Williams | 1334b7b | 2021-02-22 17:15:12 -0600 | [diff] [blame] | 6 | |
Ratan Gupta | 212f53e | 2018-04-30 17:28:05 +0530 | [diff] [blame] | 7 | namespace phosphor |
| 8 | { |
| 9 | namespace network |
| 10 | { |
| 11 | namespace snmp |
| 12 | { |
| 13 | |
Gunnar Mills | f3fac22 | 2018-08-14 11:59:10 -0500 | [diff] [blame] | 14 | constexpr auto SEPARATOR = "_"; |
Ratan Gupta | 212f53e | 2018-04-30 17:28:05 +0530 | [diff] [blame] | 15 | |
Ratan Gupta | 34d129a | 2021-12-04 21:04:51 +0530 | [diff] [blame] | 16 | namespace fs = std::filesystem; |
Ratan Gupta | 212f53e | 2018-04-30 17:28:05 +0530 | [diff] [blame] | 17 | |
Ratan Gupta | a7ff385 | 2018-11-16 14:05:57 +0530 | [diff] [blame] | 18 | /** @brief Serialize and persist SNMP manager/client D-Bus object. |
| 19 | * @param[in] id - filename of the persisted SNMP manager object. |
Ratan Gupta | 212f53e | 2018-04-30 17:28:05 +0530 | [diff] [blame] | 20 | * @param[in] manager - const reference to snmp client/manager object. |
| 21 | * @param[in] path - path of persistent location where D-Bus object would be |
| 22 | * saved. |
| 23 | * @return fs::path - pathname of persisted snmp manager/client file. |
| 24 | */ |
Ratan Gupta | a7ff385 | 2018-11-16 14:05:57 +0530 | [diff] [blame] | 25 | fs::path serialize(Id id, const Client& manager, const fs::path& path); |
Ratan Gupta | 212f53e | 2018-04-30 17:28:05 +0530 | [diff] [blame] | 26 | |
| 27 | /** @brief Deserialze SNMP manager/client info into a D-Bus object |
| 28 | * @param[in] path - pathname of persisted manager/client file. |
| 29 | * @param[in] manager - reference to snmp client/manager object |
| 30 | * which is the target of deserialization. |
| 31 | * @return bool - true if the deserialization was successful, false otherwise. |
| 32 | */ |
| 33 | bool deserialize(const fs::path& path, Client& manager); |
| 34 | |
| 35 | } // namespace snmp |
| 36 | } // namespace network |
| 37 | } // namespace phosphor |