david/ipxe
Archived
1
0
This repository has been archived on 2020-12-06. You can view files and clone it, but cannot push or open issues or pull requests.
ipxe/src/include/gpxe/http.h

61 lines
1.2 KiB
C
Raw Normal View History

2006-08-11 16:13:02 +02:00
#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 {
/** Server address */
struct sockaddr_tcpip server;
/** TCP application for this request */
struct tcp_application tcp;
2006-08-11 16:13:02 +02:00
/** 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 */