remote_rom: use UDP and implement go-back-N ARQ

This commit is contained in:
Johannes Schlatow
2018-11-09 09:48:05 +01:00
committed by Norman Feske
parent c137c595c8
commit 8ed98b8459
16 changed files with 1221 additions and 419 deletions

View File

@@ -25,9 +25,11 @@ namespace Remote_rom {
class Exception : public ::Genode::Exception { };
Backend_server_base &backend_init_server(Genode::Env &env,
Genode::Allocator &alloc);
Genode::Allocator &alloc,
Genode::Xml_node config);
Backend_client_base &backend_init_client(Genode::Env &env,
Genode::Allocator &alloc);
Genode::Allocator &alloc,
Genode::Xml_node config);
};
struct Remote_rom::Backend_server_base : Genode::Interface

View File

@@ -24,10 +24,13 @@ namespace Remote_rom {
struct Remote_rom::Rom_forwarder_base : Genode::Interface
{
virtual const char *module_name() const = 0;
virtual size_t content_size() const = 0;
virtual size_t transfer_content(char *dst, size_t dst_len,
size_t offset=0) const = 0;
virtual void start_transmission() = 0;
virtual void finish_transmission() = 0;
virtual const char *module_name() const = 0;
virtual size_t content_size() const = 0;
virtual unsigned content_hash() const = 0;
virtual size_t transfer_content(char *dst, size_t dst_len,
size_t offset=0) const = 0;
};
#endif

View File

@@ -24,8 +24,10 @@ namespace Remote_rom {
struct Remote_rom::Rom_receiver_base : Genode::Interface
{
virtual const char *module_name() const = 0;
virtual char* start_new_content(size_t len) = 0;
virtual const char *module_name() const = 0;
virtual unsigned content_hash() const = 0;
virtual char* start_new_content(unsigned hash,
size_t len) = 0;
virtual void commit_new_content(bool abort=false) = 0;
};

49
include/remote_rom/util.h Normal file
View File

@@ -0,0 +1,49 @@
/*
* \brief Utility functions used by ROM forwarder and receiver.
* \author Johannes Schlatow
* \date 2018-11-14
*/
/*
* Copyright (C) 2018 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef __INCLUDE__REMOTE_ROM__UTIL_H_
#define __INCLUDE__REMOTE_ROM__UTIL_H_
#include <base/fixed_stdint.h>
namespace Remote_rom {
using Genode::uint32_t;
using Genode::int32_t;
using Genode::uint8_t;
using Genode::size_t;
uint32_t cksum(void const * const buf, size_t size);
}
/**
* Calculating checksum compatible to POSIX cksum
*
* \param buf pointer to buffer containing data
* \param size length of buffer in bytes
*
* \return CRC32 checksum of data
*/
Genode::uint32_t Remote_rom::cksum(void const * const buf, size_t size)
{
uint8_t const *p = static_cast<uint8_t const*>(buf);
uint32_t crc = ~0U;
while (size--) {
crc ^= *p++;
for (uint32_t j = 0; j < 8; j++)
crc = (-int32_t(crc & 1) & 0xedb88320) ^ (crc >> 1);
}
return crc ^ ~0U;
}
#endif