sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget%/translations/zh_CN/networking/phonetmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget%/translations/zh_TW/networking/phonetmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget%/translations/it_IT/networking/phonetmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget%/translations/ja_JP/networking/phonetmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget%/translations/ko_KR/networking/phonetmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget%/translations/sp_SP/networking/phonetmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h SPDX-License-Identifier: GPL-2.0h]h SPDX-License-Identifier: GPL-2.0}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhh?/var/lib/git/docbuild/linux/Documentation/networking/phonet.rsthKubh)}(h4This data file has been placed in the public domain.h]h4This data file has been placed in the public domain.}hhsbah}(h]h ]h"]h$]h&]hhuh1hhhhhho/srv/docbuild/lib/venvs/build-kernel-docs/lib64/python3.9/site-packages/docutils/parsers/rst/include/isonum.txthKubh)}(hDerived from the Unicode character mappings available from . Processed by unicode2rstsubs.py, part of Docutils: .h]hDerived from the Unicode character mappings available from . Processed by unicode2rstsubs.py, part of Docutils: .}hhsbah}(h]h ]h"]h$]h&]hhuh1hhhhhhhhKubhsubstitution_definition)}(h*.. |amp| unicode:: U+00026 .. AMPERSANDh]h&}hhsbah}(h]h ]h"]ampah$]h&]uh1hhhhKhhhhubh)}(h+.. |apos| unicode:: U+00027 .. APOSTROPHEh]h'}hhsbah}(h]h ]h"]aposah$]h&]uh1hhhhKhhhhubh)}(h).. |ast| unicode:: U+0002A .. ASTERISKh]h*}hhsbah}(h]h ]h"]astah$]h&]uh1hhhhK hhhhubh)}(h+.. |brvbar| unicode:: U+000A6 .. BROKEN BARh]h¦}hjsbah}(h]h ]h"]brvbarah$]h&]uh1hhhhK hhhhubh)}(h0.. |bsol| unicode:: U+0005C .. REVERSE SOLIDUSh]h\}hjsbah}(h]h ]h"]bsolah$]h&]uh1hhhhK hhhhubh)}(h*.. |cent| unicode:: U+000A2 .. CENT SIGNh]h¢}hjsbah}(h]h ]h"]centah$]h&]uh1hhhhK hhhhubh)}(h&.. |colon| unicode:: U+0003A .. COLONh]h:}hj-sbah}(h]h ]h"]colonah$]h&]uh1hhhhK hhhhubh)}(h&.. |comma| unicode:: U+0002C .. COMMAh]h,}hj<sbah}(h]h ]h"]commaah$]h&]uh1hhhhKhhhhubh)}(h... |commat| unicode:: U+00040 .. COMMERCIAL ATh]h@}hjKsbah}(h]h ]h"]commatah$]h&]uh1hhhhKhhhhubh)}(h/.. |copy| unicode:: U+000A9 .. COPYRIGHT SIGNh]h©}hjZsbah}(h]h ]h"]copyah$]h&]uh1hhhhKhhhhubh)}(h... |curren| unicode:: U+000A4 .. CURRENCY SIGNh]h¤}hjisbah}(h]h ]h"]currenah$]h&]uh1hhhhKhhhhubh)}(h0.. |darr| unicode:: U+02193 .. DOWNWARDS ARROWh]h↓}hjxsbah}(h]h ]h"]darrah$]h&]uh1hhhhKhhhhubh)}(h,.. |deg| unicode:: U+000B0 .. DEGREE SIGNh]h°}hjsbah}(h]h ]h"]degah$]h&]uh1hhhhKhhhhubh)}(h... |divide| unicode:: U+000F7 .. DIVISION SIGNh]h÷}hjsbah}(h]h ]h"]divideah$]h&]uh1hhhhKhhhhubh)}(h,.. |dollar| unicode:: U+00024 .. DOLLAR SIGNh]h$}hjsbah}(h]h ]h"]dollarah$]h&]uh1hhhhKhhhhubh)}(h,.. |equals| unicode:: U+0003D .. EQUALS SIGNh]h=}hjsbah}(h]h ]h"]equalsah$]h&]uh1hhhhKhhhhubh)}(h1.. |excl| unicode:: U+00021 .. EXCLAMATION MARKh]h!}hjsbah}(h]h ]h"]exclah$]h&]uh1hhhhKhhhhubh)}(h9.. |frac12| unicode:: U+000BD .. VULGAR FRACTION ONE HALFh]h½}hjsbah}(h]h ]h"]frac12ah$]h&]uh1hhhhKhhhhubh)}(h<.. |frac14| unicode:: U+000BC .. VULGAR FRACTION ONE QUARTERh]h¼}hjsbah}(h]h ]h"]frac14ah$]h&]uh1hhhhKhhhhubh)}(h;.. |frac18| unicode:: U+0215B .. VULGAR FRACTION ONE EIGHTHh]h⅛}hjsbah}(h]h ]h"]frac18ah$]h&]uh1hhhhKhhhhubh)}(h?.. |frac34| unicode:: U+000BE .. VULGAR FRACTION THREE QUARTERSh]h¾}hjsbah}(h]h ]h"]frac34ah$]h&]uh1hhhhKhhhhubh)}(h>.. |frac38| unicode:: U+0215C .. VULGAR FRACTION THREE EIGHTHSh]h⅜}hjsbah}(h]h ]h"]frac38ah$]h&]uh1hhhhKhhhhubh)}(h=.. |frac58| unicode:: U+0215D .. VULGAR FRACTION FIVE EIGHTHSh]h⅝}hjsbah}(h]h ]h"]frac58ah$]h&]uh1hhhhKhhhhubh)}(h>.. |frac78| unicode:: U+0215E .. VULGAR FRACTION SEVEN EIGHTHSh]h⅞}hj,sbah}(h]h ]h"]frac78ah$]h&]uh1hhhhKhhhhubh)}(h2.. |gt| unicode:: U+0003E .. GREATER-THAN SIGNh]h>}hj;sbah}(h]h ]h"]gtah$]h&]uh1hhhhKhhhhubh)}(h9.. |half| unicode:: U+000BD .. VULGAR FRACTION ONE HALFh]h½}hjJsbah}(h]h ]h"]halfah$]h&]uh1hhhhK hhhhubh)}(h/.. |horbar| unicode:: U+02015 .. HORIZONTAL BARh]h―}hjYsbah}(h]h ]h"]horbarah$]h&]uh1hhhhK!hhhhubh)}(h'.. |hyphen| unicode:: U+02010 .. HYPHENh]h‐}hjhsbah}(h]h ]h"]hyphenah$]h&]uh1hhhhK"hhhhubh)}(h:.. |iexcl| unicode:: U+000A1 .. INVERTED EXCLAMATION MARKh]h¡}hjwsbah}(h]h ]h"]iexclah$]h&]uh1hhhhK#hhhhubh)}(h7.. |iquest| unicode:: U+000BF .. INVERTED QUESTION MARKh]h¿}hjsbah}(h]h ]h"]iquestah$]h&]uh1hhhhK$hhhhubh)}(hJ.. |laquo| unicode:: U+000AB .. LEFT-POINTING DOUBLE ANGLE QUOTATION MARKh]h«}hjsbah}(h]h ]h"]laquoah$]h&]uh1hhhhK%hhhhubh)}(h0.. |larr| unicode:: U+02190 .. LEFTWARDS ARROWh]h←}hjsbah}(h]h ]h"]larrah$]h&]uh1hhhhK&hhhhubh)}(h3.. |lcub| unicode:: U+0007B .. LEFT CURLY BRACKETh]h{}hjsbah}(h]h ]h"]lcubah$]h&]uh1hhhhK'hhhhubh)}(h;.. |ldquo| unicode:: U+0201C .. LEFT DOUBLE QUOTATION MARKh]h“}hjsbah}(h]h ]h"]ldquoah$]h&]uh1hhhhK(hhhhubh)}(h).. |lowbar| unicode:: U+0005F .. LOW LINEh]h_}hjsbah}(h]h ]h"]lowbarah$]h&]uh1hhhhK)hhhhubh)}(h1.. |lpar| unicode:: U+00028 .. LEFT PARENTHESISh]h(}hjsbah}(h]h ]h"]lparah$]h&]uh1hhhhK*hhhhubh)}(h4.. |lsqb| unicode:: U+0005B .. LEFT SQUARE BRACKETh]h[}hjsbah}(h]h ]h"]lsqbah$]h&]uh1hhhhK+hhhhubh)}(h;.. |lsquo| unicode:: U+02018 .. LEFT SINGLE QUOTATION MARKh]h‘}hjsbah}(h]h ]h"]lsquoah$]h&]uh1hhhhK,hhhhubh)}(h/.. |lt| unicode:: U+0003C .. LESS-THAN SIGNh]h<}hj sbah}(h]h ]h"]ltah$]h&]uh1hhhhK-hhhhubh)}(h+.. |micro| unicode:: U+000B5 .. MICRO SIGNh]hµ}hjsbah}(h]h ]h"]microah$]h&]uh1hhhhK.hhhhubh)}(h+.. |middot| unicode:: U+000B7 .. MIDDLE DOTh]h·}hj+sbah}(h]h ]h"]middotah$]h&]uh1hhhhK/hhhhubh)}(h/.. |nbsp| unicode:: U+000A0 .. NO-BREAK SPACEh]h }hj:sbah}(h]h ]h"]nbspah$]h&]uh1hhhhK0hhhhubh)}(h).. |not| unicode:: U+000AC .. NOT SIGNh]h¬}hjIsbah}(h]h ]h"]notah$]h&]uh1hhhhK1hhhhubh)}(h,.. |num| unicode:: U+00023 .. NUMBER SIGNh]h#}hjXsbah}(h]h ]h"]numah$]h&]uh1hhhhK2hhhhubh)}(h).. |ohm| unicode:: U+02126 .. OHM SIGNh]hΩ}hjgsbah}(h]h ]h"]ohmah$]h&]uh1hhhhK3hhhhubh)}(h;.. |ordf| unicode:: U+000AA .. FEMININE ORDINAL INDICATORh]hª}hjvsbah}(h]h ]h"]ordfah$]h&]uh1hhhhK4hhhhubh)}(h<.. |ordm| unicode:: U+000BA .. MASCULINE ORDINAL INDICATORh]hº}hjsbah}(h]h ]h"]ordmah$]h&]uh1hhhhK5hhhhubh)}(h-.. |para| unicode:: U+000B6 .. PILCROW SIGNh]h¶}hjsbah}(h]h ]h"]paraah$]h&]uh1hhhhK6hhhhubh)}(h-.. |percnt| unicode:: U+00025 .. PERCENT SIGNh]h%}hjsbah}(h]h ]h"]percntah$]h&]uh1hhhhK7hhhhubh)}(h*.. |period| unicode:: U+0002E .. FULL STOPh]h.}hjsbah}(h]h ]h"]periodah$]h&]uh1hhhhK8hhhhubh)}(h*.. |plus| unicode:: U+0002B .. PLUS SIGNh]h+}hjsbah}(h]h ]h"]plusah$]h&]uh1hhhhK9hhhhubh)}(h0.. |plusmn| unicode:: U+000B1 .. PLUS-MINUS SIGNh]h±}hjsbah}(h]h ]h"]plusmnah$]h&]uh1hhhhK:hhhhubh)}(h+.. |pound| unicode:: U+000A3 .. POUND SIGNh]h£}hjsbah}(h]h ]h"]poundah$]h&]uh1hhhhK;hhhhubh)}(h... |quest| unicode:: U+0003F .. QUESTION MARKh]h?}hjsbah}(h]h ]h"]questah$]h&]uh1hhhhKhhhhubh)}(h1.. |rarr| unicode:: U+02192 .. RIGHTWARDS ARROWh]h→}hjsbah}(h]h ]h"]rarrah$]h&]uh1hhhhK?hhhhubh)}(h4.. |rcub| unicode:: U+0007D .. RIGHT CURLY BRACKETh]h}}hj*sbah}(h]h ]h"]rcubah$]h&]uh1hhhhK@hhhhubh)}(h<.. |rdquo| unicode:: U+0201D .. RIGHT DOUBLE QUOTATION MARKh]h”}hj9sbah}(h]h ]h"]rdquoah$]h&]uh1hhhhKAhhhhubh)}(h0.. |reg| unicode:: U+000AE .. REGISTERED SIGNh]h®}hjHsbah}(h]h ]h"]regah$]h&]uh1hhhhKBhhhhubh)}(h2.. |rpar| unicode:: U+00029 .. RIGHT PARENTHESISh]h)}hjWsbah}(h]h ]h"]rparah$]h&]uh1hhhhKChhhhubh)}(h5.. |rsqb| unicode:: U+0005D .. RIGHT SQUARE BRACKETh]h]}hjfsbah}(h]h ]h"]rsqbah$]h&]uh1hhhhKDhhhhubh)}(h<.. |rsquo| unicode:: U+02019 .. RIGHT SINGLE QUOTATION MARKh]h’}hjusbah}(h]h ]h"]rsquoah$]h&]uh1hhhhKEhhhhubh)}(h-.. |sect| unicode:: U+000A7 .. SECTION SIGNh]h§}hjsbah}(h]h ]h"]sectah$]h&]uh1hhhhKFhhhhubh)}(h*.. |semi| unicode:: U+0003B .. SEMICOLONh]h;}hjsbah}(h]h ]h"]semiah$]h&]uh1hhhhKGhhhhubh)}(h,.. |shy| unicode:: U+000AD .. SOFT HYPHENh]h­}hjsbah}(h]h ]h"]shyah$]h&]uh1hhhhKHhhhhubh)}(h(.. |sol| unicode:: U+0002F .. SOLIDUSh]h/}hjsbah}(h]h ]h"]solah$]h&]uh1hhhhKIhhhhubh)}(h,.. |sung| unicode:: U+0266A .. EIGHTH NOTEh]h♪}hjsbah}(h]h ]h"]sungah$]h&]uh1hhhhKJhhhhubh)}(h0.. |sup1| unicode:: U+000B9 .. SUPERSCRIPT ONEh]h¹}hjsbah}(h]h ]h"]sup1ah$]h&]uh1hhhhKKhhhhubh)}(h0.. |sup2| unicode:: U+000B2 .. SUPERSCRIPT TWOh]h²}hjsbah}(h]h ]h"]sup2ah$]h&]uh1hhhhKLhhhhubh)}(h2.. |sup3| unicode:: U+000B3 .. SUPERSCRIPT THREEh]h³}hjsbah}(h]h ]h"]sup3ah$]h&]uh1hhhhKMhhhhubh)}(h4.. |times| unicode:: U+000D7 .. MULTIPLICATION SIGNh]h×}hjsbah}(h]h ]h"]timesah$]h&]uh1hhhhKNhhhhubh)}(h0.. |trade| unicode:: U+02122 .. TRADE MARK SIGNh]h™}hj sbah}(h]h ]h"]tradeah$]h&]uh1hhhhKOhhhhubh)}(h... |uarr| unicode:: U+02191 .. UPWARDS ARROWh]h↑}hjsbah}(h]h ]h"]uarrah$]h&]uh1hhhhKPhhhhubh)}(h... |verbar| unicode:: U+0007C .. VERTICAL LINEh]h|}hj)sbah}(h]h ]h"]verbarah$]h&]uh1hhhhKQhhhhubh)}(h*.. |yen| unicode:: U+000A5 .. YEN SIGN h]h¥}hj8sbah}(h]h ]h"]yenah$]h&]uh1hhhhKRhhhhubhsection)}(hhh](htitle)}(hLinux Phonet protocol familyh]hLinux Phonet protocol family}(hjNhhhNhNubah}(h]h ]h"]h$]h&]uh1jLhjIhhhhhKubjH)}(hhh](jM)}(h Introductionh]h Introduction}(hj_hhhNhNubah}(h]h ]h"]h$]h&]uh1jLhj\hhhhhK ubh paragraph)}(hXPhonet is a packet protocol used by Nokia cellular modems for both IPC and RPC. With the Linux Phonet socket family, Linux host processes can receive and send messages from/to the modem, or any other external device attached to the modem. The modem takes care of routing.h]hXPhonet is a packet protocol used by Nokia cellular modems for both IPC and RPC. With the Linux Phonet socket family, Linux host processes can receive and send messages from/to the modem, or any other external device attached to the modem. The modem takes care of routing.}(hjohhhNhNubah}(h]h ]h"]h$]h&]uh1jmhhhK hj\hhubjn)}(hfPhonet packets can be exchanged through various hardware connections depending on the device, such as:h]hfPhonet packets can be exchanged through various hardware connections depending on the device, such as:}(hj}hhhNhNubah}(h]h ]h"]h$]h&]uh1jmhhhKhj\hhubh block_quote)}(h- USB with the CDC Phonet interface, - infrared, - Bluetooth, - an RS232 serial port (with a dedicated "FBUS" line discipline), - the SSI bus with some TI OMAP processors. h]h bullet_list)}(hhh](h list_item)}(h"USB with the CDC Phonet interface,h]jn)}(hjh]h"USB with the CDC Phonet interface,}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jmhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(h infrared,h]jn)}(hjh]h infrared,}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jmhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(h Bluetooth,h]jn)}(hjh]h Bluetooth,}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jmhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(h?an RS232 serial port (with a dedicated "FBUS" line discipline),h]jn)}(hjh]hCan RS232 serial port (with a dedicated “FBUS” line discipline),}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jmhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(h+the SSI bus with some TI OMAP processors. h]jn)}(h)the SSI bus with some TI OMAP processors.h]h)the SSI bus with some TI OMAP processors.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jmhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]bullet-uh1jhhhKhjubah}(h]h ]h"]h$]h&]uh1jhhhKhj\hhubeh}(h] introductionah ]h"] introductionah$]h&]uh1jGhjIhhhhhK ubjH)}(hhh](jM)}(hPackets formath]hPackets format}(hj%hhhNhNubah}(h]h ]h"]h$]h&]uh1jLhj"hhhhhKubjn)}(h0Phonet packets have a common header as follows::h]h/Phonet packets have a common header as follows:}(hj3hhhNhNubah}(h]h ]h"]h$]h&]uh1jmhhhKhj"hhubh literal_block)}(hXstruct phonethdr { uint8_t pn_media; /* Media type (link-layer identifier) */ uint8_t pn_rdev; /* Receiver device ID */ uint8_t pn_sdev; /* Sender device ID */ uint8_t pn_res; /* Resource ID or function */ uint16_t pn_length; /* Big-endian message byte length (minus 6) */ uint8_t pn_robj; /* Receiver object ID */ uint8_t pn_sobj; /* Sender object ID */ };h]hXstruct phonethdr { uint8_t pn_media; /* Media type (link-layer identifier) */ uint8_t pn_rdev; /* Receiver device ID */ uint8_t pn_sdev; /* Sender device ID */ uint8_t pn_res; /* Resource ID or function */ uint16_t pn_length; /* Big-endian message byte length (minus 6) */ uint8_t pn_robj; /* Receiver object ID */ uint8_t pn_sobj; /* Sender object ID */ };}hjCsbah}(h]h ]h"]h$]h&]hhuh1jAhhhKhj"hhubjn)}(h~On Linux, the link-layer header includes the pn_media byte (see below). The next 7 bytes are part of the network-layer header.h]h~On Linux, the link-layer header includes the pn_media byte (see below). The next 7 bytes are part of the network-layer header.}(hjQhhhNhNubah}(h]h ]h"]h$]h&]uh1jmhhhK)hj"hhubjn)}(hXFThe device ID is split: the 6 higher-order bits constitute the device address, while the 2 lower-order bits are used for multiplexing, as are the 8-bit object identifiers. As such, Phonet can be considered as a network layer with 6 bits of address space and 10 bits for transport protocol (much like port numbers in IP world).h]hXFThe device ID is split: the 6 higher-order bits constitute the device address, while the 2 lower-order bits are used for multiplexing, as are the 8-bit object identifiers. As such, Phonet can be considered as a network layer with 6 bits of address space and 10 bits for transport protocol (much like port numbers in IP world).}(hj_hhhNhNubah}(h]h ]h"]h$]h&]uh1jmhhhK,hj"hhubjn)}(hZThe modem always has address number zero. All other device have a their own 6-bit address.h]hZThe modem always has address number zero. All other device have a their own 6-bit address.}(hjmhhhNhNubah}(h]h ]h"]h$]h&]uh1jmhhhK2hj"hhubeh}(h]packets-formatah ]h"]packets formatah$]h&]uh1jGhjIhhhhhKubjH)}(hhh](jM)}(h Link layerh]h Link layer}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jLhjhhhhhK7ubjn)}(hXPhonet links are always point-to-point links. The link layer header consists of a single Phonet media type byte. It uniquely identifies the link through which the packet is transmitted, from the modem's perspective. Each Phonet network device shall prepend and set the media type byte as appropriate. For convenience, a common phonet_header_ops link-layer header operations structure is provided. It sets the media type according to the network device hardware address.h]hXPhonet links are always point-to-point links. The link layer header consists of a single Phonet media type byte. It uniquely identifies the link through which the packet is transmitted, from the modem’s perspective. Each Phonet network device shall prepend and set the media type byte as appropriate. For convenience, a common phonet_header_ops link-layer header operations structure is provided. It sets the media type according to the network device hardware address.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jmhhhK9hjhhubjn)}(hLinux Phonet network interfaces support a dedicated link layer packets type (ETH_P_PHONET) which is out of the Ethernet type range. They can only send and receive Phonet packets.h]hLinux Phonet network interfaces support a dedicated link layer packets type (ETH_P_PHONET) which is out of the Ethernet type range. They can only send and receive Phonet packets.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jmhhhKAhjhhubjn)}(hThe virtual TUN tunnel device driver can also be used for Phonet. This requires IFF_TUN mode, _without_ the IFF_NO_PI flag. In this case, there is no link-layer header, so there is no Phonet media type byte.h]hThe virtual TUN tunnel device driver can also be used for Phonet. This requires IFF_TUN mode, _without_ the IFF_NO_PI flag. In this case, there is no link-layer header, so there is no Phonet media type byte.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jmhhhKEhjhhubjn)}(hNote that Phonet interfaces are not allowed to re-order packets, so only the (default) Linux FIFO qdisc should be used with them.h]hNote that Phonet interfaces are not allowed to re-order packets, so only the (default) Linux FIFO qdisc should be used with them.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jmhhhKIhjhhubeh}(h] link-layerah ]h"] link layerah$]h&]uh1jGhjIhhhhhK7ubjH)}(hhh](jM)}(h Network layerh]h Network layer}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jLhjhhhhhKNubjn)}(h@The Phonet socket address family maps the Phonet packet header::h]h?The Phonet socket address family maps the Phonet packet header:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jmhhhKPhjhhubjB)}(hXstruct sockaddr_pn { sa_family_t spn_family; /* AF_PHONET */ uint8_t spn_obj; /* Object ID */ uint8_t spn_dev; /* Device ID */ uint8_t spn_resource; /* Resource or function */ uint8_t spn_zero[...]; /* Padding */ };h]hXstruct sockaddr_pn { sa_family_t spn_family; /* AF_PHONET */ uint8_t spn_obj; /* Object ID */ uint8_t spn_dev; /* Device ID */ uint8_t spn_resource; /* Resource or function */ uint8_t spn_zero[...]; /* Padding */ };}hjsbah}(h]h ]h"]h$]h&]hhuh1jAhhhKRhjhhubjn)}(hfThe resource field is only used when sending and receiving; It is ignored by bind() and getsockname().h]hfThe resource field is only used when sending and receiving; It is ignored by bind() and getsockname().}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jmhhhKZhjhhubeh}(h] network-layerah ]h"] network layerah$]h&]uh1jGhjIhhhhhKNubjH)}(hhh](jM)}(hLow-level datagram protocolh]hLow-level datagram protocol}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jLhjhhhhhK_ubjn)}(hApplications can send Phonet messages using the Phonet datagram socket protocol from the PF_PHONET family. Each socket is bound to one of the 2^10 object IDs available, and can send and receive packets with any other peer.h]hApplications can send Phonet messages using the Phonet datagram socket protocol from the PF_PHONET family. Each socket is bound to one of the 2^10 object IDs available, and can send and receive packets with any other peer.}(hj(hhhNhNubah}(h]h ]h"]h$]h&]uh1jmhhhKahjhhubjB)}(hXsstruct sockaddr_pn addr = { .spn_family = AF_PHONET, }; ssize_t len; socklen_t addrlen = sizeof(addr); int fd; fd = socket(PF_PHONET, SOCK_DGRAM, 0); bind(fd, (struct sockaddr *)&addr, sizeof(addr)); /* ... */ sendto(fd, msg, msglen, 0, (struct sockaddr *)&addr, sizeof(addr)); len = recvfrom(fd, buf, sizeof(buf), 0, (struct sockaddr *)&addr, &addrlen);h]hXsstruct sockaddr_pn addr = { .spn_family = AF_PHONET, }; ssize_t len; socklen_t addrlen = sizeof(addr); int fd; fd = socket(PF_PHONET, SOCK_DGRAM, 0); bind(fd, (struct sockaddr *)&addr, sizeof(addr)); /* ... */ sendto(fd, msg, msglen, 0, (struct sockaddr *)&addr, sizeof(addr)); len = recvfrom(fd, buf, sizeof(buf), 0, (struct sockaddr *)&addr, &addrlen);}hj6sbah}(h]h ]h"]h$]h&]hhuh1jAhhhKhhjhhubjn)}(hThis protocol follows the SOCK_DGRAM connection-less semantics. However, connect() and getpeername() are not supported, as they did not seem useful with Phonet usages (could be added easily).h]hThis protocol follows the SOCK_DGRAM connection-less semantics. However, connect() and getpeername() are not supported, as they did not seem useful with Phonet usages (could be added easily).}(hjDhhhNhNubah}(h]h ]h"]h$]h&]uh1jmhhhKuhjhhubeh}(h]low-level-datagram-protocolah ]h"]low-level datagram protocolah$]h&]uh1jGhjIhhhhhK_ubjH)}(hhh](jM)}(hResource subscriptionh]hResource subscription}(hj]hhhNhNubah}(h]h ]h"]h$]h&]uh1jLhjZhhhhhK{ubjn)}(h`A Phonet datagram socket can be subscribed to any number of 8-bits Phonet resources, as follow::h]h_A Phonet datagram socket can be subscribed to any number of 8-bits Phonet resources, as follow:}(hjkhhhNhNubah}(h]h ]h"]h$]h&]uh1jmhhhK}hjZhhubjB)}(h8uint32_t res = 0xXX; ioctl(fd, SIOCPNADDRESOURCE, &res);h]h8uint32_t res = 0xXX; ioctl(fd, SIOCPNADDRESOURCE, &res);}hjysbah}(h]h ]h"]h$]h&]hhuh1jAhhhKhjZhhubjn)}(hrSubscription is similarly cancelled using the SIOCPNDELRESOURCE I/O control request, or when the socket is closed.h]hrSubscription is similarly cancelled using the SIOCPNDELRESOURCE I/O control request, or when the socket is closed.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jmhhhKhjZhhubjn)}(hwNote that no more than one socket can be subscribed to any given resource at a time. If not, ioctl() will return EBUSY.h]hwNote that no more than one socket can be subscribed to any given resource at a time. If not, ioctl() will return EBUSY.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jmhhhKhjZhhubeh}(h]resource-subscriptionah ]h"]resource subscriptionah$]h&]uh1jGhjIhhhhhK{ubjH)}(hhh](jM)}(hPhonet Pipe protocolh]hPhonet Pipe protocol}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jLhjhhhhhKubjn)}(hX-The Phonet Pipe protocol is a simple sequenced packets protocol with end-to-end congestion control. It uses the passive listening socket paradigm. The listening socket is bound to an unique free object ID. Each listening socket can handle up to 255 simultaneous connections, one per accept()'d socket.h]hX/The Phonet Pipe protocol is a simple sequenced packets protocol with end-to-end congestion control. It uses the passive listening socket paradigm. The listening socket is bound to an unique free object ID. Each listening socket can handle up to 255 simultaneous connections, one per accept()’d socket.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jmhhhKhjhhubjB)}(hint lfd, cfd; lfd = socket(PF_PHONET, SOCK_SEQPACKET, PN_PROTO_PIPE); listen (lfd, INT_MAX); /* ... */ cfd = accept(lfd, NULL, NULL); for (;;) { char buf[...]; ssize_t len = read(cfd, buf, sizeof(buf)); /* ... */ write(cfd, msg, msglen); }h]hint lfd, cfd; lfd = socket(PF_PHONET, SOCK_SEQPACKET, PN_PROTO_PIPE); listen (lfd, INT_MAX); /* ... */ cfd = accept(lfd, NULL, NULL); for (;;) { char buf[...]; ssize_t len = read(cfd, buf, sizeof(buf)); /* ... */ write(cfd, msg, msglen); }}hjsbah}(h]h ]h"]h$]h&]hhuh1jAhhhKhjhhubjn)}(hConnections are traditionally established between two endpoints by a "third party" application. This means that both endpoints are passive.h]hConnections are traditionally established between two endpoints by a “third party” application. This means that both endpoints are passive.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jmhhhKhjhhubjn)}(hXAs of Linux kernel version 2.6.39, it is also possible to connect two endpoints directly, using connect() on the active side. This is intended to support the newer Nokia Wireless Modem API, as found in e.g. the Nokia Slim Modem in the ST-Ericsson U8500 platform::h]hXAs of Linux kernel version 2.6.39, it is also possible to connect two endpoints directly, using connect() on the active side. This is intended to support the newer Nokia Wireless Modem API, as found in e.g. the Nokia Slim Modem in the ST-Ericsson U8500 platform:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jmhhhKhjhhubjB)}(hX)struct sockaddr_spn spn; int fd; fd = socket(PF_PHONET, SOCK_SEQPACKET, PN_PROTO_PIPE); memset(&spn, 0, sizeof(spn)); spn.spn_family = AF_PHONET; spn.spn_obj = ...; spn.spn_dev = ...; spn.spn_resource = 0xD9; connect(fd, (struct sockaddr *)&spn, sizeof(spn)); /* normal I/O here ... */ close(fd);h]hX)struct sockaddr_spn spn; int fd; fd = socket(PF_PHONET, SOCK_SEQPACKET, PN_PROTO_PIPE); memset(&spn, 0, sizeof(spn)); spn.spn_family = AF_PHONET; spn.spn_obj = ...; spn.spn_dev = ...; spn.spn_resource = 0xD9; connect(fd, (struct sockaddr *)&spn, sizeof(spn)); /* normal I/O here ... */ close(fd);}hjsbah}(h]h ]h"]h$]h&]hhuh1jAhhhKhjhhubh)}(hX%Warning: When polling a connected pipe socket for writability, there is an intrinsic race condition whereby writability might be lost between the polling and the writing system calls. In this case, the socket will block until write becomes possible again, unless non-blocking mode is enabled.h]hX%Warning: When polling a connected pipe socket for writability, there is an intrinsic race condition whereby writability might be lost between the polling and the writing system calls. In this case, the socket will block until write becomes possible again, unless non-blocking mode is enabled.}hjsbah}(h]h ]h"]h$]h&]hhuh1hhjhhhhhKubjn)}(hFThe pipe protocol provides two socket options at the SOL_PNPIPE level:h]hFThe pipe protocol provides two socket options at the SOL_PNPIPE level:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jmhhhKhjhhubj)}(hXPNPIPE_ENCAP accepts one integer value (int) of: PNPIPE_ENCAP_NONE: The socket operates normally (default). PNPIPE_ENCAP_IP: The socket is used as a backend for a virtual IP interface. This requires CAP_NET_ADMIN capability. GPRS data support on Nokia modems can use this. Note that the socket cannot be reliably poll()'d or read() from while in this mode. PNPIPE_IFINDEX is a read-only integer value. It contains the interface index of the network interface created by PNPIPE_ENCAP, or zero if encapsulation is off. PNPIPE_HANDLE is a read-only integer value. It contains the underlying identifier ("pipe handle") of the pipe. This is only defined for socket descriptors that are already connected or being connected. h](jn)}(h0PNPIPE_ENCAP accepts one integer value (int) of:h]h0PNPIPE_ENCAP accepts one integer value (int) of:}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1jmhhhKhjubj)}(hX?PNPIPE_ENCAP_NONE: The socket operates normally (default). PNPIPE_ENCAP_IP: The socket is used as a backend for a virtual IP interface. This requires CAP_NET_ADMIN capability. GPRS data support on Nokia modems can use this. Note that the socket cannot be reliably poll()'d or read() from while in this mode. h]hdefinition_list)}(hhh](hdefinition_list_item)}(h;PNPIPE_ENCAP_NONE: The socket operates normally (default). h](hterm)}(hPNPIPE_ENCAP_NONE:h]hPNPIPE_ENCAP_NONE:}(hjAhhhNhNubah}(h]h ]h"]h$]h&]uh1j?hhhKhj;ubh definition)}(hhh]jn)}(h'The socket operates normally (default).h]h'The socket operates normally (default).}(hjThhhNhNubah}(h]h ]h"]h$]h&]uh1jmhhhKhjQubah}(h]h ]h"]h$]h&]uh1jOhj;ubeh}(h]h ]h"]h$]h&]uh1j9hhhKhj6ubj:)}(hPNPIPE_ENCAP_IP: The socket is used as a backend for a virtual IP interface. This requires CAP_NET_ADMIN capability. GPRS data support on Nokia modems can use this. Note that the socket cannot be reliably poll()'d or read() from while in this mode. h](j@)}(hPNPIPE_ENCAP_IP:h]hPNPIPE_ENCAP_IP:}(hjrhhhNhNubah}(h]h ]h"]h$]h&]uh1j?hhhKhjnubjP)}(hhh]jn)}(hThe socket is used as a backend for a virtual IP interface. This requires CAP_NET_ADMIN capability. GPRS data support on Nokia modems can use this. Note that the socket cannot be reliably poll()'d or read() from while in this mode.h]hThe socket is used as a backend for a virtual IP interface. This requires CAP_NET_ADMIN capability. GPRS data support on Nokia modems can use this. Note that the socket cannot be reliably poll()’d or read() from while in this mode.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jmhhhKhjubah}(h]h ]h"]h$]h&]uh1jOhjnubeh}(h]h ]h"]h$]h&]uh1j9hhhKhj6ubeh}(h]h ]h"]h$]h&]uh1j4hj0ubah}(h]h ]h"]h$]h&]uh1jhhhKhjubj5)}(hhh](j:)}(hPNPIPE_IFINDEX is a read-only integer value. It contains the interface index of the network interface created by PNPIPE_ENCAP, or zero if encapsulation is off. h](j@)}(hPNPIPE_IFINDEXh]hPNPIPE_IFINDEX}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j?hhhKhjubjP)}(hhh]jn)}(his a read-only integer value. It contains the interface index of the network interface created by PNPIPE_ENCAP, or zero if encapsulation is off.h]his a read-only integer value. It contains the interface index of the network interface created by PNPIPE_ENCAP, or zero if encapsulation is off.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jmhhhKhjubah}(h]h ]h"]h$]h&]uh1jOhjubeh}(h]h ]h"]h$]h&]uh1j9hhhKhjubj:)}(hPNPIPE_HANDLE is a read-only integer value. It contains the underlying identifier ("pipe handle") of the pipe. This is only defined for socket descriptors that are already connected or being connected. h](j@)}(h PNPIPE_HANDLEh]h PNPIPE_HANDLE}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j?hhhKhjubjP)}(hhh]jn)}(his a read-only integer value. It contains the underlying identifier ("pipe handle") of the pipe. This is only defined for socket descriptors that are already connected or being connected.h]his a read-only integer value. It contains the underlying identifier (“pipe handle”) of the pipe. This is only defined for socket descriptors that are already connected or being connected.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jmhhhKhjubah}(h]h ]h"]h$]h&]uh1jOhjubeh}(h]h ]h"]h$]h&]uh1j9hhhKhjubeh}(h]h ]h"]h$]h&]uh1j4hjubeh}(h]h ]h"]h$]h&]uh1jhhhKhjhhubeh}(h]phonet-pipe-protocolah ]h"]phonet pipe protocolah$]h&]uh1jGhjIhhhhhKubjH)}(hhh](jM)}(hAuthorsh]hAuthors}(hj! hhhNhNubah}(h]h ]h"]h$]h&]uh1jLhj hhhhhKubjn)}(h3Linux Phonet was initially written by Sakari Ailus.h]h3Linux Phonet was initially written by Sakari Ailus.}(hj/ hhhNhNubah}(h]h ]h"]h$]h&]uh1jmhhhKhj hhubjn)}(hcOther contributors include Mikä Liljeberg, Andras Domokos, Carlos Chinea and Rémi Denis-Courmont.h]hcOther contributors include Mikä Liljeberg, Andras Domokos, Carlos Chinea and Rémi Denis-Courmont.}(hj= hhhNhNubah}(h]h ]h"]h$]h&]uh1jmhhhKhj hhubjn)}(h(Copyright |copy| 2008 Nokia Corporation.h](h Copyright }(hjK hhhNhNubh©}(hjK hhhNhNubh 2008 Nokia Corporation.}(hjK hhhNhNubeh}(h]h ]h"]h$]h&]uh1jmhhhKhj hhubeh}(h]authorsah ]h"]authorsah$]h&]uh1jGhjIhhhhhKubeh}(h]linux-phonet-protocol-familyah ]h"]linux phonet protocol familyah$]h&]uh1jGhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(jLN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerj error_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}(hhhhhhj jjjj*jj9j-jHj<jWjKjfjZjujijjxjjjjjjjjjjjjjjjjj jjjj)jj8j,jGj;jVjJjejYjtjhjjwjjjjjjjjjjjjjjjjj jjj j(jj7j+jFj:jUjIjdjXjsjgjjvjjjjjjjjjjjjjjjjj jjj j'jj6j*jEj9jTjHjcjWjrjfjjujjjjjjjjjjjjjjjjjjjj j&jj5j)jDj8usubstitution_names}(amphߌaposhasthbrvbarj bsoljcentj*colonj9commajHcommatjWcopyjfcurrenjudarrjdegjdividejdollarjequalsjexcljfrac12jfrac14jfrac18jfrac34j frac38jfrac58j)frac78j8gtjGhalfjVhorbarjehyphenjtiexcljiquestjlaquojlarrjlcubjldquojlowbarjlparjlsqbjlsquoj ltjmicroj(middotj7nbspjFnotjUnumjdohmjsordfjordmjparajpercntjperiodjplusjplusmnjpoundjquestjquotj raquojrarrj'rcubj6rdquojEregjTrparjcrsqbjrrsquojsectjsemijshyjsoljsungjsup1jsup2jsup3jtimesjtradejuarrj&verbarj5yenjDurefnames}refids}nameids}(jn jk jjjj}jjjjjWjTjjj j jf jc u nametypes}(jn jjjjjWjj jf uh}(jk jIjj\j}j"jjjjjTjjjZj jjc j u footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages] transformerN include_log]#Documentation/networking/phonet.rst(NNNNta decorationNhhub.