aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/networking/phonet.txt
diff options
context:
space:
mode:
authorRémi Denis-Courmont <remi.denis-courmont@nokia.com>2008-10-05 14:16:36 -0400
committerDavid S. Miller <davem@davemloft.net>2008-10-05 14:16:36 -0400
commit95430c0b140c31cb9e39f876afe1c0e9947d1aaf (patch)
tree1bf8dbb798f60a86451f8c63669765427fc9852a /Documentation/networking/phonet.txt
parent02a47617cdce440f60c71a51f3a93f9f5fcc5a7a (diff)
Phonet: pipe end-point protocol documentation
Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'Documentation/networking/phonet.txt')
-rw-r--r--Documentation/networking/phonet.txt54
1 files changed, 54 insertions, 0 deletions
diff --git a/Documentation/networking/phonet.txt b/Documentation/networking/phonet.txt
index 57d3e59edb13..0e6e592f4f55 100644
--- a/Documentation/networking/phonet.txt
+++ b/Documentation/networking/phonet.txt
@@ -112,6 +112,60 @@ However, connect() and getpeername() are not supported, as they did
112not seem useful with Phonet usages (could be added easily). 112not seem useful with Phonet usages (could be added easily).
113 113
114 114
115Phonet Pipe protocol
116--------------------
117
118The Phonet Pipe protocol is a simple sequenced packets protocol
119with end-to-end congestion control. It uses the passive listening
120socket paradigm. The listening socket is bound to an unique free object
121ID. Each listening socket can handle up to 255 simultaneous
122connections, one per accept()'d socket.
123
124 int lfd, cfd;
125
126 lfd = socket(PF_PHONET, SOCK_SEQPACKET, PN_PROTO_PIPE);
127 listen (lfd, INT_MAX);
128
129 /* ... */
130 cfd = accept(lfd, NULL, NULL);
131 for (;;)
132 {
133 char buf[...];
134 ssize_t len = read(cfd, buf, sizeof(buf));
135
136 /* ... */
137
138 write(cfd, msg, msglen);
139 }
140
141Connections are established between two endpoints by a "third party"
142application. This means that both endpoints are passive; so connect()
143is not possible.
144
145WARNING:
146When polling a connected pipe socket for writability, there is an
147intrinsic race condition whereby writability might be lost between the
148polling and the writing system calls. In this case, the socket will
149block until write because possible again, unless non-blocking mode
150becomes enabled.
151
152
153The pipe protocol provides two socket options at the SOL_PNPIPE level:
154
155 PNPIPE_ENCAP accepts one integer value (int) of:
156
157 PNPIPE_ENCAP_NONE: The socket operates normally (default).
158
159 PNPIPE_ENCAP_IP: The socket is used as a backend for a virtual IP
160 interface. This requires CAP_NET_ADMIN capability. GPRS data
161 support on Nokia modems can use this. Note that the socket cannot
162 be reliably poll()'d or read() from while in this mode.
163
164 PNPIPE_IFINDEX is a read-only integer value. It contains the
165 interface index of the network interface created by PNPIPE_ENCAP,
166 or zero if encapsulation is off.
167
168
115Authors 169Authors
116------- 170-------
117 171