dvb_net.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * dvb_net.h
  3. *
  4. * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public License
  8. * as published by the Free Software Foundation; either version 2.1
  9. * of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. */
  17. #ifndef _DVB_NET_H_
  18. #define _DVB_NET_H_
  19. #include <linux/module.h>
  20. #include <linux/netdevice.h>
  21. #include <linux/inetdevice.h>
  22. #include <linux/etherdevice.h>
  23. #include <linux/skbuff.h>
  24. #include <media/dvbdev.h>
  25. #define DVB_NET_DEVICES_MAX 10
  26. #ifdef CONFIG_DVB_NET
  27. /**
  28. * struct dvb_net - describes a DVB network interface
  29. *
  30. * @dvbdev: pointer to &struct dvb_device.
  31. * @device: array of pointers to &struct net_device.
  32. * @state: array of integers to each net device. A value
  33. * different than zero means that the interface is
  34. * in usage.
  35. * @exit: flag to indicate when the device is being removed.
  36. * @demux: pointer to &struct dmx_demux.
  37. * @ioctl_mutex: protect access to this struct.
  38. * @remove_mutex: mutex that avoids a race condition between a callback
  39. * called when the hardware is disconnected and the
  40. * file_operations of dvb_net.
  41. *
  42. * Currently, the core supports up to %DVB_NET_DEVICES_MAX (10) network
  43. * devices.
  44. */
  45. struct dvb_net {
  46. struct dvb_device *dvbdev;
  47. struct net_device *device[DVB_NET_DEVICES_MAX];
  48. int state[DVB_NET_DEVICES_MAX];
  49. unsigned int exit:1;
  50. struct dmx_demux *demux;
  51. struct mutex ioctl_mutex;
  52. struct mutex remove_mutex;
  53. };
  54. /**
  55. * dvb_net_init - nitializes a digital TV network device and registers it.
  56. *
  57. * @adap: pointer to &struct dvb_adapter.
  58. * @dvbnet: pointer to &struct dvb_net.
  59. * @dmxdemux: pointer to &struct dmx_demux.
  60. */
  61. int dvb_net_init(struct dvb_adapter *adap, struct dvb_net *dvbnet,
  62. struct dmx_demux *dmxdemux);
  63. /**
  64. * dvb_net_release - releases a digital TV network device and unregisters it.
  65. *
  66. * @dvbnet: pointer to &struct dvb_net.
  67. */
  68. void dvb_net_release(struct dvb_net *dvbnet);
  69. #else
  70. struct dvb_net {
  71. struct dvb_device *dvbdev;
  72. };
  73. static inline void dvb_net_release(struct dvb_net *dvbnet)
  74. {
  75. }
  76. static inline int dvb_net_init(struct dvb_adapter *adap,
  77. struct dvb_net *dvbnet, struct dmx_demux *dmx)
  78. {
  79. return 0;
  80. }
  81. #endif /* ifdef CONFIG_DVB_NET */
  82. #endif