From f831800ae0722e3cf53946589e213a56d5eb6a9d Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Thu, 19 Oct 2017 20:45:55 +0200 Subject: [PATCH] test/lxip/udp_client: remove because not used Was once introduced it for the NIC router/dump tests which do not use it anymore. Fix #2543 --- .../src/test/lxip/udp_client/main.cc | 98 ------------------- .../src/test/lxip/udp_client/target.mk | 3 - 2 files changed, 101 deletions(-) delete mode 100644 repos/dde_linux/src/test/lxip/udp_client/main.cc delete mode 100644 repos/dde_linux/src/test/lxip/udp_client/target.mk diff --git a/repos/dde_linux/src/test/lxip/udp_client/main.cc b/repos/dde_linux/src/test/lxip/udp_client/main.cc deleted file mode 100644 index 829b88861b..0000000000 --- a/repos/dde_linux/src/test/lxip/udp_client/main.cc +++ /dev/null @@ -1,98 +0,0 @@ -/* - * \brief Minimal datagram client demonstration using socket API - * \author Martin Stein - * \date 2016-08-17 - */ - -/* - * Copyright (C) 2016-2017 Genode Labs GmbH - * - * This file is part of the Genode OS framework, which is distributed - * under the terms of the GNU Affero General Public License version 3. - */ - -/* Genode includes */ -#include -#include -#include -#include - -/* libc includes */ -#include -#include -#include -#include -#include -#include - -using namespace Genode; - - -struct Failure : Genode::Exception { }; - - -static void client_loop(Genode::Xml_node config_node, Timer::Connection &timer) -{ - int s; - log("Start the client loop ..."); - for(int j = 0; j != 5; ++j) { - timer.msleep(2000); - if((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { - error("No socket available!"); - throw Failure(); - } - enum { ADDR_STR_SZ = 16 }; - char serv_addr[ADDR_STR_SZ] = { 0 }; - try { config_node.attribute("server_ip").value(serv_addr, ADDR_STR_SZ); } - catch(...) { - error("Missing \"server_ip\" attribute."); - throw Xml_node::Nonexistent_attribute(); - } - unsigned port = 0; - try { config_node.attribute("server_port").value(&port); } - catch (...) { - error("Missing \"server_port\" attribute."); - throw Xml_node::Nonexistent_attribute(); - } - struct sockaddr_in addr; - addr.sin_family = AF_INET; - socklen_t len = sizeof(addr); - addr.sin_port = htons(port); - addr.sin_family = AF_INET; - addr.sin_addr.s_addr = inet_addr(serv_addr); - char buf[1024]; - Genode::snprintf(buf, sizeof(buf), "UDP server at %s:%u", serv_addr, port); - ssize_t n = sizeof(buf); - n = sendto(s, buf, n, 0, (struct sockaddr*)&addr, len); - n = recvfrom(s, buf, sizeof(buf), 0, (struct sockaddr*)&addr, &len); - if (n == 0) { - warning("Invalid reply!"); - continue; - } - if (n < 0) { - error("Error ", n); - break; - } - log("Received \"", String<64>(buf), " ...\""); - } - timer.msleep(2000); - - log("Test done"); -} - - -struct Main -{ - Main(Genode::Env &env) - { - Genode::Attached_rom_dataspace config_rom { env, "config" }; - Timer::Connection timer { env }; - - Libc::with_libc([&] () { - client_loop(config_rom.xml(), timer); - }); - } -}; - - -void Libc::Component::construct(Libc::Env &env) { static Main main(env); } diff --git a/repos/dde_linux/src/test/lxip/udp_client/target.mk b/repos/dde_linux/src/test/lxip/udp_client/target.mk deleted file mode 100644 index 1a2898aa89..0000000000 --- a/repos/dde_linux/src/test/lxip/udp_client/target.mk +++ /dev/null @@ -1,3 +0,0 @@ -TARGET = test-lxip_udp_client -LIBS = libc libc_lxip -SRC_CC = main.cc