|
@@ -106,13 +106,14 @@ void NodeIO::send_message_header(uint32_t tot_message_len)
|
|
|
chunksize_inflight = 0;
|
|
|
}
|
|
|
|
|
|
-void NodeIO::send_chunk(uint8_t *data, uint32_t chunk_len)
|
|
|
+bool NodeIO::send_chunk(uint8_t *data, uint32_t chunk_len)
|
|
|
{
|
|
|
assert(chunk_len <= MAXCHUNKSIZE);
|
|
|
uint64_t header = (uint64_t(chunk_len) << 8) + COMMAND_CHUNK;
|
|
|
send_header_data(header, data, chunk_len);
|
|
|
chunksize_inflight += chunk_len;
|
|
|
assert(chunksize_inflight <= msgsize_inflight);
|
|
|
+ return (chunksize_inflight < msgsize_inflight);
|
|
|
}
|
|
|
|
|
|
void NodeIO::recv_commands(
|
|
@@ -239,15 +240,24 @@ NetIO::NetIO(boost::asio::io_context &io_context, const Config &config)
|
|
|
* use to store the first (encrypted) chunk of this message. */
|
|
|
uint8_t *ocall_message(nodenum_t node_num, uint32_t message_len)
|
|
|
{
|
|
|
- return NULL;
|
|
|
+ assert(g_netio != NULL);
|
|
|
+ NodeIO &node = g_netio->node(node_num);
|
|
|
+ node.send_message_header(message_len);
|
|
|
+ return node.request_frame();
|
|
|
}
|
|
|
|
|
|
/* The enclave calls this to inform the untrusted app that there's a new
|
|
|
* chunk to send. The return value is the frame the enclave should use
|
|
|
* to store the next (encrypted) chunk of this message, or NULL if this
|
|
|
* was the last chunk. */
|
|
|
-uint8_t *ocall_chunk(nodenum_t node_num, const uint8_t *chunkdata,
|
|
|
+uint8_t *ocall_chunk(nodenum_t node_num, uint8_t *chunkdata,
|
|
|
uint32_t chunklen)
|
|
|
{
|
|
|
+ assert(g_netio != NULL);
|
|
|
+ NodeIO &node = g_netio->node(node_num);
|
|
|
+ bool morechunks = node.send_chunk(chunkdata, chunklen);
|
|
|
+ if (morechunks) {
|
|
|
+ return node.request_frame();
|
|
|
+ }
|
|
|
return NULL;
|
|
|
}
|