blob: f2e21538f6aa180f547e0c2929a2d98894467821 [file] [log] [blame]
Ravi Tejace1c96f2020-10-05 23:13:01 -05001#pragma once
2
Andrew Jefferyda4b13c2023-04-28 12:56:20 +09303#include <cstdint>
Ravi Tejace1c96f2020-10-05 23:13:01 -05004#include <string>
5
6namespace pldm
7{
8namespace responder
9{
10namespace utils
11{
12
13/** @brief Setup UNIX socket
14 * This function creates listening socket in non-blocking mode and allows only
15 * one socket connection. returns accepted socket after accepting connection
16 * from peer.
17 *
18 * @param[in] socketInterface - unix socket path
19 * @return on success returns accepted socket fd
20 * on failure returns -1
21 */
22int setupUnixSocket(const std::string& socketInterface);
23
24/** @brief Write data on UNIX socket
25 * This function writes given data to a non-blocking socket.
26 * Irrespective of block size, this function make sure of writing given data
27 * on unix socket.
28 *
29 * @param[in] sock - unix socket
30 * @param[in] buf - data buffer
31 * @param[in] blockSize - size of data to write
32 * @return on success retruns 0
33 * on failure returns -1
34
35 */
36int writeToUnixSocket(const int sock, const char* buf,
37 const uint64_t blockSize);
Sagar Srinivas3687e2b2023-04-10 05:08:28 -050038
Sampa Misra245fc6f2021-08-12 10:30:34 -050039/** @brief checks if given FRU is IBM specific
40 *
41 * @param[in] objPath - FRU object path
42 *
43 * @return bool - true if IBM specific FRU
44 */
45bool checkIfIBMFru(const std::string& objPath);
46
Ravi Tejace1c96f2020-10-05 23:13:01 -050047} // namespace utils
48} // namespace responder
49} // namespace pldm