tmsrp_uri.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * Copyright (C) 2009 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 tmsrp_uri.h
  23. * @brief MSRP/MSRPS URI.
  24. *
  25. * @author Mamadou Diop <diopmamadou [at) doubango (DOT) org>
  26. *
  27. */
  28. #ifndef TINYMSRP_URI_H
  29. #define TINYMSRP_URI_H
  30. #include "tinymsrp_config.h"
  31. #include "tsk_params.h"
  32. #include "tsk_buffer.h"
  33. TMSRP_BEGIN_DECLS
  34. #define TMSRP_URI_IS_SECURE(uri) ((uri) && (tsk_striequals(uri->scheme, "msrps") ? 1 : 0))
  35. #define TMSRP_URI(self) ((tmsrp_uri_t*)(self))
  36. /** The type of the authority host.
  37. */
  38. typedef enum tmsrp_host_type_e {
  39. tmsrp_host_unknown,
  40. tmsrp_host_hostname,
  41. tmsrp_host_ipv4,
  42. tmsrp_host_ipv6
  43. }
  44. tmsrp_host_type_t;
  45. /**
  46. * @struct tmsrp_uri_s
  47. *
  48. * @brief MSRP/MSRPS/TEL URI.
  49. **/
  50. typedef struct tmsrp_uri_s {
  51. TSK_DECLARE_OBJECT;
  52. char *scheme;
  53. struct {
  54. char* userinfo;
  55. tmsrp_host_type_t host_type; /**< IPv4 or IPv6 or domain name. */
  56. char* host;
  57. int32_t port;
  58. } authority;
  59. char* session_id;
  60. char* transport;
  61. tsk_params_L_t *params; /**< list of @ref tsk_param_t elements containing all parameters. */
  62. }
  63. tmsrp_uri_t;
  64. typedef tsk_list_t tmsrp_uris_L_t;
  65. TINYMSRP_API tmsrp_uri_t* tmsrp_uri_create(const char*scheme, const char* host, tmsrp_host_type_t host_type, int32_t port, const char* session_id, const char*transport);
  66. TINYMSRP_API tmsrp_uri_t* tmsrp_uri_create_null();
  67. TINYMSRP_API int tmsrp_uri_serialize(const tmsrp_uri_t *uri, tsk_buffer_t *output);
  68. TINYMSRP_API char* tmsrp_uri_tostring(const tmsrp_uri_t *uri);
  69. TINYMSRP_API tmsrp_uri_t *tmsrp_uri_clone(const tmsrp_uri_t *uri);
  70. TINYMSRP_GEXTERN const tsk_object_def_t *tmsrp_uri_def_t;
  71. TMSRP_END_DECLS
  72. #endif /* TINYMSRP_URI_H */