network.h 469 B

123456789101112131415161718192021222324252627282930313233
  1. #ifndef NETWORK_H
  2. #define NETWORK_H
  3. #include <openssl/bio.h>
  4. typedef struct
  5. {
  6. unsigned short status;
  7. uint64_t total_size;
  8. uint64_t from;
  9. uint64_t to;
  10. uint64_t size;
  11. char* location;
  12. char* buf;
  13. } http_header;
  14. typedef struct
  15. {
  16. BIO* bio;
  17. http_header* header;
  18. char* host;
  19. char* rq;
  20. } connection;
  21. int net_write(connection* con);
  22. int net_read(connection* con);
  23. void net_close(connection* con);
  24. void free_http_header(http_header* header);
  25. #endif // NETWORK_H