blob: 8f5b0c6a8657f6ceb34cd8e2ea7fc622766ec279 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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
|