diff --git a/run/tftp_rom.run b/run/tftp_rom.run
index bb4a791..482a9ab 100644
--- a/run/tftp_rom.run
+++ b/run/tftp_rom.run
@@ -39,6 +39,7 @@ append config {
+
}
@@ -57,18 +58,21 @@ append config {
-
+
-
-
+
+
+
+
@@ -88,6 +92,7 @@ append config {
+
diff --git a/src/server/tftp_rom/component.cc b/src/server/tftp_rom/component.cc
index bb7289e..984dfb1 100644
--- a/src/server/tftp_rom/component.cc
+++ b/src/server/tftp_rom/component.cc
@@ -21,17 +21,18 @@
#include
#include
#include
-#include
+#include
#include
#include
#include
-/* lwIP raw API */
-#include
+/* LwIP includes */
#include
#include
#include
#include
+#include
+#include
namespace Tftp_rom {
@@ -48,11 +49,11 @@ namespace Tftp_rom {
}
-extern "C" void rrq_cb(void *arg, udp_pcb *upcb, pbuf *pbuf,
- ip_addr_t *addr, Genode::uint16_t port);
+extern "C" void rrq_cb(void *arg, struct udp_pcb *pcb, struct pbuf *p,
+ const ip_addr_t *addr, u16_t port);
-extern "C" void data_cb(void *arg, udp_pcb *upcb, pbuf *pbuf,
- ip_addr_t *addr, Genode::uint16_t port);
+extern "C" void data_cb(void *arg, struct udp_pcb *pcb, struct pbuf *p,
+ const ip_addr_t *addr, u16_t port);
class Tftp_rom::Session_component :
@@ -185,7 +186,7 @@ class Tftp_rom::Session_component :
udp_send(_pcb, ack);
}
- void first_response(pbuf *data, ip_addr_t *addr, uint16_t port)
+ void first_response(pbuf *data, ip_addr_t const *addr, uint16_t port)
{
/*
* we now know the port the server will use,
@@ -325,8 +326,8 @@ class Tftp_rom::Session_component :
********************/
-extern "C" void rrq_cb(void *arg, udp_pcb *upcb, pbuf *data,
- ip_addr_t *addr, Genode::uint16_t port)
+extern "C" void rrq_cb(void *arg, struct udp_pcb *pcb, struct pbuf *data,
+ const ip_addr_t *addr, u16_t port)
{
Tftp_rom::Session_component *session = (Tftp_rom::Session_component*)arg;
@@ -347,7 +348,7 @@ extern "C" void rrq_cb(void *arg, udp_pcb *upcb, pbuf *data,
extern "C" void data_cb(void *arg, udp_pcb *upcb, pbuf *data,
- ip_addr_t *addr, Genode::uint16_t port)
+ ip_addr_t const *addr, Genode::uint16_t port)
{
Tftp_rom::Session_component *session = (Tftp_rom::Session_component*)arg;
if (session->add_block(data)) return;
@@ -365,6 +366,11 @@ class Tftp_rom::Root : public Genode::Root_component
Genode::Env &_env;
Genode::Attached_rom_dataspace _config_rom { _env, "config" };
+ /**
+ * LwIP connection to Nic service
+ */
+ Lwip::Nic_netif _netif { _env, *md_alloc(), _config_rom.xml() };
+
class Timeout_dispatcher : Genode::Thread, Genode::Lock
{
private:
@@ -456,6 +462,9 @@ class Tftp_rom::Root : public Genode::Root_component
Session_component *_create_session(const char *args) override
{
+ while (!_netif.ready())
+ _env.ep().wait_and_dispatch_one_io_signal();
+
Session_component *session;
_config_rom.update();
@@ -531,9 +540,14 @@ class Tftp_rom::Root : public Genode::Root_component
};
-void Libc::Component::construct(Libc::Env &env )
+void Component::construct(Genode::Env &env)
{
- static Genode::Sliced_heap sliced_heap(env.ram(), env.rm());
- static Tftp_rom::Root root(env, sliced_heap);
-}
+ env.exec_static_constructors();
+ static Genode::Heap heap(env.ram(), env.rm());
+ static Timer::Connection timer(env, "lwip");
+
+ Lwip::genode_init(heap, timer);
+
+ static Tftp_rom::Root root(env, heap);
+}
diff --git a/src/server/tftp_rom/target.mk b/src/server/tftp_rom/target.mk
index d19bde5..af4b533 100644
--- a/src/server/tftp_rom/target.mk
+++ b/src/server/tftp_rom/target.mk
@@ -1,5 +1,5 @@
TARGET = tftp_rom
SRC_CC = component.cc
-LIBS = base lwip libc libc_lwip libc_lwip_nic_dhcp
+LIBS = base lwip
CC_CXX_WARN_STRICT =