diff options
author | Tom Joseph <tomjoseph@in.ibm.com> | 2017-04-03 01:53:44 +0530 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2017-04-25 19:12:26 +0000 |
commit | 64b3dec812821351dbf75bf8c73c5d7f0cb0fe98 (patch) | |
tree | 09cc81858337895208fde4c36678a481ab8442ab /command/sol_cmds.cpp | |
parent | 04b303819eace72df588da0db951ac6ed2cb0b52 (diff) | |
download | phosphor-net-ipmid-64b3dec812821351dbf75bf8c73c5d7f0cb0fe98.tar.gz phosphor-net-ipmid-64b3dec812821351dbf75bf8c73c5d7f0cb0fe98.zip |
Add handler function for incoming SOL payload.
Change-Id: I1bdff462ef43281332c6b8c2d61028bc0d9f87b0
Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
Diffstat (limited to 'command/sol_cmds.cpp')
-rw-r--r-- | command/sol_cmds.cpp | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/command/sol_cmds.cpp b/command/sol_cmds.cpp new file mode 100644 index 0000000..8f5b0c6 --- /dev/null +++ b/command/sol_cmds.cpp @@ -0,0 +1,52 @@ +#include <phosphor-logging/log.hpp> +#include "main.hpp" +#include "sol/sol_context.hpp" +#include "sol/sol_manager.hpp" +#include "sol_cmds.hpp" + +namespace sol +{ + +namespace command +{ + +using namespace phosphor::logging; + +std::vector<uint8_t> payloadHandler(std::vector<uint8_t>& inPayload, + const message::Handler& handler) +{ + auto request = reinterpret_cast<Payload*>(inPayload.data()); + + auto solDataSize = inPayload.size() - sizeof(Payload); + + Buffer charData(solDataSize); + if( solDataSize > 0) + { + std::copy_n(inPayload.data() + sizeof(Payload), + solDataSize, + charData.begin()); + } + + try + { + auto& context = std::get<sol::Manager&>(singletonPool). + getContext(handler.sessionID); + + context.processInboundPayload(request->packetSeqNum, + request->packetAckSeqNum, + request->acceptedCharCount, + request->inOperation.ack, + charData); + } + catch (std::exception& e) + { + log<level::ERR>(e.what()); + return std::vector<uint8_t>(); + } + + return std::vector<uint8_t>(); +} + +} // namespace command + +} // namespace sol |