ca.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */
  2. /*
  3. * ca.h
  4. *
  5. * Copyright (C) 2000 Ralph Metzler <[email protected]>
  6. * & Marcus Metzler <[email protected]>
  7. * for convergence integrated media GmbH
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Lesser Public License
  11. * as published by the Free Software Foundation; either version 2.1
  12. * of the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  22. *
  23. */
  24. #ifndef _DVBCA_H_
  25. #define _DVBCA_H_
  26. /**
  27. * struct ca_slot_info - CA slot interface types and info.
  28. *
  29. * @num: slot number.
  30. * @type: slot type.
  31. * @flags: flags applicable to the slot.
  32. *
  33. * This struct stores the CA slot information.
  34. *
  35. * @type can be:
  36. *
  37. * - %CA_CI - CI high level interface;
  38. * - %CA_CI_LINK - CI link layer level interface;
  39. * - %CA_CI_PHYS - CI physical layer level interface;
  40. * - %CA_DESCR - built-in descrambler;
  41. * - %CA_SC -simple smart card interface.
  42. *
  43. * @flags can be:
  44. *
  45. * - %CA_CI_MODULE_PRESENT - module (or card) inserted;
  46. * - %CA_CI_MODULE_READY - module is ready for usage.
  47. */
  48. struct ca_slot_info {
  49. int num;
  50. int type;
  51. #define CA_CI 1
  52. #define CA_CI_LINK 2
  53. #define CA_CI_PHYS 4
  54. #define CA_DESCR 8
  55. #define CA_SC 128
  56. unsigned int flags;
  57. #define CA_CI_MODULE_PRESENT 1
  58. #define CA_CI_MODULE_READY 2
  59. };
  60. /**
  61. * struct ca_descr_info - descrambler types and info.
  62. *
  63. * @num: number of available descramblers (keys).
  64. * @type: type of supported scrambling system.
  65. *
  66. * Identifies the number of descramblers and their type.
  67. *
  68. * @type can be:
  69. *
  70. * - %CA_ECD - European Common Descrambler (ECD) hardware;
  71. * - %CA_NDS - Videoguard (NDS) hardware;
  72. * - %CA_DSS - Distributed Sample Scrambling (DSS) hardware.
  73. */
  74. struct ca_descr_info {
  75. unsigned int num;
  76. unsigned int type;
  77. #define CA_ECD 1
  78. #define CA_NDS 2
  79. #define CA_DSS 4
  80. };
  81. /**
  82. * struct ca_caps - CA slot interface capabilities.
  83. *
  84. * @slot_num: total number of CA card and module slots.
  85. * @slot_type: bitmap with all supported types as defined at
  86. * &struct ca_slot_info (e. g. %CA_CI, %CA_CI_LINK, etc).
  87. * @descr_num: total number of descrambler slots (keys)
  88. * @descr_type: bitmap with all supported types as defined at
  89. * &struct ca_descr_info (e. g. %CA_ECD, %CA_NDS, etc).
  90. */
  91. struct ca_caps {
  92. unsigned int slot_num;
  93. unsigned int slot_type;
  94. unsigned int descr_num;
  95. unsigned int descr_type;
  96. };
  97. /**
  98. * struct ca_msg - a message to/from a CI-CAM
  99. *
  100. * @index: unused
  101. * @type: unused
  102. * @length: length of the message
  103. * @msg: message
  104. *
  105. * This struct carries a message to be send/received from a CI CA module.
  106. */
  107. struct ca_msg {
  108. unsigned int index;
  109. unsigned int type;
  110. unsigned int length;
  111. unsigned char msg[256];
  112. };
  113. /**
  114. * struct ca_descr - CA descrambler control words info
  115. *
  116. * @index: CA Descrambler slot
  117. * @parity: control words parity, where 0 means even and 1 means odd
  118. * @cw: CA Descrambler control words
  119. */
  120. struct ca_descr {
  121. unsigned int index;
  122. unsigned int parity;
  123. unsigned char cw[8];
  124. };
  125. #define CA_RESET _IO('o', 128)
  126. #define CA_GET_CAP _IOR('o', 129, struct ca_caps)
  127. #define CA_GET_SLOT_INFO _IOR('o', 130, struct ca_slot_info)
  128. #define CA_GET_DESCR_INFO _IOR('o', 131, struct ca_descr_info)
  129. #define CA_GET_MSG _IOR('o', 132, struct ca_msg)
  130. #define CA_SEND_MSG _IOW('o', 133, struct ca_msg)
  131. #define CA_SET_DESCR _IOW('o', 134, struct ca_descr)
  132. #if !defined(__KERNEL__)
  133. /* This is needed for legacy userspace support */
  134. typedef struct ca_slot_info ca_slot_info_t;
  135. typedef struct ca_descr_info ca_descr_info_t;
  136. typedef struct ca_caps ca_caps_t;
  137. typedef struct ca_msg ca_msg_t;
  138. typedef struct ca_descr ca_descr_t;
  139. #endif
  140. #endif