1<title>DVB Network API</title> 2<para>The DVB net device controls the mapping of data packages that are 3 part of a transport stream to be mapped into a virtual network interface, 4 visible through the standard Linux network protocol stack.</para> 5<para>Currently, two encapsulations are supported:</para> 6<itemizedlist> 7 <listitem><para><ulink url="http://en.wikipedia.org/wiki/Multiprotocol_Encapsulation"> 8 Multi Protocol Encapsulation (MPE)</ulink></para></listitem> 9 <listitem><para><ulink url="http://en.wikipedia.org/wiki/Unidirectional_Lightweight_Encapsulation"> 10 Ultra Lightweight Encapsulation (ULE)</ulink></para></listitem> 11</itemizedlist> 12 13<para>In order to create the Linux virtual network interfaces, an application 14 needs to tell to the Kernel what are the PIDs and the encapsulation types 15 that are present on the transport stream. This is done through 16 <constant>/dev/dvb/adapter?/net?</constant> device node. 17 The data will be available via virtual <constant>dvb?_?</constant> 18 network interfaces, and will be controled/routed via the standard 19 ip tools (like ip, route, netstat, ifconfig, etc).</para> 20<para> Data types and and ioctl definitions are defined via 21 <constant>linux/dvb/net.h</constant> header.</para> 22 23<section id="net_fcalls"> 24<title>DVB net Function Calls</title> 25 26 27<refentry id="NET_ADD_IF"> 28 <refmeta> 29 <refentrytitle>ioctl NET_ADD_IF</refentrytitle> 30 &manvol; 31 </refmeta> 32 33 <refnamediv> 34 <refname>NET_ADD_IF</refname> 35 <refpurpose>Creates a new network interface for a given Packet ID.</refpurpose> 36 </refnamediv> 37 38 <refsynopsisdiv> 39 <funcsynopsis> 40 <funcprototype> 41 <funcdef>int <function>ioctl</function></funcdef> 42 <paramdef>int <parameter>fd</parameter></paramdef> 43 <paramdef>int <parameter>request</parameter></paramdef> 44 <paramdef>struct dvb_net_if *<parameter>net_if</parameter></paramdef> 45 </funcprototype> 46 </funcsynopsis> 47 </refsynopsisdiv> 48 49 <refsect1> 50 <title>Arguments</title> 51 <variablelist> 52 <varlistentry> 53 <term><parameter>fd</parameter></term> 54 <listitem> 55 <para>&fe_fd;</para> 56 </listitem> 57 </varlistentry> 58 <varlistentry> 59 <term><parameter>request</parameter></term> 60 <listitem> 61 <para>FE_SET_TONE</para> 62 </listitem> 63 </varlistentry> 64 <varlistentry> 65 <term><parameter>net_if</parameter></term> 66 <listitem> 67 <para>pointer to &dvb-net-if;</para> 68 </listitem> 69 </varlistentry> 70 </variablelist> 71 </refsect1> 72 73 <refsect1> 74 <title>Description</title> 75 76<para>The NET_ADD_IF ioctl system call selects the Packet ID (PID) that 77 contains a TCP/IP traffic, the type of encapsulation to be used (MPE or ULE) 78 and the interface number for the new interface to be created. When the 79 system call successfully returns, a new virtual network interface is created.</para> 80<para>The &dvb-net-if;::ifnum field will be filled with the number of the 81 created interface.</para> 82 83&return-value-dvb; 84</refsect1> 85 86<refsect1 id="dvb-net-if-t"> 87<title>struct <structname>dvb_net_if</structname> description</title> 88 89<table pgwide="1" frame="none" id="dvb-net-if"> 90 <title>struct <structname>dvb_net_if</structname></title> 91 <tgroup cols="2"> 92 &cs-def; 93 <thead> 94 <row> 95 <entry>ID</entry> 96 <entry>Description</entry> 97 </row> 98 </thead> 99 <tbody valign="top"> 100 <row> 101 <entry align="char">pid</entry> 102 <entry align="char">Packet ID (PID) of the MPEG-TS that contains 103 data</entry> 104 </row><row> 105 <entry align="char">ifnum</entry> 106 <entry align="char">number of the DVB interface.</entry> 107 </row><row> 108 <entry align="char">feedtype</entry> 109 <entry align="char">Encapsulation type of the feed. It can be: 110 <constant>DVB_NET_FEEDTYPE_MPE</constant> for MPE encoding 111 or 112 <constant>DVB_NET_FEEDTYPE_ULE</constant> for ULE encoding. 113 </entry> 114 </row> 115 </tbody> 116 </tgroup> 117</table> 118</refsect1> 119</refentry> 120 121<refentry id="NET_REMOVE_IF"> 122 <refmeta> 123 <refentrytitle>ioctl NET_REMOVE_IF</refentrytitle> 124 &manvol; 125 </refmeta> 126 127 <refnamediv> 128 <refname>NET_REMOVE_IF</refname> 129 <refpurpose>Removes a network interface.</refpurpose> 130 </refnamediv> 131 132 <refsynopsisdiv> 133 <funcsynopsis> 134 <funcprototype> 135 <funcdef>int <function>ioctl</function></funcdef> 136 <paramdef>int <parameter>fd</parameter></paramdef> 137 <paramdef>int <parameter>request</parameter></paramdef> 138 <paramdef>int <parameter>ifnum</parameter></paramdef> 139 </funcprototype> 140 </funcsynopsis> 141 </refsynopsisdiv> 142 143 <refsect1> 144 <title>Arguments</title> 145 <variablelist> 146 <varlistentry> 147 <term><parameter>fd</parameter></term> 148 <listitem> 149 <para>&fe_fd;</para> 150 </listitem> 151 </varlistentry> 152 <varlistentry> 153 <term><parameter>request</parameter></term> 154 <listitem> 155 <para>FE_SET_TONE</para> 156 </listitem> 157 </varlistentry> 158 <varlistentry> 159 <term><parameter>net_if</parameter></term> 160 <listitem> 161 <para>number of the interface to be removed</para> 162 </listitem> 163 </varlistentry> 164 </variablelist> 165 </refsect1> 166 167 <refsect1> 168 <title>Description</title> 169 170<para>The NET_REMOVE_IF ioctl deletes an interface previously created 171 via &NET-ADD-IF;.</para> 172 173&return-value-dvb; 174</refsect1> 175</refentry> 176 177 178<refentry id="NET_GET_IF"> 179 <refmeta> 180 <refentrytitle>ioctl NET_GET_IF</refentrytitle> 181 &manvol; 182 </refmeta> 183 184 <refnamediv> 185 <refname>NET_GET_IF</refname> 186 <refpurpose>Read the configuration data of an interface created via 187 &NET-ADD-IF;.</refpurpose> 188 </refnamediv> 189 190 <refsynopsisdiv> 191 <funcsynopsis> 192 <funcprototype> 193 <funcdef>int <function>ioctl</function></funcdef> 194 <paramdef>int <parameter>fd</parameter></paramdef> 195 <paramdef>int <parameter>request</parameter></paramdef> 196 <paramdef>struct dvb_net_if *<parameter>net_if</parameter></paramdef> 197 </funcprototype> 198 </funcsynopsis> 199 </refsynopsisdiv> 200 201 <refsect1> 202 <title>Arguments</title> 203 <variablelist> 204 <varlistentry> 205 <term><parameter>fd</parameter></term> 206 <listitem> 207 <para>&fe_fd;</para> 208 </listitem> 209 </varlistentry> 210 <varlistentry> 211 <term><parameter>request</parameter></term> 212 <listitem> 213 <para>FE_SET_TONE</para> 214 </listitem> 215 </varlistentry> 216 <varlistentry> 217 <term><parameter>net_if</parameter></term> 218 <listitem> 219 <para>pointer to &dvb-net-if;</para> 220 </listitem> 221 </varlistentry> 222 </variablelist> 223 </refsect1> 224 225 <refsect1> 226 <title>Description</title> 227 228<para>The NET_GET_IF ioctl uses the interface number given by the 229 &dvb-net-if;::ifnum field and fills the content of &dvb-net-if; with 230 the packet ID and encapsulation type used on such interface. If the 231 interface was not created yet with &NET-ADD-IF;, it will return -1 and 232 fill the <constant>errno</constant> with <constant>EINVAL</constant> 233 error code.</para> 234 235&return-value-dvb; 236</refsect1> 237</refentry> 238</section> 239