blob: 3d6bc4ba0d89b65ee2463edab46d1f0781da8dfa [file] [log] [blame]
Patrick Ventureaf696252018-12-11 10:22:14 -08001/*
2 * Copyright 2018 Google Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "lpc.hpp"
18
Patrick Venture8e1b2332019-01-17 15:22:45 -080019#include <cstring>
20
Patrick Venture9b534f02018-12-13 16:10:02 -080021namespace host_tool
22{
23
Patrick Ventureaf696252018-12-11 10:22:14 -080024bool LpcDataHandler::sendContents(const std::string& input,
25 std::uint16_t session)
26{
Patrick Venture8e1b2332019-01-17 15:22:45 -080027 /* TODO: Add mechanism for configuring this. */
28 LpcRegion host_lpc_buf;
29
30 /* TODO: Remove hard-coded configuration used with test machine. */
Patrick Venture03db87e2019-06-20 07:56:06 -070031 host_lpc_buf.address = address;
32 host_lpc_buf.length = length;
Patrick Venture8e1b2332019-01-17 15:22:45 -080033
34 std::vector<std::uint8_t> payload(sizeof(host_lpc_buf));
35 std::memcpy(payload.data(), &host_lpc_buf, sizeof(host_lpc_buf));
36
37 blob->writeMeta(session, 0x00, payload);
38
39 /* TODO: Call sessionstat and see if the metadata confirms the region was
40 * mapped successfully, once the lpc data handler implements it.
41 */
42
43 /* todo:
44 * configure memory region (somehow)
45 * copy contents from file to memory region
46 * send external chunk (writeBlob) until it's all sent.
47 */
Patrick Ventureaf696252018-12-11 10:22:14 -080048 return false;
49}
Patrick Venture9b534f02018-12-13 16:10:02 -080050
51} // namespace host_tool