Hello,
On Thu, Mar 10, 2011 at 11:55:50PM +0300, Александр Домо wrote:
> What's interesting, the nic_drv + lwip_httpsrv config pings ok, my config
> doesn't.
I built current SVN head with the patch attached to this email. After
make run/lwip_httpsrv_lx
I got a running http_srv with the libc plugin. Could you please check
if this works for you too. BTW, your using Genode/Linux, right?
Greets
--
Christian Helmuth
Genode Labs
http://www.genode-labs.com/ · http://genode.org/
Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth
Index: libports/run/lwip_httpsrv_lx.run
===================================================================
--- libports/run/lwip_httpsrv_lx.run (revision 0)
+++ libports/run/lwip_httpsrv_lx.run (revision 0)
@@ -0,0 +1,48 @@
+build {
+ core init drivers/timer drivers/nic
+ ldso test/lwip/http_srv
+}
+
+create_boot_directory
+
+install_config {
+<config verbose="yes" prio_levels="2">
+ <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="512K"/>
+ <provides> <service name="Timer"/> </provides>
+ </start>
+
+ <start name="nic_drv">
+ <resource name="RAM" quantum="2M"/>
+ <provides> <service name="Nic"/> </provides>
+ </start>
+
+ <start name="test-lwip_httpsrv">
+ <resource name="RAM" quantum="1M"/>
+ </start>
+</config>
+}
+
+build_boot_image { \
+ core init timer nic_drv
+ ldso libc.lib.so libc_log.lib.so lwip.lib.so test-lwip_httpsrv
+}
+
+run_genode_until forever
Index: libports/src/test/lwip/http_srv/main.cc
===================================================================
--- libports/src/test/lwip/http_srv/main.cc (revision 141)
+++ libports/src/test/lwip/http_srv/main.cc (working copy)
@@ -24,8 +24,12 @@
/* LwIP includes */
extern "C" {
-#include <lwip/sockets.h>
-#include <lwip/api.h>
+//#include <lwip/sockets.h>
+//#include <lwip/api.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <unistd.h>
}
#include <lwip/genode.h>
@@ -49,7 +53,7 @@
/* Read the data from the port, blocking if nothing yet there.
We assume the request (the part we care about) is in one packet */
- buflen = lwip_recv(conn, buf, 1024, 0);
+ buflen = recv(conn, buf, 1024, 0);
PDBG("Packet received!");
/* Ignore all receive errors */
@@ -67,10 +71,10 @@
PDBG("Will send response");
/* Send http header */
- lwip_send(conn, http_html_hdr, Genode::strlen(http_html_hdr), 0);
+ send(conn, http_html_hdr, Genode::strlen(http_html_hdr), 0);
/* Send our HTML page */
- lwip_send(conn, http_index_html, Genode::strlen(http_index_html), 0);
+ send(conn, http_index_html, Genode::strlen(http_index_html), 0);
}
}
}
@@ -80,16 +84,16 @@
{
int s;
- lwip_tcpip_init();
+// lwip_tcpip_init();
+//
+// /* Initialize network stack and do DHCP */
+// if (lwip_nic_init(0, 0, 0)) {
+// PERR("We got no IP address!");
+// return -1;
+// }
- /* Initialize network stack and do DHCP */
- if (lwip_nic_init(0, 0, 0)) {
- PERR("We got no IP address!");
- return -1;
- }
-
PDBG("Create new socket ...");
- if((s = lwip_socket(AF_INET, SOCK_STREAM, 0)) < 0) {
+ if((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
PERR("No socket available!");
return -1;
}
@@ -99,13 +103,13 @@
in_addr.sin_family = AF_INET;
in_addr.sin_port = htons(80);
in_addr.sin_addr.s_addr = INADDR_ANY;
- if(lwip_bind(s, (struct sockaddr*)&in_addr, sizeof(in_addr))) {
+ if(bind(s, (struct sockaddr*)&in_addr, sizeof(in_addr))) {
PERR("bind failed!");
return -1;
}
PDBG("Now, I will listen ...");
- if(lwip_listen(s, 5)) {
+ if(listen(s, 5)) {
PERR("listen failed!");
return -1;
}
@@ -114,13 +118,13 @@
while(true) {
struct sockaddr addr;
socklen_t len = sizeof(addr);
- int client = lwip_accept(s, &addr, &len);
+ int client = accept(s, &addr, &len);
if(client < 0) {
PWRN("Invalid socket from accept!");
continue;
}
http_server_serve(client);
- lwip_close(client);
+ close(client);
}
return 0;
}
Index: libports/src/test/lwip/http_srv/target.mk
===================================================================
--- libports/src/test/lwip/http_srv/target.mk (revision 141)
+++ libports/src/test/lwip/http_srv/target.mk (working copy)
@@ -1,5 +1,5 @@
TARGET = test-lwip_httpsrv
-LIBS = cxx env lwip libc libc_log
+LIBS = cxx env libc libc_log libc_lwip_nic_dhcp
SRC_CC = main.cc
INC_DIR += $(REP_DIR)/src/lib/lwip/include
------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Genode-main mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/genode-main