blob: 0ad6e7483c6e1dffcb0746b8759aaefa82e39704 [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
39/** @brief Method to check if the logical bit is set
40 *
41 * @param[containerId] - container id of the entity
42 *
43 * @return true or false based on the logic bit set
44 * */
45bool checkIfLogicalBitSet(const uint16_t& containerId);
Ravi Tejace1c96f2020-10-05 23:13:01 -050046} // namespace utils
47} // namespace responder
48} // namespace pldm