From patchwork Mon Nov 21 20:34:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schmidt X-Patchwork-Id: 9440017 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C9C0960469 for ; Mon, 21 Nov 2016 20:34:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA97F28892 for ; Mon, 21 Nov 2016 20:34:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC280288AC; Mon, 21 Nov 2016 20:34:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4707528892 for ; Mon, 21 Nov 2016 20:34:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754480AbcKUUeh (ORCPT ); Mon, 21 Nov 2016 15:34:37 -0500 Received: from proxima.lasnet.de ([78.47.171.185]:47092 "EHLO proxima.lasnet.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754751AbcKUUeh (ORCPT ); Mon, 21 Nov 2016 15:34:37 -0500 Received: from localhost.localdomain (p20030048092FF37D9A8389FFFE20FF3F.dip0.t-ipconnect.de [IPv6:2003:48:92f:f37d:9a83:89ff:fe20:ff3f]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: stefan@sostec.de) by proxima.lasnet.de (Postfix) with ESMTPSA id 6111DC029C; Mon, 21 Nov 2016 21:34:35 +0100 (CET) From: Stefan Schmidt To: linux-wpan@vger.kernel.org Cc: Alexander Aring , Stefan Schmidt Subject: [PATCH wpan-tools 1/8] examples: add README with details to the various examples Date: Mon, 21 Nov 2016 21:34:14 +0100 Message-Id: <1479760461-18947-2-git-send-email-stefan@osg.samsung.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1479760461-18947-1-git-send-email-stefan@osg.samsung.com> References: <1479760461-18947-1-git-send-email-stefan@osg.samsung.com> Sender: linux-wpan-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Describe the current set of example to give some background what they intend to show case. Signed-off-by: Stefan Schmidt --- Makefile.am | 3 ++- configure.ac | 1 + examples/Makefile.am | 1 + examples/README.examples | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 examples/Makefile.am create mode 100644 examples/README.examples diff --git a/Makefile.am b/Makefile.am index 2261603..37f18b6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -20,4 +20,5 @@ AM_LDFLAGS = \ SUBDIRS = \ src \ - wpan-ping + wpan-ping \ + examples diff --git a/configure.ac b/configure.ac index 6d438c4..289fd7f 100644 --- a/configure.ac +++ b/configure.ac @@ -56,6 +56,7 @@ AC_CONFIG_FILES([ Makefile src/Makefile wpan-ping/Makefile + examples/Makefile ]) AC_OUTPUT diff --git a/examples/Makefile.am b/examples/Makefile.am new file mode 100644 index 0000000..1b6a35e --- /dev/null +++ b/examples/Makefile.am @@ -0,0 +1 @@ +EXTRA_DIST = README.examples diff --git a/examples/README.examples b/examples/README.examples new file mode 100644 index 0000000..11e9424 --- /dev/null +++ b/examples/README.examples @@ -0,0 +1,34 @@ +This folder contains various examples on how the Linux-wpan stack can be used +from userspace, using the Linux socket interface. + +These examples do not cover all socket programming functionality nor do they +give a real introduction to it. Their aim is to provide some quick examples for +using the Linux-wpan stack for developers familiar with socket programming. + +Keep in mind that the socket interface is used for the data plane. For the +configuration plane you would use netlink, which is heavily demonstrated in +iwpan itself. + +Examples: +--------- +Address family AF_IEEE802154 with type SOCK_DGRAM: + * Direct usage of IEEE 802.15.4 frames, no 6LoWPAN involved + * Short and extended address usage is demonstrated + * af_ieee802154_rx loops and prints each received IEEE 802.15.4 frame on stdout + * af_ieee802154_tx sends a IEEE 802.15.4 frame + +Address family AF_INET6 with type SOCK_DGRAM: + * 6LoWPAN examples, IPv6 over IEEE 802.15.4 + * af_inet6_rx binds on any IPv6 address on UDP port + * af_inet6_tx sends an UDP packet to the IPv6 all nodes address + +Address family AF_PACKET with type SOCK_RAW: + * Raw access to IEEE 8021.5.4 frames for rx and tx + * Useful for sniffer, packet generators, network stack in userspace, etc + * af_packet_rx loops and prints each frame as hexdump + * af_packet_tx constructs the raw packet payload manually and sends it + +Some of the example need special privileges to run. If you get a error like: +socket: Operation not permitted + +Make sure your user that the needed privileges or run the example with sudo.