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.
This commit is contained in:
Michael Brown
2007-01-15 08:49:10 +00:00
parent ec75b269d3
commit 4e20d73bb5
26 changed files with 656 additions and 248 deletions

View File

@@ -11,6 +11,7 @@
#include <gpxe/tcp.h>
#include <gpxe/async.h>
#include <gpxe/linebuf.h>
#include <gpxe/uri.h>
/** HTTP default port */
#define HTTP_PORT 80
@@ -28,33 +29,29 @@ enum http_rx_state {
*
*/
struct http_request {
/** Server address */
struct sockaddr_tcpip server;
/** Server host name */
const char *hostname;
/** Filename */
const char *filename;
/** URI being fetched */
struct uri *uri;
/** Data buffer to fill */
struct buffer *buffer;
/** Asynchronous operation */
struct async async;
/** HTTP response code */
unsigned int response;
/** HTTP Content-Length */
size_t content_length;
/** TCP application for this request */
struct tcp_application tcp;
/** Number of bytes already sent */
size_t tx_offset;
/** RX state */
enum http_rx_state rx_state;
/** Line buffer for received header lines */
struct line_buffer linebuf;
/** TCP application for this request */
struct tcp_application tcp;
/** Asynchronous operation */
struct async_operation aop;
};
extern struct async_operation * http_get ( struct http_request *http );
extern int http_get ( struct uri *uri, struct buffer *buffer,
struct async *parent );
#endif /* _GPXE_HTTP_H */