From patchwork Fri Oct 3 14:09:39 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 2560 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id B928BDE138 for ; Sat, 4 Oct 2008 00:10:07 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752265AbYJCOJ4 (ORCPT ); Fri, 3 Oct 2008 10:09:56 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752206AbYJCOJy (ORCPT ); Fri, 3 Oct 2008 10:09:54 -0400 Received: from smtp.nokia.com ([192.100.122.230]:32376 "EHLO mgw-mx03.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752246AbYJCOJs (ORCPT ); Fri, 3 Oct 2008 10:09:48 -0400 Received: from esebh105.NOE.Nokia.com (esebh105.ntc.nokia.com [172.21.138.211]) by mgw-mx03.nokia.com (Switch-3.2.6/Switch-3.2.6) with ESMTP id m93E9MYP013730 for ; Fri, 3 Oct 2008 17:09:45 +0300 Received: from vaebh102.NOE.Nokia.com ([10.160.244.23]) by esebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 3 Oct 2008 17:09:40 +0300 Received: from localhost.localdomain ([172.21.41.96]) by vaebh102.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 3 Oct 2008 17:09:40 +0300 From: Remi Denis-Courmont To: netdev@vger.kernel.org Cc: =?utf-8?q?R=C3=A9mi=20Denis-Courmont?= Subject: [PATCH 6/6] Phonet: pipe end-point protocol documentation Date: Fri, 3 Oct 2008 17:09:39 +0300 Message-Id: <1223042979-21124-6-git-send-email-remi.denis-courmont@nokia.com> X-Mailer: git-send-email 1.5.4.3 In-Reply-To: <200810031709.11828.remi.denis-courmont@nokia.com> References: <200810031709.11828.remi.denis-courmont@nokia.com> MIME-Version: 1.0 X-OriginalArrivalTime: 03 Oct 2008 14:09:40.0221 (UTC) FILETIME=[AD0E22D0:01C92561] X-Nokia-AV: Clean Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Rémi Denis-Courmont Signed-off-by: Rémi Denis-Courmont --- Documentation/networking/phonet.txt | 54 +++++++++++++++++++++++++++++++++++ 1 files changed, 54 insertions(+), 0 deletions(-) diff --git a/Documentation/networking/phonet.txt b/Documentation/networking/phonet.txt index 57d3e59..0e6e592 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 not seem useful with Phonet usages (could be added easily). +Phonet Pipe protocol +-------------------- + +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. + + int 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); + } + +Connections are established between two endpoints by a "third party" +application. This means that both endpoints are passive; so connect() +is not possible. + +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 because possible again, unless non-blocking mode +becomes enabled. + + +The pipe protocol provides two socket options at the SOL_PNPIPE level: + + PNPIPE_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. + + Authors -------