desc_ca_identifier.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. * Copyright (c) 2013 - Andre Roth <neolynx@gmail.com>
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation version 2
  7. * of the License.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. * Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  18. *
  19. * Described at ETSI EN 300 468 V1.11.1 (2010-04)
  20. */
  21. /**
  22. * @file desc_ca_identifier.h
  23. * @ingroup descriptors
  24. * @brief Provides the descriptors for the Conditional Access identifier
  25. * @copyright GNU General Public License version 2 (GPLv2)
  26. * @author Andre Roth
  27. *
  28. * @par Relevant specs
  29. * The descriptor described herein is defined at:
  30. * - ETSI EN 300 468 V1.11.1 (2010-04)
  31. *
  32. * @par Bug Report
  33. * Please submit bug reports and patches to linux-media@vger.kernel.org
  34. */
  35. #ifndef _CA_IDENTIFIER_H
  36. #define _CA_IDENTIFIER_H
  37. #include <libdvbv5/descriptors.h>
  38. /**
  39. * @struct dvb_desc_ca_identifier
  40. * @ingroup descriptors
  41. * @brief Indicates if a particular bouquet, service or event is associated
  42. * with a CA system
  43. *
  44. * @param type descriptor tag
  45. * @param length descriptor length
  46. * @param next pointer to struct dvb_desc
  47. * @param caid_count Number of CA IDs
  48. * @param caids CA Identifier IDs
  49. */
  50. struct dvb_desc_ca_identifier {
  51. uint8_t type;
  52. uint8_t length;
  53. struct dvb_desc *next;
  54. uint8_t caid_count;
  55. uint16_t *caids;
  56. } __attribute__((packed));
  57. struct dvb_v5_fe_parms;
  58. /** @brief initial descriptor field at dvb_desc_ca_identifier struct */
  59. #define dvb_desc_ca_identifier_field_first ca_id
  60. /** @brief last descriptor field at dvb_desc_ca_identifier struct */
  61. #define dvb_desc_ca_identifier_field_last privdata
  62. #ifdef __cplusplus
  63. extern "C" {
  64. #endif
  65. /**
  66. * @brief Initializes and parses the CA identifier descriptor
  67. * @ingroup descriptors
  68. *
  69. * @param parms struct dvb_v5_fe_parms pointer to the opened device
  70. * @param buf buffer containing the descriptor's raw data
  71. * @param desc pointer to struct dvb_desc to be allocated and filled
  72. *
  73. * This function allocates a the descriptor and fills the fields inside
  74. * the struct. It also makes sure that all fields will follow the CPU
  75. * endianness. Due to that, the content of the buffer may change.
  76. *
  77. * @return On success, it returns the size of the allocated struct.
  78. * A negative value indicates an error.
  79. */
  80. int dvb_desc_ca_identifier_init(struct dvb_v5_fe_parms *parms,
  81. const uint8_t *buf, struct dvb_desc *desc);
  82. /**
  83. * @brief Prints the content of the CA identifier descriptor
  84. * @ingroup descriptors
  85. *
  86. * @param parms struct dvb_v5_fe_parms pointer to the opened device
  87. * @param desc pointer to struct dvb_desc
  88. */
  89. void dvb_desc_ca_identifier_print(struct dvb_v5_fe_parms *parms,
  90. const struct dvb_desc *desc);
  91. /**
  92. * @brief Frees all data allocated by the CA identifier descriptor
  93. * @ingroup descriptors
  94. *
  95. * @param desc pointer to struct dvb_desc to be freed
  96. */
  97. void dvb_desc_ca_identifier_free(struct dvb_desc *desc);
  98. #ifdef __cplusplus
  99. }
  100. #endif
  101. #endif