tsip_transport_layer.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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_transport_layer.h
  23. * @brief SIP transport layer.
  24. *
  25. * @author Mamadou Diop <diopmamadou(at)doubango[dot]org>
  26. *
  27. */
  28. #ifndef TINYSIP_TRANSPORT_LAYER_H
  29. #define TINYSIP_TRANSPORT_LAYER_H
  30. #include "tinysip_config.h"
  31. #include "tinysip/transports/tsip_transport.h"
  32. #include "tinysip/tsip_message.h"
  33. #include "tsip.h"
  34. TSIP_BEGIN_DECLS
  35. typedef struct tsip_transport_layer_s {
  36. TSK_DECLARE_OBJECT;
  37. const tsip_stack_t *stack;
  38. tsk_bool_t running;
  39. tsip_transports_L_t *transports;
  40. }
  41. tsip_transport_layer_t;
  42. tsip_transport_layer_t* tsip_transport_layer_create(tsip_stack_t *stack);
  43. const tsip_transport_t* tsip_transport_layer_find_by_type(const tsip_transport_layer_t* self, tnet_socket_type_t type);
  44. const tsip_transport_t* tsip_transport_layer_find_by_idx(const tsip_transport_layer_t* self, int32_t idx);
  45. int tsip_transport_layer_add(tsip_transport_layer_t* self, const char* local_host, tnet_port_t local_port, tnet_socket_type_t type, const char* description);
  46. int tsip_transport_layer_remove(tsip_transport_layer_t* self, const char* description);
  47. int tsip_transport_layer_send(const tsip_transport_layer_t* self, const char *branch, tsip_message_t *msg);
  48. int tsip_transport_createTempSAs(const tsip_transport_layer_t *self);
  49. int tsip_transport_ensureTempSAs(const tsip_transport_layer_t *self, const tsip_response_t *r401_407, int64_t expires);
  50. int tsip_transport_startSAs(const tsip_transport_layer_t* self, const void* ik, const void* ck);
  51. int tsip_transport_cleanupSAs(const tsip_transport_layer_t *self);
  52. int tsip_transport_layer_remove_callid_from_stream_peers(tsip_transport_layer_t *self, const char* callid);
  53. tsk_bool_t tsip_transport_layer_have_stream_peer_with_remote_ip(const tsip_transport_layer_t *self, const char* remote_ip, tnet_port_t remote_port);
  54. int tsip_transport_layer_start(tsip_transport_layer_t* self);
  55. int tsip_transport_layer_shutdown(tsip_transport_layer_t* self);
  56. TINYSIP_GEXTERN const tsk_object_def_t *tsip_transport_layer_def_t;
  57. TSIP_END_DECLS
  58. #endif /* TINYSIP_TRANSPORT_LAYER_H */