trtp_rtcp_packet.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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_PACKET_H
  23. #define TINYRTP_RTCP_PACKET_H
  24. #include "tinyrtp_config.h"
  25. #include "tsk_buffer.h"
  26. #include "tsk_list.h"
  27. TRTP_BEGIN_DECLS
  28. #define TRTP_RTCP_PACKET(self) ((trtp_rtcp_packet_t*)(self))
  29. #define TRTP_DECLARE_RTCP_PACKET trtp_rtcp_packet_t __packet__
  30. // RFC 3550 12.1 RTCP Packet Types
  31. // RFC 4585
  32. // RFC 5104 (FIXME: not supported yet!)
  33. typedef enum trtp_rtcp_packet_type_e {
  34. trtp_rtcp_packet_type_sr = 200,
  35. trtp_rtcp_packet_type_rr = 201,
  36. trtp_rtcp_packet_type_sdes = 202,
  37. trtp_rtcp_packet_type_bye = 203,
  38. trtp_rtcp_packet_type_app = 204,
  39. trtp_rtcp_packet_type_rtpfb = 205,
  40. trtp_rtcp_packet_type_psfb = 206
  41. }
  42. trtp_rtcp_packet_type_t;
  43. typedef struct trtp_rtcp_packet_s {
  44. TSK_DECLARE_OBJECT;
  45. struct trtp_rtcp_header_s *header;
  46. }
  47. trtp_rtcp_packet_t;
  48. typedef tsk_list_t trtp_rtcp_packets_L_t; /**< List of @ref trtp_rtcp_packet_t elements */
  49. trtp_rtcp_packet_t* trtp_rtcp_packet_create(struct trtp_rtcp_header_s* header);
  50. int trtp_rtcp_packet_init(trtp_rtcp_packet_t* self, uint8_t version, uint8_t padding, uint8_t rc, trtp_rtcp_packet_type_t type, uint16_t length_in_bytes);
  51. trtp_rtcp_packet_t* trtp_rtcp_packet_deserialize(const void* data, tsk_size_t size);
  52. int trtp_rtcp_packet_serialize_to(const trtp_rtcp_packet_t* self, void* data, tsk_size_t size);
  53. tsk_buffer_t* trtp_rtcp_packet_serialize(const trtp_rtcp_packet_t* self, tsk_size_t num_bytes_pad);
  54. int trtp_rtcp_packet_add_packet(trtp_rtcp_packet_t* self, trtp_rtcp_packet_t* packet, tsk_bool_t front);
  55. TINYRTP_API const trtp_rtcp_packet_t* trtp_rtcp_packet_get_at(const trtp_rtcp_packet_t* self, trtp_rtcp_packet_type_t type, tsk_size_t index);
  56. TINYRTP_API const trtp_rtcp_packet_t* trtp_rtcp_packet_get(const trtp_rtcp_packet_t* self, trtp_rtcp_packet_type_t type);
  57. tsk_size_t trtp_rtcp_packet_get_size(const trtp_rtcp_packet_t* self);
  58. int trtp_rtcp_packet_deinit(trtp_rtcp_packet_t* self);
  59. TRTP_END_DECLS
  60. #endif /* TINYRTP_RTCP_PACKET_H */