tsdp_message.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * Copyright (C) 2010-2015 Mamadou DIOP.
  3. *
  4. * This file is part of Open Source Doubango Framework.
  5. *
  6. * DOUBANGO is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * DOUBANGO is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with DOUBANGO.
  18. *
  19. */
  20. /**@file tsdp_message.h
  21. * @brief SDP message.
  22. *
  23. */
  24. #ifndef TINYSDP_MESSAGE_H
  25. #define TINYSDP_MESSAGE_H
  26. #include "tinysdp_config.h"
  27. #include "tinysdp/headers/tsdp_header.h"
  28. #include "tinysdp/headers/tsdp_header_M.h"
  29. TSDP_BEGIN_DECLS
  30. typedef struct tsdp_message_s {
  31. TSK_DECLARE_OBJECT;
  32. //! List of @ref tsdp_header_t elements.
  33. tsdp_headers_L_t* headers;
  34. }
  35. tsdp_message_t;
  36. typedef tsdp_message_t tsdp_offer_t;
  37. typedef tsdp_message_t tsdp_answer_t;
  38. typedef tsdp_message_t tsdp_caps_t;
  39. TINYSDP_API int tsdp_message_add_header(tsdp_message_t *self, const tsdp_header_t *hdr);
  40. TINYSDP_API int tsdp_message_add_headers(tsdp_message_t *self, ...);
  41. #if defined(__SYMBIAN32__) && 0
  42. static void TSDP_MESSAGE_ADD_HEADER(tsdp_message_t *self, ...)
  43. {
  44. va_list ap;
  45. tsdp_header_t *header;
  46. const tsk_object_def_t *objdef;
  47. va_start(ap, self);
  48. objdef = va_arg(ap, const tsk_object_def_t*);
  49. header = (tsdp_header_t *)tsk_object_new_2(objdef, &ap);
  50. va_end(ap);
  51. tsdp_message_add_header(self, header);
  52. tsk_object_unref(header);
  53. }
  54. #else
  55. #define TSDP_MESSAGE_ADD_HEADER(self, objdef, ...) \
  56. { \
  57. tsdp_header_t *header = (tsdp_header_t *)tsk_object_new(objdef, ##__VA_ARGS__); \
  58. tsdp_message_add_header(self, header); \
  59. tsk_object_unref(header); \
  60. }
  61. #endif
  62. TINYSDP_API const tsdp_header_t *tsdp_message_get_headerAt(const tsdp_message_t *self, tsdp_header_type_t type, tsk_size_t index);
  63. TINYSDP_API const tsdp_header_t *tsdp_message_get_header(const tsdp_message_t *self, tsdp_header_type_t type);
  64. TINYSDP_API const tsdp_header_A_t* tsdp_message_get_headerA_at(const tsdp_message_t* self, const char* field, tsk_size_t index);
  65. TINYSDP_API const tsdp_header_A_t* tsdp_message_get_headerA(const tsdp_message_t* self, const char* field);
  66. TINYSDP_API const tsdp_header_t *tsdp_message_get_headerByName(const tsdp_message_t *self, char name);
  67. TINYSDP_API int tsdp_message_get_sess_version(const tsdp_message_t *self, uint32_t *version);
  68. TINYSDP_API int tsdp_message_serialize(const tsdp_message_t *self, tsk_buffer_t *output);
  69. TINYSDP_API char* tsdp_message_tostring(const tsdp_message_t *self);
  70. TINYSDP_API tsdp_message_t* tsdp_message_create_empty(const char* addr, tsk_bool_t ipv6, uint32_t version);
  71. TINYSDP_API tsdp_message_t* tsdp_message_clone(const tsdp_message_t *self);
  72. TINYSDP_API int tsdp_message_add_media(tsdp_message_t *self, const char* media, uint32_t port, const char* proto, ...);
  73. TINYSDP_API int tsdp_message_add_media_2(tsdp_message_t *self, const char* media, uint32_t port, const char* proto, va_list *ap);
  74. TINYSDP_API int tsdp_message_remove_media(tsdp_message_t *self, const char* media);
  75. TINYSDP_API const tsdp_header_M_t* tsdp_message_find_media(const tsdp_message_t *self, const char* media);
  76. // 3GPP TS 24.610 Communication HOLD
  77. TINYSDP_API int tsdp_message_hold(tsdp_message_t* self, const char* media);
  78. TINYSDP_API int tsdp_message_resume(tsdp_message_t* self, const char* media);
  79. TINYSDP_API tsk_bool_t tsdp_message_is_ice_enabled(const tsdp_message_t *self, tsk_size_t media_index);
  80. TINYSDP_API tsk_bool_t tsdp_message_is_ice_restart(const tsdp_message_t *self, tsk_size_t media_index);
  81. TINYSDP_API tsdp_message_t* tsdp_message_create();
  82. TINYSDP_GEXTERN const tsk_object_def_t *tsdp_message_def_t;
  83. TSDP_END_DECLS
  84. #endif /* TINYSDP_MESSAGE_H */