Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

http.h 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #ifndef _GPXE_HTTP_H
  2. #define _GPXE_HTTP_H
  3. /** @file
  4. *
  5. * Hyper Text Transport Protocol
  6. *
  7. */
  8. #include <stdint.h>
  9. #include <gpxe/tcp.h>
  10. #include <gpxe/async.h>
  11. #include <gpxe/linebuf.h>
  12. #include <gpxe/uri.h>
  13. /** HTTP default port */
  14. #define HTTP_PORT 80
  15. /** HTTP receive state */
  16. enum http_rx_state {
  17. HTTP_RX_RESPONSE = 0,
  18. HTTP_RX_HEADER,
  19. HTTP_RX_DATA,
  20. HTTP_RX_DEAD,
  21. };
  22. /**
  23. * An HTTP request
  24. *
  25. */
  26. struct http_request {
  27. /** URI being fetched */
  28. struct uri *uri;
  29. /** Data buffer to fill */
  30. struct buffer *buffer;
  31. /** Asynchronous operation */
  32. struct async async;
  33. /** HTTP response code */
  34. unsigned int response;
  35. /** HTTP Content-Length */
  36. size_t content_length;
  37. /** Server address */
  38. struct sockaddr server;
  39. /** TCP application for this request */
  40. struct tcp_application tcp;
  41. /** Number of bytes already sent */
  42. size_t tx_offset;
  43. /** RX state */
  44. enum http_rx_state rx_state;
  45. /** Line buffer for received header lines */
  46. struct line_buffer linebuf;
  47. };
  48. extern int http_get ( struct uri *uri, struct buffer *buffer,
  49. struct async *parent );
  50. #endif /* _GPXE_HTTP_H */