Patrick Venture | af69625 | 2018-12-11 10:22:14 -0800 | [diff] [blame] | 1 | /* |
| 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 Venture | 8e1b233 | 2019-01-17 15:22:45 -0800 | [diff] [blame] | 19 | #include <cstring> |
| 20 | |
Patrick Venture | 9b534f0 | 2018-12-13 16:10:02 -0800 | [diff] [blame] | 21 | namespace host_tool |
| 22 | { |
| 23 | |
Patrick Venture | af69625 | 2018-12-11 10:22:14 -0800 | [diff] [blame] | 24 | bool LpcDataHandler::sendContents(const std::string& input, |
| 25 | std::uint16_t session) |
| 26 | { |
Patrick Venture | 8e1b233 | 2019-01-17 15:22:45 -0800 | [diff] [blame] | 27 | /* TODO: Add mechanism for configuring this. */ |
| 28 | LpcRegion host_lpc_buf; |
| 29 | |
| 30 | /* TODO: Remove hard-coded configuration used with test machine. */ |
Patrick Venture | 03db87e | 2019-06-20 07:56:06 -0700 | [diff] [blame^] | 31 | host_lpc_buf.address = address; |
| 32 | host_lpc_buf.length = length; |
Patrick Venture | 8e1b233 | 2019-01-17 15:22:45 -0800 | [diff] [blame] | 33 | |
| 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 Venture | af69625 | 2018-12-11 10:22:14 -0800 | [diff] [blame] | 48 | return false; |
| 49 | } |
Patrick Venture | 9b534f0 | 2018-12-13 16:10:02 -0800 | [diff] [blame] | 50 | |
| 51 | } // namespace host_tool |