Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * dvb_net.h
0003  *
0004  * Copyright (C) 2001 Ralph Metzler for convergence integrated media GmbH
0005  *
0006  * This program is free software; you can redistribute it and/or
0007  * modify it under the terms of the GNU Lesser General Public License
0008  * as published by the Free Software Foundation; either version 2.1
0009  * of the License, or (at your option) any later version.
0010  *
0011  * This program is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014  * GNU General Public License for more details.
0015  *
0016  */
0017 
0018 #ifndef _DVB_NET_H_
0019 #define _DVB_NET_H_
0020 
0021 #include <linux/module.h>
0022 #include <linux/netdevice.h>
0023 #include <linux/inetdevice.h>
0024 #include <linux/etherdevice.h>
0025 #include <linux/skbuff.h>
0026 
0027 #include <media/dvbdev.h>
0028 
0029 #define DVB_NET_DEVICES_MAX 10
0030 
0031 #ifdef CONFIG_DVB_NET
0032 
0033 /**
0034  * struct dvb_net - describes a DVB network interface
0035  *
0036  * @dvbdev:     pointer to &struct dvb_device.
0037  * @device:     array of pointers to &struct net_device.
0038  * @state:      array of integers to each net device. A value
0039  *          different than zero means that the interface is
0040  *          in usage.
0041  * @exit:       flag to indicate when the device is being removed.
0042  * @demux:      pointer to &struct dmx_demux.
0043  * @ioctl_mutex:    protect access to this struct.
0044  *
0045  * Currently, the core supports up to %DVB_NET_DEVICES_MAX (10) network
0046  * devices.
0047  */
0048 
0049 struct dvb_net {
0050     struct dvb_device *dvbdev;
0051     struct net_device *device[DVB_NET_DEVICES_MAX];
0052     int state[DVB_NET_DEVICES_MAX];
0053     unsigned int exit:1;
0054     struct dmx_demux *demux;
0055     struct mutex ioctl_mutex;
0056 };
0057 
0058 /**
0059  * dvb_net_init - nitializes a digital TV network device and registers it.
0060  *
0061  * @adap:   pointer to &struct dvb_adapter.
0062  * @dvbnet: pointer to &struct dvb_net.
0063  * @dmxdemux:   pointer to &struct dmx_demux.
0064  */
0065 int dvb_net_init(struct dvb_adapter *adap, struct dvb_net *dvbnet,
0066           struct dmx_demux *dmxdemux);
0067 
0068 /**
0069  * dvb_net_release - releases a digital TV network device and unregisters it.
0070  *
0071  * @dvbnet: pointer to &struct dvb_net.
0072  */
0073 void dvb_net_release(struct dvb_net *dvbnet);
0074 
0075 #else
0076 
0077 struct dvb_net {
0078     struct dvb_device *dvbdev;
0079 };
0080 
0081 static inline void dvb_net_release(struct dvb_net *dvbnet)
0082 {
0083 }
0084 
0085 static inline int dvb_net_init(struct dvb_adapter *adap,
0086                    struct dvb_net *dvbnet, struct dmx_demux *dmx)
0087 {
0088     return 0;
0089 }
0090 
0091 #endif /* ifdef CONFIG_DVB_NET */
0092 
0093 #endif