thttp_event.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Copyright (C) 2010-2011 Mamadou Diop.
  3. *
  4. * Contact: Mamadou Diop <diopmamadou(at)doubango[dot]org>
  5. *
  6. * This file is part of Open Source Doubango Framework.
  7. *
  8. * DOUBANGO is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * DOUBANGO is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with DOUBANGO.
  20. *
  21. */
  22. /**@file thttp_event.h
  23. * @brief HTTP/HTTPS event.
  24. *
  25. * @author Mamadou Diop <diopmamadou(at)doubango[dot]org>
  26. *
  27. */
  28. #ifndef TINYHTTP_EVENT_H
  29. #define TINYHTTP_EVENT_H
  30. #include "tinyhttp_config.h"
  31. #include "tinyhttp/thttp_session.h"
  32. #include "tsk_object.h"
  33. THTTP_BEGIN_DECLS
  34. #define THTTP_EVENT(self) ((thttp_event_t*)(self))
  35. typedef enum thttp_event_type_e {
  36. thttp_event_dialog_started,
  37. thttp_event_message,
  38. thttp_event_auth_failed,
  39. thttp_event_closed,
  40. thttp_event_transport_error,
  41. thttp_event_dialog_terminated
  42. }
  43. thttp_event_type_t;
  44. typedef struct thttp_event_s {
  45. TSK_DECLARE_OBJECT;
  46. thttp_event_type_t type;
  47. const thttp_session_handle_t* session;
  48. char* description;
  49. struct thttp_message_s *message;
  50. }
  51. thttp_event_t;
  52. typedef int (*thttp_stack_callback_f)(const thttp_event_t *httpevent);
  53. thttp_event_t* thttp_event_create(thttp_event_type_t type, const thttp_session_handle_t* session, const char* description, const thttp_message_t* message);
  54. TINYHTTP_GEXTERN const void *thttp_event_def_t;
  55. THTTP_END_DECLS
  56. #endif /* TINYHTTP_EVENT_H */