tsip_uri.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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_uri.h
  23. * @brief SIP/SIPS/TEL URI.
  24. *
  25. * @author Mamadou Diop <diopmamadou(at)doubango[dot]org>
  26. *
  27. */
  28. #ifndef TINYSIP_URI_H
  29. #define TINYSIP_URI_H
  30. #include "tinysip_config.h"
  31. #include "tsk_object.h"
  32. #include "tsk_params.h"
  33. #include "tsk_buffer.h"
  34. TSIP_BEGIN_DECLS
  35. #define TSIP_URI_IS_SECURE(uri) ((uri && uri->type==uri_sips) ? tsk_true : tsk_false)
  36. typedef enum tsip_uri_type_e {
  37. uri_unknown,
  38. uri_sip,
  39. uri_sips,
  40. uri_tel
  41. }
  42. tsip_uri_type_t;
  43. typedef enum tsip_host_type_e {
  44. host_unknown,
  45. host_hostname,
  46. host_ipv4,
  47. host_ipv6
  48. }
  49. tsip_host_type_t;
  50. ////////////////////////////////////////////////////////////////////////////////////////////////////
  51. ///
  52. /// @brief SIP/SIPS/TEL URI.
  53. ///
  54. ////////////////////////////////////////////////////////////////////////////////////////////////////
  55. typedef struct tsip_uri_s {
  56. TSK_DECLARE_OBJECT;
  57. tsip_uri_type_t type;
  58. char *scheme;
  59. char *host; /**< Host name. Hostname or IPv4address or IPv6address. */
  60. tsip_host_type_t host_type; /**< IPv4 or IPv6 or domain name. */
  61. uint16_t port;
  62. char *user_name;
  63. char *password;
  64. char *display_name;
  65. tsk_params_L_t *params; /**< list of @ref tsk_param_t elements containing all parameters. */
  66. }
  67. tsip_uri_t;
  68. typedef tsk_list_t tsip_uris_L_t;
  69. TINYSIP_API tsip_uri_t* tsip_uri_create(tsip_uri_type_t type);
  70. TINYSIP_API int tsip_uri_serialize(const tsip_uri_t *uri, tsk_bool_t with_params, tsk_bool_t quote, tsk_buffer_t *output);
  71. TINYSIP_API char* tsip_uri_tostring(const tsip_uri_t *uri, tsk_bool_t with_params, tsk_bool_t quote);
  72. TINYSIP_API tsip_uri_t *tsip_uri_clone(const tsip_uri_t *uri, tsk_bool_t with_params, tsk_bool_t quote);
  73. TINYSIP_GEXTERN const tsk_object_def_t *tsip_uri_def_t;
  74. TSIP_END_DECLS
  75. #endif /* TINYSIP_URI_H */