Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
692 B

  1. /* See LICENSE file for copyright and license details. */
  2. #ifndef CONNECTION_H
  3. #define CONNECTION_H
  4. #include "http.h"
  5. #include "server.h"
  6. #include "util.h"
  7. enum connection_state {
  8. C_VACANT,
  9. C_RECV_HEADER,
  10. C_SEND_HEADER,
  11. C_SEND_BODY,
  12. NUM_CONN_STATES,
  13. };
  14. struct connection {
  15. enum connection_state state;
  16. int fd;
  17. struct sockaddr_storage ia;
  18. struct request req;
  19. struct response res;
  20. struct buffer buf;
  21. size_t progress;
  22. };
  23. struct connection *connection_accept(int, struct connection *, size_t);
  24. void connection_log(const struct connection *);
  25. void connection_reset(struct connection *);
  26. void connection_serve(struct connection *, const struct server *);
  27. #endif /* CONNECTION_H */