diff options
author | Michael Brown <mcb30@etherboot.org> | 2007-01-15 08:49:10 +0000 |
---|---|---|
committer | Michael Brown <mcb30@etherboot.org> | 2007-01-15 08:49:10 +0000 |
commit | 4e20d73bb52326261f8cf49c20d6de2edea309ee (patch) | |
tree | 3d24466a78c4c8f53294384b76e62e871eb96def /src/tests | |
parent | ec75b269d3fd1ba7a1fbff5309c6f30b207a5e71 (diff) | |
download | ipxe-4e20d73bb52326261f8cf49c20d6de2edea309ee.tar.gz |
Gave asynchronous operations approximate POSIX signal semantics. This
will enable us to cascade async operations, which is necessary in order to
properly support DNS. (For example, an HTTP request may have to redirect
to a new location and will have to perform a new DNS lookup, so we can't
just rely on doing the name lookup at the time of parsing the initial
URL).
Anything other than HTTP is probably broken right now; I'll fix the others
up asap.
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/aoeboot.c | 1 | ||||
-rw-r--r-- | src/tests/dhcptest.c | 5 | ||||
-rw-r--r-- | src/tests/ftptest.c | 52 | ||||
-rw-r--r-- | src/tests/hellotest.c | 43 |
4 files changed, 6 insertions, 95 deletions
diff --git a/src/tests/aoeboot.c b/src/tests/aoeboot.c index 9d3013b24..0fa9ba822 100644 --- a/src/tests/aoeboot.c +++ b/src/tests/aoeboot.c @@ -1,5 +1,6 @@ #include <stdint.h> #include <stdlib.h> +#include <errno.h> #include <vsprintf.h> #include <console.h> #include <gpxe/netdevice.h> diff --git a/src/tests/dhcptest.c b/src/tests/dhcptest.c index 5d6f52dc2..f35a34786 100644 --- a/src/tests/dhcptest.c +++ b/src/tests/dhcptest.c @@ -1,5 +1,6 @@ #include <string.h> #include <stdlib.h> +#include <errno.h> #include <vsprintf.h> #include <byteswap.h> #include <gpxe/ip.h> @@ -7,6 +8,8 @@ #include <gpxe/iscsi.h> #include <gpxe/netdevice.h> +#if 0 + static int test_dhcp_aoe_boot ( struct net_device *netdev, char *aoename ) { unsigned int drivenum; @@ -263,3 +266,5 @@ int test_dhcp ( struct net_device *netdev ) { out_no_del_ipv4: return rc; } + +#endif diff --git a/src/tests/ftptest.c b/src/tests/ftptest.c deleted file mode 100644 index fe08ec522..000000000 --- a/src/tests/ftptest.c +++ /dev/null @@ -1,52 +0,0 @@ -#include <stdint.h> -#include <string.h> -#include <byteswap.h> -#include <console.h> -#include <vsprintf.h> -#include <gpxe/async.h> -#include <gpxe/buffer.h> -#include <gpxe/ftp.h> - -static void print_ftp_response ( char *data, size_t len ) { - unsigned int i; - char c; - - for ( i = 0 ; i < len ; i++ ) { - c = data[i]; - if ( c == '\r' ) { - /* Print nothing */ - } else if ( ( c == '\n' ) || ( c >= 32 ) || ( c <= 126 ) ) { - putchar ( c ); - } else { - putchar ( '.' ); - } - } -} - -void test_ftp ( struct sockaddr_tcpip *server, const char *filename ) { - char data[256]; - struct buffer buffer; - struct ftp_request ftp; - int rc; - - printf ( "FTP fetching %s\n", filename ); - - memset ( &buffer, 0, sizeof ( buffer ) ); - buffer.addr = virt_to_user ( data ); - buffer.len = sizeof ( data ); - - memset ( &ftp, 0, sizeof ( ftp ) ); - memcpy ( &ftp.server, server, sizeof ( ftp.server ) ); - ftp.filename = filename; - ftp.buffer = &buffer; - - rc = async_wait ( ftp_get ( &ftp ) ); - if ( rc ) { - printf ( "FTP fetch failed\n" ); - return; - } - - printf ( "FTP received %d bytes\n", buffer.fill ); - - print_ftp_response ( data, buffer.fill ); -} diff --git a/src/tests/hellotest.c b/src/tests/hellotest.c deleted file mode 100644 index a873c03e2..000000000 --- a/src/tests/hellotest.c +++ /dev/null @@ -1,43 +0,0 @@ -#include <stdint.h> -#include <string.h> -#include <byteswap.h> -#include <console.h> -#include <vsprintf.h> -#include <gpxe/async.h> -#include <gpxe/hello.h> - -static void test_hello_callback ( char *data, size_t len ) { - unsigned int i; - char c; - - for ( i = 0 ; i < len ; i++ ) { - c = data[i]; - if ( c == '\r' ) { - /* Print nothing */ - } else if ( ( c == '\n' ) || ( c >= 32 ) || ( c <= 126 ) ) { - putchar ( c ); - } else { - putchar ( '.' ); - } - } -} - -void test_hello ( struct sockaddr_tcpip *server, const char *message ) { - /* Quick and dirty hack */ - struct sockaddr_in *sin = ( struct sockaddr_in * ) server; - struct hello_request hello; - int rc; - - printf ( "Saying \"%s\" to %s:%d\n", message, - inet_ntoa ( sin->sin_addr ), ntohs ( sin->sin_port ) ); - - memset ( &hello, 0, sizeof ( hello ) ); - memcpy ( &hello.server, server, sizeof ( hello.server ) ); - hello.message = message; - hello.callback = test_hello_callback; - - rc = async_wait ( say_hello ( &hello ) ); - if ( rc ) { - printf ( "HELLO fetch failed\n" ); - } -} |