pldmtool : add new option to pldmtool
This commit adds an option '-m' to send msg to
specific MCTP EID(the tool assumes the default
value to send the message).
Tested:
* MCTP EID is not provided or default value is
provided -
./pldmtool base GetPLDMTypes
or ./pldmtool base GetPLDMTypes -m 8
Encode request successfully
Request Message:
08 01 80 00 04
Success in creating the socket : RC = 4
Success in connecting to socket : RC = 0
Success in sending message type as pldm to mctp : RC = 0
Write to socket successful : RC = 5
Total length:5
Loopback response message:
08 01 80 00 04
On first recv(),response == request : RC = 0
Total length: 14
Shutdown Socket successful : RC = 0
Response Message:
08 01 00 00 04 00 0d 00 00 00 00 00 00 00
Supported types: 0(base) 2(platform) 3(bios)
Change-Id: I1b5d7ed251af5380ef0f2b290ff15a9d25b8ba95
Signed-off-by: Pavithra Barithaya <pbaritha@in.ibm.com>
diff --git a/tool/pldm_cmd_helper.hpp b/tool/pldm_cmd_helper.hpp
index 8060751..4ad46d4 100644
--- a/tool/pldm_cmd_helper.hpp
+++ b/tool/pldm_cmd_helper.hpp
@@ -51,12 +51,14 @@
class CommandInterface
{
+
public:
explicit CommandInterface(const char* type, const char* name,
CLI::App* app) :
pldmType(type),
- commandName(name)
+ commandName(name), mctp_eid(PLDM_ENTITY_ID)
{
+ app->add_option("-m,--mctp_eid", mctp_eid, "MCTP endpoint ID");
app->callback([&]() { exec(); });
}
virtual ~CommandInterface() = default;
@@ -74,6 +76,7 @@
private:
const std::string pldmType;
const std::string commandName;
+ uint8_t mctp_eid;
};
} // namespace helper