thttp_dialog.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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_dialog.h
  23. * @brief HTTP Dialog.
  24. *
  25. * @author Mamadou Diop <diopmamadou(at)doubango[dot]org>
  26. *
  27. */
  28. #ifndef THTTP_DIALOG_H
  29. #define THTTP_DIALOG_H
  30. #include "tinyhttp_config.h"
  31. #include "tsk_fsm.h"
  32. #include "tsk_list.h"
  33. #include "tsk_buffer.h"
  34. THTTP_BEGIN_DECLS
  35. struct thttp_message_s;
  36. typedef uint64_t thttp_dialog_id_t;
  37. typedef struct thttp_dialog_s {
  38. TSK_DECLARE_OBJECT;
  39. thttp_dialog_id_t id;
  40. uint64_t timestamp;
  41. tsk_fsm_t* fsm;
  42. tsk_buffer_t* buf;
  43. struct thttp_session_s* session;
  44. struct thttp_action_s* action;
  45. tsk_bool_t answered;
  46. }
  47. thttp_dialog_t;
  48. typedef tsk_list_t thttp_dialogs_L_t;
  49. TINYHTTP_API int thttp_dialog_fsm_act(thttp_dialog_t* self, tsk_fsm_action_id , const struct thttp_message_s* , const struct thttp_action_s*);
  50. TINYHTTP_API thttp_dialog_t* thttp_dialog_new(struct thttp_session_s* session);
  51. thttp_dialog_t* thttp_dialog_get_oldest(thttp_dialogs_L_t* dialogs);
  52. TINYHTTP_GEXTERN const tsk_object_def_t *thttp_dialog_def_t;
  53. THTTP_END_DECLS
  54. #endif /* THTTP_DIALOG_H */