linux/drivers/media/dvb-core/dvb_net.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * dvb_net.c
 *
 * Copyright (C) 2001 Convergence integrated media GmbH
 *                    Ralph Metzler <[email protected]>
 * Copyright (C) 2002 Ralph Metzler <[email protected]>
 *
 * ULE Decapsulation code:
 * Copyright (C) 2003, 2004 gcs - Global Communication & Services GmbH.
 *                      and Department of Scientific Computing
 *                          Paris Lodron University of Salzburg.
 *                          Hilmar Linder <[email protected]>
 *                      and Wolfram Stering <[email protected]>
 *
 * ULE Decaps according to RFC 4326.
 */

/*
 * ULE ChangeLog:
 * Feb 2004: hl/ws v1: Implementing draft-fair-ipdvb-ule-01.txt
 *
 * Dec 2004: hl/ws v2: Implementing draft-ietf-ipdvb-ule-03.txt:
 *                       ULE Extension header handling.
 *                     Bugreports by Moritz Vieth and Hanno Tersteegen,
 *                       Fraunhofer Institute for Open Communication Systems
 *                       Competence Center for Advanced Satellite Communications.
 *                     Bugfixes and robustness improvements.
 *                     Filtering on dest MAC addresses, if present (D-Bit = 0)
 *                     DVB_ULE_DEBUG compile-time option.
 * Apr 2006: cp v3:    Bugfixes and compliency with RFC 4326 (ULE) by
 *                       Christian Praehauser <[email protected]>,
 *                       Paris Lodron University of Salzburg.
 */

/*
 * FIXME / TODO (dvb_net.c):
 *
 * Unloading does not work for 2.6.9 kernels: a refcount doesn't go to zero.
 *
 */

#define pr_fmt(fmt)

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/netdevice.h>
#include <linux/nospec.h>
#include <linux/etherdevice.h>
#include <linux/dvb/net.h>
#include <linux/uio.h>
#include <linux/uaccess.h>
#include <linux/crc32.h>
#include <linux/mutex.h>
#include <linux/sched.h>

#include <media/dvb_demux.h>
#include <media/dvb_net.h>

static inline __u32 iov_crc32( __u32 c, struct kvec *iov, unsigned int cnt )
{}


#define DVB_NET_MULTICAST_MAX

#ifdef DVB_ULE_DEBUG
/*
 * The code inside DVB_ULE_DEBUG keeps a history of the
 * last 100 TS cells processed.
 */
static unsigned char ule_hist[100*TS_SZ] = { 0 };
static unsigned char *ule_where = ule_hist, ule_dump;

static void hexdump(const unsigned char *buf, unsigned short len)
{
	print_hex_dump_debug("", DUMP_PREFIX_OFFSET, 16, 1, buf, len, true);
}
#endif

struct dvb_net_priv {};


/*
 *	Determine the packet's protocol ID. The rule here is that we
 *	assume 802.3 if the type field is short enough to be a length.
 *	This is normal practice and works for any 'now in use' protocol.
 *
 *  stolen from eth.c out of the linux kernel, hacked for dvb-device
 *  by Michael Holzt <[email protected]>
 */
static __be16 dvb_net_eth_type_trans(struct sk_buff *skb,
				      struct net_device *dev)
{}

#define TS_SZ
#define TS_SYNC
#define TS_TEI
#define TS_SC
#define TS_PUSI
#define TS_AF_A
#define TS_AF_D

/* ULE Extension Header handlers. */

#define ULE_TEST
#define ULE_BRIDGED

#define ULE_OPTEXTHDR_PADDING

static int ule_test_sndu( struct dvb_net_priv *p )
{}

static int ule_bridged_sndu( struct dvb_net_priv *p )
{}

static int ule_exthdr_padding(struct dvb_net_priv *p)
{}

/*
 * Handle ULE extension headers.
 *  Function is called after a successful CRC32 verification of an ULE SNDU to complete its decoding.
 *  Returns: >= 0: nr. of bytes consumed by next extension header
 *	     -1:   Mandatory extension header that is not recognized or TEST SNDU; discard.
 */
static int handle_one_ule_extension( struct dvb_net_priv *p )
{}

static int handle_ule_extensions( struct dvb_net_priv *p )
{}


/* Prepare for a new ULE SNDU: reset the decoder state. */
static inline void reset_ule( struct dvb_net_priv *p )
{}

/*
 * Decode ULE SNDUs according to draft-ietf-ipdvb-ule-03.txt from a sequence of
 * TS cells of a single PID.
 */

struct dvb_net_ule_handle {};

static int dvb_net_ule_new_ts_cell(struct dvb_net_ule_handle *h)
{}

static int dvb_net_ule_ts_pusi(struct dvb_net_ule_handle *h)
{}

static int dvb_net_ule_new_ts(struct dvb_net_ule_handle *h)
{}


/*
 * Start a new payload with skb.
 * Find ULE header.  It is only guaranteed that the
 * length field (2 bytes) is contained in the current
 * TS.
 * Check h.ts_remain has to be >= 2 here.
 */
static int dvb_net_ule_new_payload(struct dvb_net_ule_handle *h)
{}


static int dvb_net_ule_should_drop(struct dvb_net_ule_handle *h)
{}


static void dvb_net_ule_check_crc(struct dvb_net_ule_handle *h,
				  struct kvec iov[3],
				  u32 ule_crc, u32 expected_crc)
{}

static void dvb_net_ule(struct net_device *dev, const u8 *buf, size_t buf_len)
{}

static int dvb_net_ts_callback(const u8 *buffer1, size_t buffer1_len,
			       const u8 *buffer2, size_t buffer2_len,
			       struct dmx_ts_feed *feed,
			       u32 *buffer_flags)
{}


static void dvb_net_sec(struct net_device *dev,
			const u8 *pkt, int pkt_len)
{}

static int dvb_net_sec_callback(const u8 *buffer1, size_t buffer1_len,
		 const u8 *buffer2, size_t buffer2_len,
		 struct dmx_section_filter *filter, u32 *buffer_flags)
{}

static netdev_tx_t dvb_net_tx(struct sk_buff *skb, struct net_device *dev)
{}

static u8 mask_normal[6]=;
static u8 mask_allmulti[6]=;
static u8 mac_allmulti[6]=;
static u8 mask_promisc[6]=;

static int dvb_net_filter_sec_set(struct net_device *dev,
		   struct dmx_section_filter **secfilter,
		   const u8 *mac, u8 *mac_mask)
{}

static int dvb_net_feed_start(struct net_device *dev)
{}

static int dvb_net_feed_stop(struct net_device *dev)
{}


static int dvb_set_mc_filter(struct net_device *dev, unsigned char *addr)
{}


static void wq_set_multicast_list (struct work_struct *work)
{}


static void dvb_net_set_multicast_list (struct net_device *dev)
{}


static void wq_restart_net_feed (struct work_struct *work)
{}


static int dvb_net_set_mac (struct net_device *dev, void *p)
{}


static int dvb_net_open(struct net_device *dev)
{}


static int dvb_net_stop(struct net_device *dev)
{}

static const struct header_ops dvb_header_ops =;


static const struct net_device_ops dvb_netdev_ops =;

static void dvb_net_setup(struct net_device *dev)
{}

static int get_if(struct dvb_net *dvbnet)
{}

static int dvb_net_add_if(struct dvb_net *dvbnet, u16 pid, u8 feedtype)
{}

static int dvb_net_remove_if(struct dvb_net *dvbnet, unsigned long num)
{}

static int dvb_net_do_ioctl(struct file *file,
		  unsigned int cmd, void *parg)
{}

static long dvb_net_ioctl(struct file *file,
	      unsigned int cmd, unsigned long arg)
{}

static int locked_dvb_net_open(struct inode *inode, struct file *file)
{}

static int dvb_net_close(struct inode *inode, struct file *file)
{}


static const struct file_operations dvb_net_fops =;

static const struct dvb_device dvbdev_net =;

void dvb_net_release (struct dvb_net *dvbnet)
{}
EXPORT_SYMBOL();


int dvb_net_init (struct dvb_adapter *adap, struct dvb_net *dvbnet,
		  struct dmx_demux *dmx)
{}
EXPORT_SYMBOL();