trtp_rtcp_header.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright (C) 2012 Doubango Telecom <http://www.doubango.org>
  3. *
  4. * Contact: Mamadou Diop <diopmamadou(at)doubango.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. #ifndef TINYRTP_RTCP_HEADER_H
  23. #define TINYRTP_RTCP_HEADER_H
  24. #include "tinyrtp_config.h"
  25. #include "tinyrtp/rtcp/trtp_rtcp_packet.h"
  26. #include "tsk_buffer.h"
  27. #include "tsk_list.h"
  28. #define TRTP_RTCP_HEADER_SIZE 4
  29. #define TRTP_RTCP_HEADER_VERSION_DEFAULT 2
  30. TRTP_BEGIN_DECLS
  31. typedef struct trtp_rtcp_header_s {
  32. TSK_DECLARE_OBJECT;
  33. unsigned version:2;
  34. unsigned padding:1;
  35. unsigned rc:5;
  36. trtp_rtcp_packet_type_t type; /**< Packet Type on 8bits */
  37. uint16_t length_in_words_minus1; /**< The length of this RTCP packet in 32-bit words minus one */
  38. uint32_t length_in_bytes;
  39. }
  40. trtp_rtcp_header_t;
  41. #define TRTP_DECLARE_RTCP_HEADER trtp_rtcp_header_t __header__
  42. typedef tsk_list_t trtp_rtcp_headers_L_t; /**< List of @ref trtp_rtcp_header_t elements */
  43. TINYRTP_API trtp_rtcp_header_t* trtp_rtcp_header_create_null();
  44. TINYRTP_API trtp_rtcp_header_t* trtp_rtcp_header_create(uint8_t version, uint8_t padding, uint8_t rc, trtp_rtcp_packet_type_t type, uint16_t length_in_bytes);
  45. TINYRTP_API int trtp_rtcp_header_serialize_to(const trtp_rtcp_header_t *self, void* data, tsk_size_t size);
  46. TINYRTP_API trtp_rtcp_header_t* trtp_rtcp_header_deserialize(const void *data, tsk_size_t size);
  47. TINYRTP_API int trtp_rtcp_header_deserialize_to(trtp_rtcp_header_t** self, const void *data, tsk_size_t size);
  48. TINYRTP_GEXTERN const tsk_object_def_t *trtp_rtcp_header_def_t;
  49. TRTP_END_DECLS
  50. #endif /* TINYRTP_RTCP_HEADER_H */