Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | */ |
| 17 | |
| 18 | #ifndef _DVB_NET_H_ |
| 19 | #define _DVB_NET_H_ |
| 20 | |
| 21 | #include <linux/module.h> |
| 22 | #include <linux/netdevice.h> |
| 23 | #include <linux/inetdevice.h> |
| 24 | #include <linux/etherdevice.h> |
| 25 | #include <linux/skbuff.h> |
| 26 | |
Mauro Carvalho Chehab | fada193 | 2017-12-28 13:03:51 -0500 | [diff] [blame] | 27 | #include <media/dvbdev.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | |
| 29 | #define DVB_NET_DEVICES_MAX 10 |
| 30 | |
Hans Petter Selasky | a34ff6c | 2011-05-23 09:43:35 -0300 | [diff] [blame] | 31 | #ifdef CONFIG_DVB_NET |
| 32 | |
Mauro Carvalho Chehab | b5b03a2 | 2017-09-20 13:51:06 -0400 | [diff] [blame] | 33 | /** |
| 34 | * struct dvb_net - describes a DVB network interface |
| 35 | * |
| 36 | * @dvbdev: pointer to &struct dvb_device. |
| 37 | * @device: array of pointers to &struct net_device. |
| 38 | * @state: array of integers to each net device. A value |
| 39 | * different than zero means that the interface is |
| 40 | * in usage. |
| 41 | * @exit: flag to indicate when the device is being removed. |
| 42 | * @demux: pointer to &struct dmx_demux. |
| 43 | * @ioctl_mutex: protect access to this struct. |
| 44 | * |
| 45 | * Currently, the core supports up to %DVB_NET_DEVICES_MAX (10) network |
| 46 | * devices. |
| 47 | */ |
| 48 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | struct dvb_net { |
| 50 | struct dvb_device *dvbdev; |
| 51 | struct net_device *device[DVB_NET_DEVICES_MAX]; |
| 52 | int state[DVB_NET_DEVICES_MAX]; |
Markus Rechberger | 2c4d336 | 2007-04-14 10:19:36 -0300 | [diff] [blame] | 53 | unsigned int exit:1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | struct dmx_demux *demux; |
Nikolaus Schulz | 30ad64b | 2012-12-23 18:49:07 -0300 | [diff] [blame] | 55 | struct mutex ioctl_mutex; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | }; |
| 57 | |
Mauro Carvalho Chehab | b5b03a2 | 2017-09-20 13:51:06 -0400 | [diff] [blame] | 58 | /** |
| 59 | * dvb_net_init - nitializes a digital TV network device and registers it. |
| 60 | * |
| 61 | * @adap: pointer to &struct dvb_adapter. |
| 62 | * @dvbnet: pointer to &struct dvb_net. |
| 63 | * @dmxdemux: pointer to &struct dmx_demux. |
| 64 | */ |
| 65 | int dvb_net_init(struct dvb_adapter *adap, struct dvb_net *dvbnet, |
| 66 | struct dmx_demux *dmxdemux); |
| 67 | |
| 68 | /** |
| 69 | * dvb_net_release - releases a digital TV network device and unregisters it. |
| 70 | * |
| 71 | * @dvbnet: pointer to &struct dvb_net. |
| 72 | */ |
| 73 | void dvb_net_release(struct dvb_net *dvbnet); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | |
Mauro Carvalho Chehab | fcc8e7d | 2011-06-01 13:03:12 -0300 | [diff] [blame] | 75 | #else |
Hans Petter Selasky | a34ff6c | 2011-05-23 09:43:35 -0300 | [diff] [blame] | 76 | |
| 77 | struct dvb_net { |
Mauro Carvalho Chehab | fcc8e7d | 2011-06-01 13:03:12 -0300 | [diff] [blame] | 78 | struct dvb_device *dvbdev; |
Hans Petter Selasky | a34ff6c | 2011-05-23 09:43:35 -0300 | [diff] [blame] | 79 | }; |
| 80 | |
| 81 | static inline void dvb_net_release(struct dvb_net *dvbnet) |
| 82 | { |
Hans Petter Selasky | a34ff6c | 2011-05-23 09:43:35 -0300 | [diff] [blame] | 83 | } |
| 84 | |
| 85 | static inline int dvb_net_init(struct dvb_adapter *adap, |
| 86 | struct dvb_net *dvbnet, struct dmx_demux *dmx) |
| 87 | { |
Hans Petter Selasky | a34ff6c | 2011-05-23 09:43:35 -0300 | [diff] [blame] | 88 | return 0; |
| 89 | } |
| 90 | |
Mauro Carvalho Chehab | fcc8e7d | 2011-06-01 13:03:12 -0300 | [diff] [blame] | 91 | #endif /* ifdef CONFIG_DVB_NET */ |
Hans Petter Selasky | a34ff6c | 2011-05-23 09:43:35 -0300 | [diff] [blame] | 92 | |
| 93 | #endif |