tsip_dialog_layer.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 tsip_dialog.h
  23. * @brief SIP dialog layer.
  24. *
  25. * @author Mamadou Diop <diopmamadou(at)doubango[dot]org>
  26. *
  27. */
  28. #ifndef TINYSIP_DIALOG_LAYER_H
  29. #define TINYSIP_DIALOG_LAYER_H
  30. #include "tinysip_config.h"
  31. #include "tsip.h"
  32. #include "tinysip/dialogs/tsip_dialog.h"
  33. #include "tsk_condwait.h"
  34. #include "tsk_safeobj.h"
  35. #include "tsk_list.h"
  36. TSIP_BEGIN_DECLS
  37. typedef struct tsip_dialog_layer_s {
  38. TSK_DECLARE_OBJECT;
  39. const tsip_stack_t *stack;
  40. tsip_dialogs_L_t *dialogs;
  41. struct {
  42. tsk_bool_t inprogress;
  43. tsk_bool_t phase2; /* whether unregistering? */
  44. tsk_condwait_handle_t* condwait;
  45. } shutdown;
  46. TSK_DECLARE_SAFEOBJ;
  47. }
  48. tsip_dialog_layer_t;
  49. typedef tsk_list_t tsip_dialog_layers_L_t;
  50. tsip_dialog_layer_t* tsip_dialog_layer_create(tsip_stack_t* stack);
  51. TINYSIP_API tsip_dialog_t* tsip_dialog_layer_find_by_ss(tsip_dialog_layer_t *self, const tsip_ssession_handle_t *ss);
  52. tsip_dialog_t* tsip_dialog_layer_find_by_ssid(tsip_dialog_layer_t *self, tsip_ssession_id_t ssid);
  53. tsip_dialog_t* tsip_dialog_layer_find_by_callid(tsip_dialog_layer_t *self, const char* callid);
  54. tsk_bool_t tsip_dialog_layer_have_dialog_with_callid(const tsip_dialog_layer_t *self, const char* callid);
  55. tsk_size_t tsip_dialog_layer_count_active_calls(tsip_dialog_layer_t *self);
  56. TINYSIP_API int tsip_dialog_layer_shutdownAll(tsip_dialog_layer_t *self);
  57. int tsip_dialog_layer_signal_stack_disconnected(tsip_dialog_layer_t *self);
  58. int tsip_dialog_layer_signal_peer_disconnected(tsip_dialog_layer_t *self, const struct tsip_transport_stream_peer_s* peer);
  59. int tsip_dialog_layer_remove_callid_from_stream_peers(tsip_dialog_layer_t *self, const char* callid);
  60. tsip_dialog_t* tsip_dialog_layer_new(tsip_dialog_layer_t *self, tsip_dialog_type_t type, const tsip_ssession_t *ss);
  61. int tsip_dialog_layer_remove(tsip_dialog_layer_t *self, const tsip_dialog_t *dialog);
  62. int tsip_dialog_layer_handle_incoming_msg(const tsip_dialog_layer_t *self, tsip_message_t* message);
  63. TINYSIP_GEXTERN const tsk_object_def_t *tsip_dialog_layer_def_t;
  64. TSIP_END_DECLS
  65. #endif /* TINYSIP_DIALOG_LAYER_H */