ctorrent stat collector
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.

45 lines
895B

  1. #ifndef _HTTPD_H_
  2. #define _HTTPD_H_
  3. #include <netinet/in.h>
  4. #include "event.h"
  5. #include "list.h"
  6. struct httpd_con {
  7. struct sockaddr_in addr;
  8. struct event_fd *event;
  9. int fd;
  10. char *req_data;
  11. unsigned int req_size;
  12. char **req_headers;
  13. unsigned int req_header_cnt;
  14. char **req_args;
  15. unsigned int req_arg_cnt;
  16. };
  17. struct httpd_callback {
  18. struct list_head list;
  19. char *name;
  20. int wildcard;
  21. int (* callback)(struct httpd_con *con, void *privdata);
  22. void *privdata;
  23. };
  24. int httpd_send_header(struct httpd_con *con, char *code, char *type);
  25. int httpd_send_error(struct httpd_con *con, char *code, char *msg);
  26. struct httpd_callback * httpd_add_cb(const char *name, int flags, int (* cb)(struct httpd_con *con, void *privdata), void *privdata);
  27. int httpd_remove_cb(struct httpd_callback *cb);
  28. int httpd_accept_handler(int fd, void *privdata);
  29. int httpd_free(void);
  30. #endif // _HTTP_H_