blob: 8032c9af8ac061876bafa708bd227542137cfe9d [file] [log] [blame]
Lakshminarayana R. Kammath27693a42019-06-24 00:51:47 -05001#pragma once
2
3#ifndef PLDM_CMD_HELPER_H
4#define PLDM_CMD_HELPER_H
5
6#include "libpldmresponder/utils.hpp"
7
8#include <err.h>
9#include <sys/socket.h>
10#include <sys/un.h>
11#include <unistd.h>
12
13#include <cstring>
14#include <iomanip>
15#include <iostream>
16
17#include "libpldm/base.h"
Lakshminarayana R. Kammath58229b22019-08-09 06:30:04 -050018#include "libpldm/platform.h"
Lakshminarayana R. Kammath27693a42019-06-24 00:51:47 -050019
20using namespace pldm::responder::utils;
21
22/** @brief Print the buffer
23 *
24 * @param[in] buffer - Buffer to print
25 *
26 * @return - None
27 */
28void printBuffer(const std::vector<uint8_t>& buffer);
29
30/** @brief MCTP socket read/recieve
31 *
32 * @param[in] requestMsg - Request message to compare against loopback
33 * message recieved from mctp socket
34 * @param[out] responseMsg - Response buffer recieved from mctp socket
35 *
36 * @return - 0 on success.
37 * -1 or -errno on failure.
38 */
39int mctpSockSendRecv(const std::vector<uint8_t>& requestMsg,
40 std::vector<uint8_t>& responseMsg);
41
42#endif