summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorDerek Pryor2006-08-11 16:13:02 +0200
committerDerek Pryor2006-08-11 16:13:02 +0200
commit25ea34a8d75f637c4b4e80c4ec3891ddc56e80b0 (patch)
tree786e7bd76109d8b1492e655aff2052e939763fe3 /src/include
parentcommand->data_{in,out} are now userptr_t, so it is invalid to compare (diff)
downloadipxe-25ea34a8d75f637c4b4e80c4ec3891ddc56e80b0.tar.gz
ipxe-25ea34a8d75f637c4b4e80c4ec3891ddc56e80b0.tar.xz
ipxe-25ea34a8d75f637c4b4e80c4ec3891ddc56e80b0.zip
New HTTP protocol and test code
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gpxe/http.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/include/gpxe/http.h b/src/include/gpxe/http.h
new file mode 100644
index 000000000..02c9be410
--- /dev/null
+++ b/src/include/gpxe/http.h
@@ -0,0 +1,58 @@
+#ifndef _GPXE_HTTP_H
+#define _GPXE_HTTP_H
+
+/** @file
+ *
+ * Hyper Text Transport Protocol
+ *
+ */
+
+#include <stdint.h>
+#include <gpxe/tcp.h>
+#include <gpxe/async.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,
+};
+
+/**
+ * A HTTP request
+ *
+ */
+struct http_request;
+
+struct http_request {
+ /** TCP connection for this request */
+ struct tcp_connection 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 );
+
+#endif /* _GPXE_HTTP_H */