run: adjust lwip pingpong test for foc_arndale
This commit is contained in:
parent
0b906207bb
commit
cab27dd713
|
@ -71,6 +71,17 @@ proc fiasco_external { } {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
##
|
||||||
|
# Reset the target system via the Fiasco.OC kernel debugger
|
||||||
|
#
|
||||||
|
proc reset { {spawn_id_arg -1} } {
|
||||||
|
global spawn_id
|
||||||
|
if { $spawn_id_arg == -1 } {
|
||||||
|
set spawn_id_arg $spawn_id
|
||||||
|
}
|
||||||
|
send -i $spawn_id_arg "\033^^"
|
||||||
|
}
|
||||||
|
|
||||||
##################################
|
##################################
|
||||||
## Test framework API functions ##
|
## Test framework API functions ##
|
||||||
##################################
|
##################################
|
||||||
|
|
|
@ -0,0 +1,205 @@
|
||||||
|
#
|
||||||
|
# \brief Test ping
|
||||||
|
# \author Josef Soentgen
|
||||||
|
# \date 2013-01-06
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Client parameters
|
||||||
|
#
|
||||||
|
set packet_payload_size 24
|
||||||
|
set packet_count 1000000
|
||||||
|
|
||||||
|
#
|
||||||
|
# Build
|
||||||
|
#
|
||||||
|
|
||||||
|
set build_components {
|
||||||
|
core init
|
||||||
|
drivers/pci drivers/timer drivers/nic
|
||||||
|
test/lwip/pingpong/server
|
||||||
|
}
|
||||||
|
|
||||||
|
lappend_if $use_nic_bridge build_components server/nic_bridge
|
||||||
|
|
||||||
|
lappend_if [expr [have_spec omap4] || [have_spec exynos5]] build_components drivers/usb
|
||||||
|
|
||||||
|
build $build_components
|
||||||
|
|
||||||
|
create_boot_directory
|
||||||
|
|
||||||
|
#
|
||||||
|
# Generate config
|
||||||
|
#
|
||||||
|
|
||||||
|
set config {
|
||||||
|
<config verbose="yes">
|
||||||
|
<parent-provides>
|
||||||
|
<service name="ROM"/>
|
||||||
|
<service name="RAM"/>
|
||||||
|
<service name="IRQ"/>
|
||||||
|
<service name="IO_MEM"/>
|
||||||
|
<service name="IO_PORT"/>
|
||||||
|
<service name="CAP"/>
|
||||||
|
<service name="PD"/>
|
||||||
|
<service name="RM"/>
|
||||||
|
<service name="CPU"/>
|
||||||
|
<service name="LOG"/>
|
||||||
|
<service name="SIGNAL"/>
|
||||||
|
</parent-provides>
|
||||||
|
<default-route>
|
||||||
|
<any-service> <parent/> <any-child/> </any-service>
|
||||||
|
</default-route>
|
||||||
|
<start name="timer">
|
||||||
|
<resource name="RAM" quantum="1M"/>
|
||||||
|
<provides> <service name="Timer"/> </provides>
|
||||||
|
</start> }
|
||||||
|
|
||||||
|
append_if $use_nic_bridge config {
|
||||||
|
<start name="nic_bridge">
|
||||||
|
<resource name="RAM" quantum="2M"/>
|
||||||
|
<provides><service name="Nic"/></provides>
|
||||||
|
<route>
|
||||||
|
<service name="Nic"> }
|
||||||
|
append_if [expr $use_nic_bridge && ([have_spec omap4] || [have_spec exynos5])] config {
|
||||||
|
<child name="usb_drv"/> }
|
||||||
|
append_if [expr $use_nic_bridge && (![have_spec omap4] && ![have_spec exynos5])] config {
|
||||||
|
<child name="nic_drv"/> }
|
||||||
|
append_if $use_nic_bridge config {
|
||||||
|
</service>
|
||||||
|
<any-service> <parent/> <any-child/> </any-service>
|
||||||
|
</route>
|
||||||
|
</start> }
|
||||||
|
|
||||||
|
append config "
|
||||||
|
<start name=\"$test_server_name\">"
|
||||||
|
append config {
|
||||||
|
<resource name="RAM" quantum="16M"/>
|
||||||
|
<config>
|
||||||
|
<argv verbose="0" listenip="0.0.0.0" />
|
||||||
|
</config>
|
||||||
|
<route> }
|
||||||
|
append_if $use_nic_bridge config {
|
||||||
|
<service name="Nic"> <child name="nic_bridge"/> </service> }
|
||||||
|
append config {
|
||||||
|
<any-service> <parent/> <any-child/> </any-service>
|
||||||
|
</route>
|
||||||
|
</start> }
|
||||||
|
|
||||||
|
append_if [expr [have_spec omap4] || [have_spec exynos5]] config {
|
||||||
|
<start name="usb_drv" priority="-1">
|
||||||
|
<resource name="RAM" quantum="12M"/>
|
||||||
|
<provides>
|
||||||
|
<service name="Nic"/>
|
||||||
|
</provides>
|
||||||
|
<config>
|
||||||
|
<nic mac="2e:60:90:0c:4e:02" />
|
||||||
|
<!--<nic mac="aa:bb:cc:dd:ee:00" />-->
|
||||||
|
</config>
|
||||||
|
</start>}
|
||||||
|
|
||||||
|
append_if [expr ![have_spec omap4] && ![have_spec exynos5]] config {
|
||||||
|
<start name="nic_drv">
|
||||||
|
<resource name="RAM" quantum="4M"/>
|
||||||
|
<provides><service name="Nic"/></provides>
|
||||||
|
</start>}
|
||||||
|
|
||||||
|
append_if [have_spec pci] config {
|
||||||
|
<start name="pci_drv">
|
||||||
|
<resource name="RAM" quantum="2M"/>
|
||||||
|
<provides> <service name="PCI"/> </provides>
|
||||||
|
</start> }
|
||||||
|
|
||||||
|
append config {
|
||||||
|
</config>
|
||||||
|
}
|
||||||
|
|
||||||
|
install_config $config
|
||||||
|
|
||||||
|
#
|
||||||
|
# Boot modules
|
||||||
|
#
|
||||||
|
|
||||||
|
# generic modules
|
||||||
|
set boot_modules {
|
||||||
|
core init timer
|
||||||
|
ld.lib.so libc.lib.so lwip.lib.so libc_log.lib.so
|
||||||
|
}
|
||||||
|
|
||||||
|
lappend_if $use_nic_bridge boot_modules nic_bridge
|
||||||
|
|
||||||
|
lappend boot_modules $test_server_name
|
||||||
|
|
||||||
|
# platform-specific modules
|
||||||
|
lappend_if [have_spec pci] boot_modules pci_drv
|
||||||
|
lappend_if [expr [have_spec omap4] || [have_spec exynos5]] boot_modules usb_drv
|
||||||
|
lappend_if [expr ![have_spec omap4] && ![have_spec exynos5]] boot_modules nic_drv
|
||||||
|
|
||||||
|
build_boot_image $boot_modules
|
||||||
|
|
||||||
|
# establish serial connection with the server system
|
||||||
|
spawn picocom -b 115200 /dev/ttyUSB0
|
||||||
|
set server_spawn_id $spawn_id
|
||||||
|
set timeout -1
|
||||||
|
expect -i $server_spawn_id "Terminal ready"
|
||||||
|
|
||||||
|
# reset the server system (if Fiasco.OC is already running)
|
||||||
|
reset $server_spawn_id
|
||||||
|
|
||||||
|
# get IP address from server
|
||||||
|
expect {
|
||||||
|
-i $server_spawn_id
|
||||||
|
-re "got IP address (.*)\033.*\n" { set ip_addr $expect_out(1,string) }
|
||||||
|
}
|
||||||
|
puts "got server IP address: $ip_addr"
|
||||||
|
|
||||||
|
# wait until the server is ready
|
||||||
|
expect -i $server_spawn_id "wait...*\n"
|
||||||
|
|
||||||
|
# build the client
|
||||||
|
set pingpong_dir $genode_dir/libports/src/test/lwip/pingpong
|
||||||
|
exec g++ -o bin/network_test_client \
|
||||||
|
$pingpong_dir/client/main.cc \
|
||||||
|
$pingpong_dir/pingpong.cc \
|
||||||
|
-I $pingpong_dir
|
||||||
|
|
||||||
|
# start the client
|
||||||
|
spawn bin/network_test_client \
|
||||||
|
-serverip $ip_addr \
|
||||||
|
-startsize $packet_payload_size \
|
||||||
|
-endsize $packet_payload_size \
|
||||||
|
-count $packet_count
|
||||||
|
|
||||||
|
# wait until the client is connected to the server
|
||||||
|
expect -i $server_spawn_id "client \[1|3\] connected..."
|
||||||
|
|
||||||
|
# start counting the execution time
|
||||||
|
set time_start [clock milliseconds]
|
||||||
|
|
||||||
|
# wait until the server received all packets
|
||||||
|
expect {
|
||||||
|
-i $server_spawn_id
|
||||||
|
-re "received .*\n" { }
|
||||||
|
}
|
||||||
|
|
||||||
|
# stop counting the execution time
|
||||||
|
set time_end [clock milliseconds]
|
||||||
|
|
||||||
|
set milliseconds [expr $time_end - $time_start]
|
||||||
|
set payload_total [expr $packet_count * $packet_payload_size]
|
||||||
|
set payload_bytes_per_second [expr $payload_total * 1000 / $milliseconds ]
|
||||||
|
|
||||||
|
set test_result "$milliseconds ms ($payload_bytes_per_second payload bytes per second)"
|
||||||
|
|
||||||
|
puts "\nTest succeeded in $test_result."
|
||||||
|
|
||||||
|
# disconnect from server system
|
||||||
|
send -i $server_spawn_id "\x01\x18" ;# Ctrl-A Ctrl-X
|
||||||
|
expect {
|
||||||
|
-i $server_spawn_id
|
||||||
|
"Thanks for using picocom"
|
||||||
|
}
|
||||||
|
|
||||||
|
exec rm -f bin/network_test_client
|
||||||
|
|
||||||
|
# vi: set ft=tcl :
|
|
@ -0,0 +1,18 @@
|
||||||
|
source ${genode_dir}/libports/run/network_test_lwip.run
|
||||||
|
set test_result_lwip $test_result
|
||||||
|
|
||||||
|
source ${genode_dir}/libports/run/network_test_lwip_nic_bridge.run
|
||||||
|
set test_result_lwip_nic_bridge $test_result
|
||||||
|
|
||||||
|
source ${genode_dir}/libports/run/network_test_libc_lwip.run
|
||||||
|
set test_result_libc_lwip $test_result
|
||||||
|
|
||||||
|
source ${genode_dir}/libports/run/network_test_libc_lwip_nic_bridge.run
|
||||||
|
set test_result_libc_lwip_nic_bridge $test_result
|
||||||
|
|
||||||
|
puts "\nTest results:\n"
|
||||||
|
puts "lwip: $test_result_lwip"
|
||||||
|
puts "lwip_nic_bridge: $test_result_lwip_nic_bridge"
|
||||||
|
puts "libc_lwip: $test_result_libc_lwip"
|
||||||
|
puts "libc_lwip_nic_bridge: $test_result_libc_lwip_nic_bridge"
|
||||||
|
puts ""
|
|
@ -0,0 +1,4 @@
|
||||||
|
set use_nic_bridge 0
|
||||||
|
set test_server_name "test-ping_server_libc_lwip"
|
||||||
|
|
||||||
|
source ${genode_dir}/libports/run/network_test.inc
|
|
@ -0,0 +1,4 @@
|
||||||
|
set use_nic_bridge 1
|
||||||
|
set test_server_name "test-ping_server_libc_lwip"
|
||||||
|
|
||||||
|
source ${genode_dir}/libports/run/network_test.inc
|
|
@ -0,0 +1,4 @@
|
||||||
|
set use_nic_bridge 0
|
||||||
|
set test_server_name "test-ping_server_lwip"
|
||||||
|
|
||||||
|
source ${genode_dir}/libports/run/network_test.inc
|
|
@ -0,0 +1,4 @@
|
||||||
|
set use_nic_bridge 1
|
||||||
|
set test_server_name "test-ping_server_lwip"
|
||||||
|
|
||||||
|
source ${genode_dir}/libports/run/network_test.inc
|
|
@ -14,7 +14,7 @@ set build_components {
|
||||||
test/lwip/pingpong/client
|
test/lwip/pingpong/client
|
||||||
}
|
}
|
||||||
|
|
||||||
lappend_if [have_spec omap4] build_components drivers/usb
|
lappend_if [expr [have_spec omap4] || [have_spec exynos5]] build_components drivers/usb
|
||||||
|
|
||||||
build $build_components
|
build $build_components
|
||||||
|
|
||||||
|
@ -45,15 +45,9 @@ set config {
|
||||||
<start name="timer">
|
<start name="timer">
|
||||||
<resource name="RAM" quantum="1M"/>
|
<resource name="RAM" quantum="1M"/>
|
||||||
<provides> <service name="Timer"/> </provides>
|
<provides> <service name="Timer"/> </provides>
|
||||||
</start>
|
|
||||||
<start name="test-ping_client">
|
|
||||||
<resource name="RAM" quantum="16M"/>
|
|
||||||
<config>
|
|
||||||
<argv verbose="1" serverip="10.0.0.190" startsize="1024" endsize="16384" />
|
|
||||||
</config>
|
|
||||||
</start> }
|
</start> }
|
||||||
|
|
||||||
append_if [have_spec omap4] config {
|
append_if [expr [have_spec omap4] || [have_spec exynos5]] config {
|
||||||
<start name="usb_drv" priority="-1">
|
<start name="usb_drv" priority="-1">
|
||||||
<resource name="RAM" quantum="12M"/>
|
<resource name="RAM" quantum="12M"/>
|
||||||
<provides>
|
<provides>
|
||||||
|
@ -64,7 +58,7 @@ append_if [have_spec omap4] config {
|
||||||
</config>
|
</config>
|
||||||
</start>}
|
</start>}
|
||||||
|
|
||||||
append_if [expr ![have_spec omap4]] config {
|
append_if [expr ![have_spec omap4] && ![have_spec exynos5]] config {
|
||||||
<start name="nic_drv">
|
<start name="nic_drv">
|
||||||
<resource name="RAM" quantum="4M"/>
|
<resource name="RAM" quantum="4M"/>
|
||||||
<provides><service name="Nic"/></provides>
|
<provides><service name="Nic"/></provides>
|
||||||
|
@ -72,10 +66,40 @@ append_if [expr ![have_spec omap4]] config {
|
||||||
|
|
||||||
append_if [have_spec pci] config {
|
append_if [have_spec pci] config {
|
||||||
<start name="pci_drv">
|
<start name="pci_drv">
|
||||||
<resource name="RAM" quantum="1M"/>
|
<resource name="RAM" quantum="2M"/>
|
||||||
<provides> <service name="PCI"/> </provides>
|
<provides> <service name="PCI"/> </provides>
|
||||||
</start> }
|
</start> }
|
||||||
|
|
||||||
|
# establish serial connection with the server system
|
||||||
|
spawn picocom -b 115200 /dev/ttyUSB0
|
||||||
|
set server_spawn_id $spawn_id
|
||||||
|
set timeout -1
|
||||||
|
expect -i $server_spawn_id "Terminal ready"
|
||||||
|
|
||||||
|
# get IP address from server
|
||||||
|
expect {
|
||||||
|
-i $server_spawn_id
|
||||||
|
-re "got IP address (.*)\033.*\n" { set ip_addr $expect_out(1,string) }
|
||||||
|
}
|
||||||
|
puts "got server IP address: $ip_addr"
|
||||||
|
|
||||||
|
append config {
|
||||||
|
<start name="test-ping_client_libc_lwip">
|
||||||
|
<resource name="RAM" quantum="16M"/>
|
||||||
|
<config>
|
||||||
|
<arg value="test-ping_client"/>
|
||||||
|
<arg value="-verbose"/>
|
||||||
|
<arg value="0"/>
|
||||||
|
<arg value="-startsize"/>
|
||||||
|
<arg value="1024"/>
|
||||||
|
<arg value="-endsize"/>
|
||||||
|
<arg value="1024"/>
|
||||||
|
<arg value="-serverip"/> }
|
||||||
|
append config "
|
||||||
|
<arg value=\"$ip_addr\"/>
|
||||||
|
</config>
|
||||||
|
</start> "
|
||||||
|
|
||||||
append config {
|
append config {
|
||||||
</config>
|
</config>
|
||||||
}
|
}
|
||||||
|
@ -89,8 +113,8 @@ install_config $config
|
||||||
# generic modules
|
# generic modules
|
||||||
set boot_modules {
|
set boot_modules {
|
||||||
core init timer
|
core init timer
|
||||||
ld.lib.so libc.lib.so lwip.lib.so
|
ld.lib.so libc.lib.so libc_log.lib.so lwip_nic_dhcp.lib.so lwip.lib.so
|
||||||
test-ping_client
|
test-ping_client_libc_lwip
|
||||||
}
|
}
|
||||||
|
|
||||||
# platform-specific modules
|
# platform-specific modules
|
||||||
|
@ -112,6 +136,22 @@ append_if [have_spec lan9118] qemu_args " -net nic,model=lan9118 "
|
||||||
|
|
||||||
append qemu_args " -net user "
|
append qemu_args " -net user "
|
||||||
|
|
||||||
run_genode_until forever
|
expect -i $server_spawn_id "wait..."
|
||||||
|
|
||||||
|
run_genode_until {Sucessfully connected to server.} 60
|
||||||
|
|
||||||
|
expect -i $server_spawn_id "client 3 connected..."
|
||||||
|
|
||||||
|
set time_start [clock milliseconds]
|
||||||
|
|
||||||
|
set timeout -1
|
||||||
|
expect {
|
||||||
|
-i $server_spawn_id
|
||||||
|
-re "received .*\n" { }
|
||||||
|
}
|
||||||
|
|
||||||
|
set time_end [clock milliseconds]
|
||||||
|
|
||||||
|
puts "\nTest succeeded in [expr $time_end - $time_start] milliseconds."
|
||||||
|
|
||||||
# vi: set ft=tcl :
|
# vi: set ft=tcl :
|
||||||
|
|
|
@ -14,7 +14,7 @@ set build_components {
|
||||||
test/lwip/pingpong/server
|
test/lwip/pingpong/server
|
||||||
}
|
}
|
||||||
|
|
||||||
lappend_if [have_spec omap4] build_components drivers/usb
|
lappend_if [expr [have_spec omap4] || [have_spec exynos5]] build_components drivers/usb
|
||||||
|
|
||||||
build $build_components
|
build $build_components
|
||||||
|
|
||||||
|
@ -46,14 +46,14 @@ set config {
|
||||||
<resource name="RAM" quantum="1M"/>
|
<resource name="RAM" quantum="1M"/>
|
||||||
<provides> <service name="Timer"/> </provides>
|
<provides> <service name="Timer"/> </provides>
|
||||||
</start>
|
</start>
|
||||||
<start name="test-ping_server">
|
<start name="test-ping_server_libc_lwip">
|
||||||
<resource name="RAM" quantum="16M"/>
|
<resource name="RAM" quantum="16M"/>
|
||||||
<config>
|
<config>
|
||||||
<argv verbose="1" listenip="0.0.0.0" />
|
<argv verbose="0" listenip="0.0.0.0" />
|
||||||
</config>
|
</config>
|
||||||
</start> }
|
</start> }
|
||||||
|
|
||||||
append_if [have_spec omap4] config {
|
append_if [expr [have_spec omap4] || [have_spec exynos5]] config {
|
||||||
<start name="usb_drv" priority="-1">
|
<start name="usb_drv" priority="-1">
|
||||||
<resource name="RAM" quantum="12M"/>
|
<resource name="RAM" quantum="12M"/>
|
||||||
<provides>
|
<provides>
|
||||||
|
@ -64,7 +64,7 @@ append_if [have_spec omap4] config {
|
||||||
</config>
|
</config>
|
||||||
</start>}
|
</start>}
|
||||||
|
|
||||||
append_if [expr ![have_spec omap4]] config {
|
append_if [expr ![have_spec omap4] && ![have_spec exynos5]] config {
|
||||||
<start name="nic_drv">
|
<start name="nic_drv">
|
||||||
<resource name="RAM" quantum="4M"/>
|
<resource name="RAM" quantum="4M"/>
|
||||||
<provides><service name="Nic"/></provides>
|
<provides><service name="Nic"/></provides>
|
||||||
|
@ -72,7 +72,7 @@ append_if [expr ![have_spec omap4]] config {
|
||||||
|
|
||||||
append_if [have_spec pci] config {
|
append_if [have_spec pci] config {
|
||||||
<start name="pci_drv">
|
<start name="pci_drv">
|
||||||
<resource name="RAM" quantum="1M"/>
|
<resource name="RAM" quantum="2M"/>
|
||||||
<provides> <service name="PCI"/> </provides>
|
<provides> <service name="PCI"/> </provides>
|
||||||
</start> }
|
</start> }
|
||||||
|
|
||||||
|
@ -89,14 +89,14 @@ install_config $config
|
||||||
# generic modules
|
# generic modules
|
||||||
set boot_modules {
|
set boot_modules {
|
||||||
core init timer
|
core init timer
|
||||||
ld.lib.so libc.lib.so lwip.lib.so
|
ld.lib.so libc.lib.so lwip.lib.so libc_log.lib.so
|
||||||
test-ping_server
|
test-ping_server_libc_lwip
|
||||||
}
|
}
|
||||||
|
|
||||||
# platform-specific modules
|
# platform-specific modules
|
||||||
lappend_if [have_spec pci] boot_modules pci_drv
|
lappend_if [have_spec pci] boot_modules pci_drv
|
||||||
lappend_if [have_spec omap4] boot_modules usb_drv
|
lappend_if [expr [have_spec omap4] || [have_spec exynos5]] boot_modules usb_drv
|
||||||
lappend_if [expr ![have_spec omap4]] boot_modules nic_drv
|
lappend_if [expr ![have_spec omap4] && ![have_spec exynos5]] boot_modules nic_drv
|
||||||
|
|
||||||
build_boot_image $boot_modules
|
build_boot_image $boot_modules
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
TARGET = test-ping_client_libc_lwip
|
||||||
|
LIBS = base libc libc_lwip lwip libc_lwip_nic_dhcp libc_log config_args
|
||||||
|
SRC_CC = main.cc pingpong.cc
|
||||||
|
|
||||||
|
CC_OPT_main += -fpermissive
|
||||||
|
|
||||||
|
vpath main.cc $(PRG_DIR)/..
|
||||||
|
vpath pingpong.cc $(PRG_DIR)/../..
|
|
@ -0,0 +1,10 @@
|
||||||
|
TARGET = test-ping_client_lwip
|
||||||
|
LIBS = base libc lwip libc_log config_args
|
||||||
|
SRC_CC = main.cc pingpong.cc
|
||||||
|
|
||||||
|
CC_OPT_main += -fpermissive
|
||||||
|
|
||||||
|
INC_DIR += $(REP_DIR)/src/lib/lwip/include
|
||||||
|
|
||||||
|
vpath main.cc $(PRG_DIR)/..
|
||||||
|
vpath pingpong.cc $(PRG_DIR)/../..
|
|
@ -12,20 +12,8 @@
|
||||||
* under the terms of the GNU General Public License version 2.
|
* under the terms of the GNU General Public License version 2.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Genode includes */
|
|
||||||
#include <base/printf.h>
|
|
||||||
#include <util/string.h>
|
|
||||||
#include <os/config.h>
|
|
||||||
|
|
||||||
#include <lwip/genode.h>
|
|
||||||
|
|
||||||
/* libc includes */
|
/* libc includes */
|
||||||
#include <unistd.h>
|
#include <stdio.h>
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "../pingpong.h"
|
#include "../pingpong.h"
|
||||||
|
|
||||||
|
@ -37,30 +25,30 @@ dial(const char *addr)
|
||||||
int s;
|
int s;
|
||||||
struct sockaddr_in in_addr;
|
struct sockaddr_in in_addr;
|
||||||
|
|
||||||
PLOG("Create new socket...");
|
printf("Create new socket...\n");
|
||||||
s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||||
if (s == -1) {
|
if (s == -1) {
|
||||||
PERR("Could not create socket!");
|
printf("ERROR: Could not create socket!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
PLOG("Connect to server %s:%d...", addr, Sport);
|
printf("Connect to server %s:%d...\n", addr, Sport);
|
||||||
in_addr.sin_port = htons(Sport);
|
in_addr.sin_port = htons(Sport);
|
||||||
in_addr.sin_family = AF_INET;
|
in_addr.sin_family = AF_INET;
|
||||||
in_addr.sin_addr.s_addr = inet_addr(addr);
|
in_addr.sin_addr.s_addr = inet_addr(addr);
|
||||||
if (connect(s, (struct sockaddr *)&in_addr, sizeof (in_addr)) == -1) {
|
if (connect(s, (struct sockaddr *)&in_addr, sizeof (in_addr)) == -1) {
|
||||||
PERR("Could not connect to server!");
|
printf("ERROR: Could not connect to server!\n");
|
||||||
close(s);
|
close(s);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
PLOG("Sucessful connected to server.");
|
printf("Sucessfully connected to server.\n");
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
sendping(const char *addr, size_t dsize)
|
sendping(const char *addr, size_t dsize, int count)
|
||||||
{
|
{
|
||||||
Packet p;
|
Packet p;
|
||||||
int s;
|
int s;
|
||||||
|
@ -75,24 +63,24 @@ sendping(const char *addr, size_t dsize)
|
||||||
p.h.dsize = dsize;
|
p.h.dsize = dsize;
|
||||||
p.d = (char *)malloc(p.h.dsize);
|
p.d = (char *)malloc(p.h.dsize);
|
||||||
if (p.d == NULL) {
|
if (p.d == NULL) {
|
||||||
PERR("Out of memory!");
|
printf("ERROR: Out of memory!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
PINF("Try to send %d packets...", Numpackets);
|
printf("Trying to send %d packets...\n", count);
|
||||||
for (i = 0; i < Numpackets; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
forgepacket(&p, i + 1);
|
forgepacket(&p, i + 1);
|
||||||
|
|
||||||
n = sendpacket(s, &p);
|
n = sendpacket(s, &p);
|
||||||
if (n <= 0)
|
if (n <= 0)
|
||||||
break;
|
break;
|
||||||
if (n != (sizeof (Packetheader) + p.h.dsize)) {
|
if (n != (sizeof (Packetheader) + p.h.dsize)) {
|
||||||
PERR("size mismatch: %ld != %lu", n, sizeof (Packetheader) + p.h.dsize);
|
printf("ERROR: size mismatch: %ld != %lu\n", n, sizeof (Packetheader) + p.h.dsize);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
PINF("%lu %ld", p.h.id, n);
|
printf("%u %ld\n", p.h.id, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
close(s);
|
close(s);
|
||||||
|
@ -100,15 +88,15 @@ sendping(const char *addr, size_t dsize)
|
||||||
|
|
||||||
switch (n) {
|
switch (n) {
|
||||||
case 0:
|
case 0:
|
||||||
PERR("Disconnect, sent packets: %lu", i);
|
printf("Disconnect, sent packets: %lu\n", i);
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
case -1:
|
case -1:
|
||||||
PERR("Error, sent packets: %lu", i);
|
printf("Error, sent packets: %lu\n", i);
|
||||||
return 1;
|
return 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
PINF("Sucessful, sent packets: %lu", i);
|
printf("Sucessful, sent packets: %lu\n", i);
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -120,21 +108,18 @@ sendping(const char *addr, size_t dsize)
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
char serverip[16];
|
char serverip[16] = "0.0.0.0";
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned int startsize, endsize;
|
unsigned int startsize, endsize;
|
||||||
|
unsigned int count;
|
||||||
/* DHCP */
|
|
||||||
if (lwip_nic_init(0, 0, 0)) {
|
|
||||||
PERR("We got no IP address!");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* default settings */
|
/* default settings */
|
||||||
startsize = 1;
|
startsize = 1;
|
||||||
endsize = 32768;
|
endsize = 32768;
|
||||||
|
count = 1024;
|
||||||
verbose = 0;
|
verbose = 0;
|
||||||
|
|
||||||
|
#if 0
|
||||||
Genode::Xml_node argv_node = Genode::config()->xml_node().sub_node("argv");
|
Genode::Xml_node argv_node = Genode::config()->xml_node().sub_node("argv");
|
||||||
try {
|
try {
|
||||||
argv_node.attribute("serverip" ).value(serverip, sizeof(serverip));
|
argv_node.attribute("serverip" ).value(serverip, sizeof(serverip));
|
||||||
|
@ -142,14 +127,26 @@ main(int argc, char *argv[])
|
||||||
argv_node.attribute("endsize").value( &endsize );
|
argv_node.attribute("endsize").value( &endsize );
|
||||||
argv_node.attribute("verbose").value( &verbose );
|
argv_node.attribute("verbose").value( &verbose );
|
||||||
} catch(...) { }
|
} catch(...) { }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
for (int i = 1; i < argc; i += 2) {
|
||||||
|
if (strcmp(argv[i], "-serverip") == 0)
|
||||||
|
strncpy(serverip, argv[i+1], sizeof(serverip));
|
||||||
|
else if (strcmp(argv[i], "-startsize") == 0)
|
||||||
|
startsize = atoi(argv[i+1]);
|
||||||
|
else if (strcmp(argv[i], "-endsize") == 0)
|
||||||
|
endsize = atoi(argv[i+1]);
|
||||||
|
else if (strcmp(argv[i], "-count") == 0)
|
||||||
|
count = atoi(argv[i+1]);
|
||||||
|
}
|
||||||
|
|
||||||
if ((endsize + sizeof (Packetheader)) > Databuf) {
|
if ((endsize + sizeof (Packetheader)) > Databuf) {
|
||||||
PERR("endsize is greater than the servers' data buffer");
|
printf("ERROR: endsize is greater than the servers' data buffer\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = startsize; i <= endsize; i <<= 1)
|
for (i = startsize; i <= endsize; i <<= 1)
|
||||||
sendping(serverip, i);
|
sendping(serverip, i, count);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
TARGET = test-ping_client
|
|
||||||
LIBS = cxx env libc libc_lwip lwip
|
|
||||||
SRC_CC = main.cc ../pingpong.cc
|
|
||||||
|
|
||||||
CC_OPT_main += -fpermissive
|
|
||||||
|
|
||||||
INC_DIR += $(REP_DIR)/src/lib/lwip/include
|
|
|
@ -12,13 +12,8 @@
|
||||||
* under the terms of the GNU General Public License version 2.
|
* under the terms of the GNU General Public License version 2.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Genode includes */
|
|
||||||
#include <base/printf.h>
|
|
||||||
|
|
||||||
/* libc includes */
|
/* libc includes */
|
||||||
#include <sys/types.h>
|
#include <stdio.h>
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "pingpong.h"
|
#include "pingpong.h"
|
||||||
|
|
||||||
|
@ -36,7 +31,7 @@ checkpacket(size_t n, Packet *p)
|
||||||
{
|
{
|
||||||
/* check size of received packet */
|
/* check size of received packet */
|
||||||
if (n != (sizeof (Packetheader) + p->h.dsize)) {
|
if (n != (sizeof (Packetheader) + p->h.dsize)) {
|
||||||
PERR("packetsize mismatch!");
|
printf("ERROR: packetsize mismatch!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,13 +39,13 @@ checkpacket(size_t n, Packet *p)
|
||||||
|
|
||||||
/* check packet type */
|
/* check packet type */
|
||||||
if (p->h.type != Tping) {
|
if (p->h.type != Tping) {
|
||||||
PERR("wrong packet type!");
|
printf("ERROR: wrong packet type!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check payload */
|
/* check payload */
|
||||||
if (p->d[p->h.dsize - 1] != (p->h.id % 128)) {
|
if (p->d[p->h.dsize - 1] != (p->h.id % 128)) {
|
||||||
PERR("packet payload corrupt, expected: %d got: %d", (p->h.id % 128),
|
printf("ERROR: packet payload corrupt, expected: %d got: %d\n", (p->h.id % 128),
|
||||||
p->d[p->h.dsize - 1]);
|
p->d[p->h.dsize - 1]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -72,11 +67,11 @@ sendpacket(int s, Packet *p)
|
||||||
sent = send(s, b + nh, sizeof (Packetheader) - nh, 0);
|
sent = send(s, b + nh, sizeof (Packetheader) - nh, 0);
|
||||||
switch (sent) {
|
switch (sent) {
|
||||||
case -1:
|
case -1:
|
||||||
PERR("send(Packetheader) == -1");
|
printf("ERROR: send(Packetheader) == -1\n");
|
||||||
return nh;
|
return nh;
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
PERR("send(Packetheader) == 0, connection closed");
|
printf("ERROR: send(Packetheader) == 0, connection closed\n");
|
||||||
return nh;
|
return nh;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -92,11 +87,11 @@ sendpacket(int s, Packet *p)
|
||||||
sent = send(s, b + nd, dsize - nd, 0);
|
sent = send(s, b + nd, dsize - nd, 0);
|
||||||
switch (sent) {
|
switch (sent) {
|
||||||
case -1:
|
case -1:
|
||||||
PERR("send(data) == -1");
|
printf("ERROR: send(data) == -1\n");
|
||||||
return nd;
|
return nd;
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
PERR("send(data) == 0, connection closed");
|
printf("ERROR: send(data) == 0, connection closed\n");
|
||||||
return nd;
|
return nd;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -121,12 +116,12 @@ recvpacket(int s, Packet *p, char *dbuf, size_t ldbuf)
|
||||||
r = recv(s, b + nh, sizeof (Packetheader) - nh, 0);
|
r = recv(s, b + nh, sizeof (Packetheader) - nh, 0);
|
||||||
switch (r) {
|
switch (r) {
|
||||||
case -1:
|
case -1:
|
||||||
PERR("recv(Packetheader) == -1");
|
printf("ERROR: recv(Packetheader) == -1\n");
|
||||||
return nh;
|
return nh;
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
/* disconnect */
|
/* disconnect */
|
||||||
PERR("recv(Packetheader) == 0, connection closed");
|
//printf("ERROR: recv(Packetheader) == 0, connection closed\n");
|
||||||
return nh;
|
return nh;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -136,7 +131,7 @@ recvpacket(int s, Packet *p, char *dbuf, size_t ldbuf)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->h.dsize > ldbuf) {
|
if (p->h.dsize > ldbuf) {
|
||||||
PERR("packet payload is too large for dbuf!");
|
printf("ERROR: packet payload is too large for dbuf!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,12 +142,12 @@ recvpacket(int s, Packet *p, char *dbuf, size_t ldbuf)
|
||||||
r = recv(s, dbuf + nd, dsize - nd, 0);
|
r = recv(s, dbuf + nd, dsize - nd, 0);
|
||||||
switch (r) {
|
switch (r) {
|
||||||
case -1:
|
case -1:
|
||||||
PERR("recv(data) == -1");
|
printf("ERROR: recv(data) == -1\n");
|
||||||
return nh + nd;
|
return nh + nd;
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
/* disconnect */
|
/* disconnect */
|
||||||
PERR("recv(data) == 0, connection closed");
|
printf("ERROR: recv(data) == 0, connection closed\n");
|
||||||
return nh + nd;
|
return nh + nd;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -15,6 +15,32 @@
|
||||||
#ifndef _PINGPONG_H_
|
#ifndef _PINGPONG_H_
|
||||||
#define _PINGPONG_H_
|
#define _PINGPONG_H_
|
||||||
|
|
||||||
|
/* libc includes */
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#ifdef LWIP_NATIVE
|
||||||
|
#include <lwip/sockets.h>
|
||||||
|
#define accept(a,b,c) lwip_accept(a,b,c)
|
||||||
|
#define bind(a,b,c) lwip_bind(a,b,c)
|
||||||
|
#define close(s) lwip_close(s)
|
||||||
|
#define connect(a,b,c) lwip_connect(a,b,c)
|
||||||
|
#define listen(a,b) lwip_listen(a,b)
|
||||||
|
#define recv(a,b,c,d) lwip_recv(a,b,c,d)
|
||||||
|
#define select(a,b,c,d,e) lwip_select(a,b,c,d,e)
|
||||||
|
#define send(a,b,c,d) lwip_send(a,b,c,d)
|
||||||
|
#define socket(a,b,c) lwip_socket(a,b,c)
|
||||||
|
#else
|
||||||
|
/* libc includes */
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/select.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
Databuf = 1024 * 1024, // data buffer for server
|
Databuf = 1024 * 1024, // data buffer for server
|
||||||
Numpackets = 1024,
|
Numpackets = 1024,
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
TARGET = test-ping_server_libc_lwip
|
||||||
|
LIBS = base libc libc_lwip_nic_dhcp libc_lwip lwip libc_log config_args
|
||||||
|
SRC_CC = main.cc pingpong.cc
|
||||||
|
|
||||||
|
CC_OPT_main += -fpermissive
|
||||||
|
|
||||||
|
vpath main.cc $(PRG_DIR)/..
|
||||||
|
vpath pingpong.cc $(PRG_DIR)/../..
|
|
@ -0,0 +1,12 @@
|
||||||
|
TARGET = test-ping_server_lwip
|
||||||
|
LIBS = base libc lwip libc_log config_args
|
||||||
|
SRC_CC = main.cc pingpong.cc
|
||||||
|
|
||||||
|
CC_OPT += -DLWIP_NATIVE
|
||||||
|
|
||||||
|
CC_OPT_main += -fpermissive
|
||||||
|
|
||||||
|
INC_DIR += $(REP_DIR)/src/lib/lwip/include
|
||||||
|
|
||||||
|
vpath main.cc $(PRG_DIR)/..
|
||||||
|
vpath pingpong.cc $(PRG_DIR)/../..
|
|
@ -12,20 +12,12 @@
|
||||||
* under the terms of the GNU General Public License version 2.
|
* under the terms of the GNU General Public License version 2.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Genode includes */
|
|
||||||
#include <base/printf.h>
|
|
||||||
#include <util/string.h>
|
|
||||||
#include <os/config.h>
|
|
||||||
|
|
||||||
#include <lwip/genode.h>
|
|
||||||
|
|
||||||
/* libc includes */
|
/* libc includes */
|
||||||
#include <unistd.h>
|
#include <stdio.h>
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/socket.h>
|
#ifdef LWIP_NATIVE
|
||||||
#include <arpa/inet.h>
|
#include <lwip/genode.h>
|
||||||
#include <netinet/in.h>
|
#endif
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "../pingpong.h"
|
#include "../pingpong.h"
|
||||||
|
|
||||||
|
@ -37,19 +29,19 @@ announce(const char *addr)
|
||||||
int s;
|
int s;
|
||||||
struct sockaddr_in in_addr;
|
struct sockaddr_in in_addr;
|
||||||
|
|
||||||
PLOG("Create new socket...");
|
printf("Create new socket...\n");
|
||||||
s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||||
if (s == -1) {
|
if (s == -1) {
|
||||||
PERR("Could not create socket!");
|
printf("ERROR: Could not create socket!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
PLOG("Bind socket to %d", Sport);
|
printf("Bind socket to %d\n", Sport);
|
||||||
in_addr.sin_port = htons(Sport);
|
in_addr.sin_port = htons(Sport);
|
||||||
in_addr.sin_family = AF_INET;
|
in_addr.sin_family = AF_INET;
|
||||||
in_addr.sin_addr.s_addr = inet_addr(addr);
|
in_addr.sin_addr.s_addr = inet_addr(addr);
|
||||||
if ( bind(s, (struct sockaddr *)&in_addr, sizeof (in_addr)) == -1) {
|
if ( bind(s, (struct sockaddr *)&in_addr, sizeof (in_addr)) == -1) {
|
||||||
PERR("Could not bind!");
|
printf("ERROR: Could not bind!\n");
|
||||||
close(s);
|
close(s);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -69,9 +61,9 @@ recvping(const char *addr)
|
||||||
if (s == -1)
|
if (s == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
PLOG("Listen on %s:%d...", addr, Sport);
|
printf("Listen on %s:%d...\n", addr, Sport);
|
||||||
if (listen(s, 5) == -1) {
|
if (listen(s, 5) == -1) {
|
||||||
PERR("Could not listen!");
|
printf("ERROR: Could not listen!\n");
|
||||||
close(s);
|
close(s);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -80,19 +72,20 @@ recvping(const char *addr)
|
||||||
Packet p;
|
Packet p;
|
||||||
int act;
|
int act;
|
||||||
size_t packets;
|
size_t packets;
|
||||||
|
ssize_t packet_size = 0;
|
||||||
ssize_t n;
|
ssize_t n;
|
||||||
|
|
||||||
PINF("wait...");
|
printf("wait...\n");
|
||||||
c = accept(s, &caddr, &lcaddr);
|
c = accept(s, &caddr, &lcaddr);
|
||||||
if (c == -1) {
|
if (c == -1) {
|
||||||
PERR("Invalid socket from accept()!");
|
printf("ERROR: Invalid socket from accept()!\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
PLOG("client %d connected...", c);
|
printf("client %d connected...\n", c);
|
||||||
|
|
||||||
p.d = (char *)malloc(Databuf);
|
p.d = (char *)malloc(Databuf);
|
||||||
if (p.d == NULL) {
|
if (p.d == NULL) {
|
||||||
PERR("Out of memeory!");
|
printf("ERROR: Out of memeory!\n");
|
||||||
close(c);
|
close(c);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -100,14 +93,22 @@ recvping(const char *addr)
|
||||||
/* receive packets from client */
|
/* receive packets from client */
|
||||||
act = 1; packets = 0;
|
act = 1; packets = 0;
|
||||||
while (act) {
|
while (act) {
|
||||||
|
|
||||||
|
fd_set rfds;
|
||||||
|
FD_ZERO(&rfds);
|
||||||
|
FD_SET(c, &rfds);
|
||||||
|
|
||||||
|
if (select(c + 1, &rfds, NULL, NULL, NULL) == -1)
|
||||||
|
printf("ERROR: select() == -1\n");
|
||||||
|
|
||||||
n = recvpacket(c, &p, p.d, Databuf);
|
n = recvpacket(c, &p, p.d, Databuf);
|
||||||
switch (n) {
|
switch (n) {
|
||||||
case -1:
|
case -1:
|
||||||
/* error */
|
/* error */
|
||||||
PERR("recvpacket() == -1");
|
printf("ERROR: recvpacket() == -1\n");
|
||||||
case 0:
|
case 0:
|
||||||
/* disconnect */
|
/* disconnect */
|
||||||
PERR("disconnect");
|
//printf("ERROR: disconnect\n");
|
||||||
close(c);
|
close(c);
|
||||||
act = 0;
|
act = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -115,14 +116,17 @@ recvping(const char *addr)
|
||||||
/* check if packet is vaid */
|
/* check if packet is vaid */
|
||||||
if (checkpacket(n, &p)) {
|
if (checkpacket(n, &p)) {
|
||||||
act = 0;
|
act = 0;
|
||||||
|
} else {
|
||||||
|
packets++;
|
||||||
|
packet_size = n;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
PINF("%u %d", p.h.id, n);
|
printf("%u %d\n", p.h.id, n);
|
||||||
}
|
}
|
||||||
PINF("received packets: %u", packets);
|
printf("received %u packets of size %u\n", packets, packet_size);
|
||||||
|
|
||||||
free(p.d);
|
free(p.d);
|
||||||
}
|
}
|
||||||
|
@ -135,16 +139,20 @@ recvping(const char *addr)
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
char listenip[16];
|
char listenip[16] = "0.0.0.0";
|
||||||
|
|
||||||
|
#ifdef LWIP_NATIVE
|
||||||
|
lwip_tcpip_init();
|
||||||
/* DHCP */
|
/* DHCP */
|
||||||
if (lwip_nic_init(0, 0, 0)) {
|
if (lwip_nic_init(0, 0, 0)) {
|
||||||
PERR("We got no IP address!");
|
printf("ERROR: We got no IP address!\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
verbose = 0;
|
verbose = 0;
|
||||||
|
|
||||||
|
#if 0
|
||||||
Genode::Xml_node argv_node = Genode::config()->xml_node().sub_node("argv");
|
Genode::Xml_node argv_node = Genode::config()->xml_node().sub_node("argv");
|
||||||
try {
|
try {
|
||||||
argv_node.attribute("listenip" ).value(listenip, sizeof(listenip));
|
argv_node.attribute("listenip" ).value(listenip, sizeof(listenip));
|
||||||
|
@ -153,6 +161,7 @@ main(int argc, char *argv[])
|
||||||
PERR("listenip was not specified!");
|
PERR("listenip was not specified!");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
recvping(listenip);
|
recvping(listenip);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
TARGET = test-ping_server
|
|
||||||
LIBS = cxx env libc libc_lwip lwip
|
|
||||||
SRC_CC = main.cc ../pingpong.cc
|
|
||||||
|
|
||||||
CC_OPT_main += -fpermissive
|
|
||||||
|
|
||||||
INC_DIR += $(REP_DIR)/src/lib/lwip/include
|
|
Loading…
Reference in New Issue