en50221_stdcam.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. en50221 encoder An implementation for libdvb
  3. an implementation for the en50221 transport layer
  4. Copyright (C) 2006 Andrew de Quincey (adq_dvb@lidskialf.net)
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU Lesser General Public License as
  7. published by the Free Software Foundation; either version 2.1 of
  8. the License, or (at your option) any later version.
  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 Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with this library; if not, write to the Free Software
  15. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. */
  17. #ifndef EN50221_STDCAM_H
  18. #define EN50221_STDCAM_H 1
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. #include <libdvben50221/en50221_app_ai.h>
  23. #include <libdvben50221/en50221_app_ca.h>
  24. #include <libdvben50221/en50221_app_mmi.h>
  25. #include <libdvben50221/en50221_session.h>
  26. #include <libdvben50221/en50221_transport.h>
  27. enum en50221_stdcam_status {
  28. EN50221_STDCAM_CAM_NONE,
  29. EN50221_STDCAM_CAM_INRESET,
  30. EN50221_STDCAM_CAM_OK,
  31. EN50221_STDCAM_CAM_BAD,
  32. };
  33. struct en50221_stdcam {
  34. /* one of more of the following may be NULL if a CAM does not support it */
  35. struct en50221_app_ai *ai_resource;
  36. struct en50221_app_ca *ca_resource;
  37. struct en50221_app_mmi *mmi_resource;
  38. /* if any of these are -1, no connection is in place to this resource yet */
  39. int ai_session_number;
  40. int ca_session_number;
  41. int mmi_session_number;
  42. /* poll the stdcam instance */
  43. enum en50221_stdcam_status (*poll)(struct en50221_stdcam *stdcam);
  44. /* inform the stdcam of the current DVB time */
  45. void (*dvbtime)(struct en50221_stdcam *stdcam, time_t dvbtime);
  46. /* destroy the stdcam instance */
  47. void (*destroy)(struct en50221_stdcam *stdcam, int closefd);
  48. };
  49. /**
  50. * Create an instance of the STDCAM for an LLCI interface.
  51. *
  52. * @param cafd FD of the CA device.
  53. * @param slotnum Slotnum on that CA device.
  54. * @param tl Transport layer instance to use.
  55. * @param sl Session layer instance to use.
  56. * @return en50221_stdcam instance, or NULL on error.
  57. */
  58. extern struct en50221_stdcam *en50221_stdcam_llci_create(int cafd, int slotnum,
  59. struct en50221_transport_layer *tl,
  60. struct en50221_session_layer *sl);
  61. /**
  62. * Create an instance of the STDCAM for an HLCI interface.
  63. *
  64. * @param cafd FD of the CA device.
  65. * @param slotnum Slotnum on that CA device.
  66. * @return en50221_stdcam instance, or NULL on error.
  67. */
  68. extern struct en50221_stdcam *en50221_stdcam_hlci_create(int cafd, int slotnum);
  69. /**
  70. * Convenience method to create a STDCAM interface for a ca device on a particular adapter.
  71. *
  72. * @param adapter The DVB adapter concerned.
  73. * @param slotnum The ca slot number on that adapter.
  74. * @param tl Transport layer instance to use (unused for HLCI cams).
  75. * @param sl Session layer instance to use (unused for HLCI cams).
  76. * @return en50221_stdcam instance, or NULL on error.
  77. */
  78. extern struct en50221_stdcam *en50221_stdcam_create(int adapter, int slotnum,
  79. struct en50221_transport_layer *tl,
  80. struct en50221_session_layer *sl);
  81. #ifdef __cplusplus
  82. }
  83. #endif
  84. #endif