summaryrefslogtreecommitdiffstats
path: root/src/include/gpxe
diff options
context:
space:
mode:
authorMichael Brown2007-01-12 20:18:13 +0100
committerMichael Brown2007-01-12 20:18:13 +0100
commit497c3a5aad062cd8d896656b04b7386b0b6b7ee6 (patch)
treeecaad20a027a3984bf834edc11c5763dfbed5997 /src/include/gpxe
parentWhitespace fix (diff)
downloadipxe-497c3a5aad062cd8d896656b04b7386b0b6b7ee6.tar.gz
ipxe-497c3a5aad062cd8d896656b04b7386b0b6b7ee6.tar.xz
ipxe-497c3a5aad062cd8d896656b04b7386b0b6b7ee6.zip
Fixed HTTP
Diffstat (limited to 'src/include/gpxe')
-rw-r--r--src/include/gpxe/http.h56
1 files changed, 28 insertions, 28 deletions
diff --git a/src/include/gpxe/http.h b/src/include/gpxe/http.h
index f858c5ffb..ca0afb942 100644
--- a/src/include/gpxe/http.h
+++ b/src/include/gpxe/http.h
@@ -10,51 +10,51 @@
#include <stdint.h>
#include <gpxe/tcp.h>
#include <gpxe/async.h>
+#include <gpxe/linebuf.h>
/** HTTP default port */
#define HTTP_PORT 80
-enum http_state {
- HTTP_INIT_CONN = 0,
- HTTP_REQUEST_FILE,
- HTTP_PARSE_HEADER,
- HTTP_RECV_FILE,
- HTTP_DONE,
+/** HTTP receive state */
+enum http_rx_state {
+ HTTP_RX_RESPONSE = 0,
+ HTTP_RX_HEADER,
+ HTTP_RX_DATA,
+ HTTP_RX_DEAD,
};
/**
- * A HTTP request
+ * An HTTP request
*
*/
-struct http_request;
-
struct http_request {
/** Server address */
struct sockaddr_tcpip server;
+ /** Server host name */
+ const char *hostname;
+ /** Filename */
+ const char *filename;
+ /** Data buffer to fill */
+ struct buffer *buffer;
+
+ /** HTTP response code */
+ unsigned int response;
+ /** HTTP Content-Length */
+ size_t content_length;
+
+ /** 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;
- /** Current state */
- enum http_state state;
- /** File to download */
- const char *filename;
- /** Size of file downloading */
- size_t file_size;
- /** Number of bytes recieved so far */
- size_t file_recv;
- /** Callback function
- *
- * @v http HTTP request struct
- * @v data Received data
- * @v len Length of received data
- *
- * This function is called for all data received from the
- * remote server.
- */
- void ( *callback ) ( struct http_request *http, char *data, size_t len );
/** Asynchronous operation */
struct async_operation aop;
};
-extern struct async_operation * get_http ( struct http_request *http );
+extern struct async_operation * http_get ( struct http_request *http );
#endif /* _GPXE_HTTP_H */