mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
gnrc_zep: remove gnrc_zep
This ZEP implementation is based on `gnrc_netdev`, it is complicated to use, I'm not even sure anyone used it except me or if it is working still. See #6121 for a better port of ZEP.
This commit is contained in:
parent
5bf4882592
commit
5e983db605
@ -94,14 +94,6 @@ ifneq (,$(filter netdev2_tap,$(USEMODULE)))
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq (,$(filter gnrc_zep,$(USEMODULE)))
|
||||
USEMODULE += hashes
|
||||
USEMODULE += ieee802154
|
||||
USEMODULE += gnrc_udp
|
||||
USEMODULE += random
|
||||
USEMODULE += xtimer
|
||||
endif
|
||||
|
||||
ifneq (,$(filter gnrc_tftp,$(USEMODULE)))
|
||||
USEMODULE += gnrc_udp
|
||||
USEMODULE += xtimer
|
||||
|
@ -1,242 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Martine Lenders <mlenders@inf.fu-berlin.de>
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser General
|
||||
* Public License v2.1. See the file LICENSE in the top level directory for
|
||||
* more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup net_gnrc_zep Zigbee Encapsulation Protocol
|
||||
* @ingroup net_gnrc
|
||||
* @brief Transports IEEE 802.15.4 frames over UDP (can be parsed by
|
||||
* Wireshark)
|
||||
* @note Stability uncertain
|
||||
* @see <a href="https://www.wireshark.org/docs/dfref/z/zep.html">
|
||||
* ZigBee Encapsulation Protocol in the Wireshark docs
|
||||
* </a>
|
||||
* @see <a href="https://code.wireshark.org/review/gitweb?p=wireshark.git;a=blob;f=epan/dissectors/packet-zep.c;h=3422eb7876f973f191da98cc4c02aecbd0dbaaeb;hb=HEAD">
|
||||
* ZEP packet definition in the Wireshark code base.
|
||||
* </a>
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief ZEP definitions
|
||||
*
|
||||
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
|
||||
*/
|
||||
|
||||
|
||||
#ifndef GNRC_ZEP_H
|
||||
#define GNRC_ZEP_H
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "byteorder.h"
|
||||
#include "kernel_types.h"
|
||||
#include "net/ipv6/addr.h"
|
||||
#include "net/gnrc/nettype.h"
|
||||
#include "thread.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Maximum possible packet size in byte
|
||||
*/
|
||||
#define GNRC_ZEP_MAX_PKT_LENGTH (116)
|
||||
|
||||
/**
|
||||
* @brief Default stack size to use for the ZEP thread
|
||||
*/
|
||||
#ifndef GNRC_ZEP_STACK_SIZE
|
||||
#define GNRC_ZEP_STACK_SIZE (THREAD_STACKSIZE_DEFAULT)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Default priority for the ZEP thread
|
||||
*/
|
||||
#ifndef GNRC_ZEP_PRIO
|
||||
#define GNRC_ZEP_PRIO (THREAD_PRIORITY_MAIN - 5)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Default message queue size to use for the ZEP thread.
|
||||
*/
|
||||
#ifndef GNRC_ZEP_MSG_QUEUE_SIZE
|
||||
#define GNRC_ZEP_MSG_QUEUE_SIZE (8U)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Default addresses if the CPUID module is not present
|
||||
* @{
|
||||
*/
|
||||
#define GNRC_ZEP_DEFAULT_ADDR_SHORT (0x98b0)
|
||||
#define GNRC_ZEP_DEFAULT_ADDR_LONG (0x4a8a6377552b4249)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Channel configuration
|
||||
* @{
|
||||
*/
|
||||
#define GNRC_ZEP_MIN_CHANNEL (IEEE802154_CHANNEL_MIN)
|
||||
#define GNRC_ZEP_MAX_CHANNEL (IEEE802154_CHANNEL_MAX)
|
||||
#define GNRC_ZEP_DEFAULT_CHANNEL (IEEE802154_DEFAULT_CHANNEL)
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Default PAN ID
|
||||
*
|
||||
* @todo Read some global network stack specific configuration value
|
||||
*/
|
||||
#define GNRC_ZEP_DEFAULT_PANID (IEEE802154_DEFAULT_PANID)
|
||||
|
||||
/**
|
||||
* @brief Option flags for the ZEP device
|
||||
* @{
|
||||
*/
|
||||
#define GNRC_ZEP_FLAGS_AUTOACK (0x0001) /**< auto ACKS active */
|
||||
#define GNRC_ZEP_FLAGS_SRC_ADDR_LONG (0x0002) /**< send data using long source address */
|
||||
#define GNRC_ZEP_FLAGS_DST_ADDR_LONG (0x0004) /**< send data using long destination address */
|
||||
#define GNRC_ZEP_FLAGS_USE_SRC_PAN (0x0008) /**< do not compress source PAN ID */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Default UDP port for ZEP
|
||||
*/
|
||||
#define GNRC_ZEP_DEFAULT_PORT (17754)
|
||||
|
||||
/**
|
||||
* @brief Type == Data for ZEPv2 header
|
||||
*/
|
||||
#define GNRC_ZEP_V2_TYPE_DATA (1)
|
||||
|
||||
/**
|
||||
* @brief Type == Ack for ZEPv2 header
|
||||
*/
|
||||
#define GNRC_ZEP_V2_TYPE_ACK (2)
|
||||
|
||||
/**
|
||||
* @brief Mask for length field
|
||||
*/
|
||||
#define ZEP_LENGTH_MASK (0x7f)
|
||||
|
||||
/**
|
||||
* @brief ZEP header definition
|
||||
*/
|
||||
typedef struct __attribute__((packed)) {
|
||||
char preamble[2]; /**< Preamble code (must be "EX") */
|
||||
uint8_t version; /**< Protocol Version (must be 1 or 2) */
|
||||
} gnrc_zep_hdr_t;
|
||||
|
||||
/**
|
||||
* @brief ZEPv1 header definition
|
||||
* @extends gnrc_zep_hdr_t
|
||||
*/
|
||||
typedef struct __attribute__((packed)) {
|
||||
char preamble[2]; /**< preamble code (must be "EX") */
|
||||
uint8_t version; /**< protocol Version (must be 1) */
|
||||
uint8_t chan; /**< channel ID */
|
||||
network_uint16_t dev; /**< device ID */
|
||||
uint8_t lqi_mode; /**< CRC/LQI Mode */
|
||||
uint8_t lqi_val; /**< LQI value */
|
||||
uint8_t resv[7]; /**< reserved field, must always be 0 */
|
||||
uint8_t length; /**< length of the frame */
|
||||
} gnrc_zep_v1_hdr_t;
|
||||
|
||||
/**
|
||||
* @brief ZEPv2 header definition (type == Data)
|
||||
* @extends gnrc_zep_hdr_t
|
||||
*/
|
||||
typedef struct __attribute__((packed)) {
|
||||
char preamble[2]; /**< preamble code (must be "EX") */
|
||||
uint8_t version; /**< protocol Version (must be 2) */
|
||||
uint8_t type; /**< type (must be 1/Data) */
|
||||
uint8_t chan; /**< channel ID */
|
||||
network_uint16_t dev; /**< device ID */
|
||||
uint8_t lqi_mode; /**< CRC/LQI Mode */
|
||||
uint8_t lqi_val; /**< LQI value */
|
||||
network_uint64_t time; /**< NTP timestamp */
|
||||
network_uint32_t seq; /**< Sequence number */
|
||||
uint8_t resv[10]; /**< reserved field, must always be 0 */
|
||||
uint8_t length; /**< length of the frame */
|
||||
} gnrc_zep_v2_data_hdr_t;
|
||||
|
||||
/**
|
||||
* @brief ZEPv2 header definition (type == Ack)
|
||||
* @extends gnrc_zep_hdr_t
|
||||
*/
|
||||
typedef struct __attribute__((packed)) {
|
||||
char preamble[2]; /**< preamble code (must be "EX") */
|
||||
uint8_t version; /**< protocol Version (must be 2) */
|
||||
uint8_t type; /**< type (must be 2/Ack) */
|
||||
network_uint32_t seq; /**< Sequence number */
|
||||
} gnrc_zep_v2_ack_hdr_t;
|
||||
|
||||
/**
|
||||
* @brief ZEP device descriptor.
|
||||
*
|
||||
* @extends gnrc_netdev_t
|
||||
*/
|
||||
typedef struct {
|
||||
gnrc_netdev_driver_t *driver; /**< pointer to the device's interface */
|
||||
gnrc_netdev_event_cb_t event_cb;/**< netdev event callback */
|
||||
kernel_pid_t mac_pid; /**< the driver's thread's PID */
|
||||
/**
|
||||
* @brief @ref gnrc_zep_t specific members
|
||||
* @{
|
||||
*/
|
||||
le_uint16_t addr; /**< the device's short address */
|
||||
le_uint64_t eui64; /**< the device's EUI-64 */
|
||||
le_uint16_t pan; /**< the device's PAN ID */
|
||||
uint16_t flags; /**< the device's option flags */
|
||||
uint32_t seq; /**< the current sequence number for frames */
|
||||
ipv6_addr_t dst; /**< destination IPv6 address */
|
||||
uint16_t src_port; /**< source UDP port */
|
||||
uint16_t dst_port; /**< destination UDP port */
|
||||
gnrc_nettype_t proto; /**< the target protocol for received packets */
|
||||
uint8_t chan; /**< the device's channel */
|
||||
uint8_t version; /**< ZEP version to use (default 2) */
|
||||
uint8_t lqi_mode; /**< LQI mode for send packets (default 1) */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
} gnrc_zep_t;
|
||||
|
||||
/**
|
||||
* @brief Initializion of the ZEP thread and device.
|
||||
*
|
||||
* @param[in] dev Network device, will be initialized.
|
||||
* @param[in] src_port Source port to use in UDP datagrams. Also the port
|
||||
* @ref net_gnrc_zep registers to in @ref net_gnrc_netreg.
|
||||
* @param[in] dst Destination address to use in IPv6 packets.
|
||||
* @param[in] dst_port Destination port to use in UDP datagrams.
|
||||
*
|
||||
* @return PID of the ZEP thread on success.
|
||||
* @return -EADDRINUSE, if @p src_port is already ready registered to
|
||||
* @ref net_gnrc_netreg.
|
||||
* @return -EEXIST, if ZEP thread was already created.
|
||||
* @return -EINVAL, if @ref GNRC_ZEP_PRIO is greater than or equal to
|
||||
* @ref SCHED_PRIO_LEVELS
|
||||
* @return -ENODEV, if @p dev is NULL.
|
||||
* @return -ENOTSUP, if @p dst is NULL or unspecified address (::).
|
||||
* @return -EOVERFLOW, if there are too many threads running already
|
||||
*/
|
||||
kernel_pid_t gnrc_zep_init(gnrc_zep_t *dev, uint16_t src_port, ipv6_addr_t *dst,
|
||||
uint16_t dst_port);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GNRC_ZEP_H */
|
||||
/**
|
||||
* @}
|
||||
*/
|
@ -133,9 +133,6 @@ endif
|
||||
ifneq (,$(filter gnrc_tcp,$(USEMODULE)))
|
||||
DIRS += transport_layer/tcp
|
||||
endif
|
||||
ifneq (,$(filter gnrc_zep,$(USEMODULE)))
|
||||
DIRS += application_layer/zep
|
||||
endif
|
||||
ifneq (,$(filter gnrc_tftp,$(USEMODULE)))
|
||||
DIRS += application_layer/tftp
|
||||
endif
|
||||
|
@ -1,3 +0,0 @@
|
||||
MODULE = gnrc_zep
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
File diff suppressed because it is too large
Load Diff
@ -47,11 +47,6 @@ endif
|
||||
ifneq (,$(filter gnrc_icmpv6_echo,$(USEMODULE)))
|
||||
SRC += sc_icmpv6_echo.c
|
||||
endif
|
||||
ifneq (,$(filter gnrc_zep,$(USEMODULE)))
|
||||
ifneq (,$(filter ipv6_addr,$(USEMODULE)))
|
||||
SRC += sc_zep.c
|
||||
endif
|
||||
endif
|
||||
ifneq (,$(filter gnrc_rpl,$(USEMODULE)))
|
||||
SRC += sc_gnrc_rpl.c
|
||||
endif
|
||||
|
@ -1,99 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Martine Lenders <mlenders@inf.fu-berlin.de>
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "net/ipv6/addr.h"
|
||||
#include "net/gnrc/ipv6/netif.h"
|
||||
#include "net/gnrc/nomac.h"
|
||||
#include "net/gnrc/zep.h"
|
||||
#include "thread.h"
|
||||
|
||||
static gnrc_zep_t zep;
|
||||
static char zep_stack[THREAD_STACKSIZE_DEFAULT];
|
||||
|
||||
int _zep_init(int argc, char **argv)
|
||||
{
|
||||
uint16_t src_port = GNRC_ZEP_DEFAULT_PORT;
|
||||
uint16_t dst_port = GNRC_ZEP_DEFAULT_PORT;
|
||||
ipv6_addr_t dst_addr;
|
||||
int res;
|
||||
|
||||
if (argc < 2) {
|
||||
printf("usage: %s dst_addr [src_port [dst_port]]\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (argc > 2) {
|
||||
src_port = (uint16_t)atoi(argv[2]);
|
||||
}
|
||||
|
||||
if (argc > 3) {
|
||||
dst_port = (uint16_t)atoi(argv[3]);
|
||||
}
|
||||
|
||||
ipv6_addr_from_str(&dst_addr, argv[1]);
|
||||
|
||||
if ((res = gnrc_zep_init(&zep, src_port, &dst_addr, dst_port)) < 0) {
|
||||
switch (res) {
|
||||
case -EADDRINUSE:
|
||||
printf("error: Source port %" PRIu16 " already in use\n", src_port);
|
||||
break;
|
||||
|
||||
case -EEXIST:
|
||||
puts("error: ZEP already intialized");
|
||||
break;
|
||||
|
||||
case -ENOTSUP:
|
||||
printf("error: dst_addr (%s) invalid\n", argv[1]);
|
||||
break;
|
||||
|
||||
case -EOVERFLOW:
|
||||
puts("error: too many threads running");
|
||||
break;
|
||||
|
||||
default:
|
||||
puts("unexpected error");
|
||||
break;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((res = gnrc_nomac_init(zep_stack, sizeof(zep_stack), THREAD_PRIORITY_MAIN - 3,
|
||||
"zep_l2", (gnrc_netdev_t *)&zep)) < 0) {
|
||||
switch (res) {
|
||||
case -EOVERFLOW:
|
||||
puts("error: too many threads running");
|
||||
break;
|
||||
|
||||
default:
|
||||
puts("unexpected error");
|
||||
break;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef MODULE_GNRC_IPV6_NETIF
|
||||
gnrc_ipv6_netif_init_by_dev();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** @} */
|
@ -106,12 +106,6 @@ extern int _whitelist(int argc, char **argv);
|
||||
extern int _blacklist(int argc, char **argv);
|
||||
#endif
|
||||
|
||||
#ifdef MODULE_GNRC_ZEP
|
||||
#ifdef MODULE_IPV6_ADDR
|
||||
extern int _zep_init(int argc, char **argv);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MODULE_GNRC_RPL
|
||||
extern int _gnrc_rpl(int argc, char **argv);
|
||||
#endif
|
||||
@ -198,11 +192,6 @@ const shell_command_t _shell_command_list[] = {
|
||||
#ifdef MODULE_GNRC_IPV6_BLACKLIST
|
||||
{"blacklist", "blacklists an address for receival ('blacklist [add|del|help]')", _blacklist },
|
||||
#endif
|
||||
#ifdef MODULE_GNRC_ZEP
|
||||
#ifdef MODULE_IPV6_ADDR
|
||||
{"zep_init", "initializes ZEP (Zigbee Encapsulation Protocol)", _zep_init },
|
||||
#endif
|
||||
#endif
|
||||
#ifdef MODULE_GNRC_RPL
|
||||
{"rpl", "rpl configuration tool ('rpl help' for more information)", _gnrc_rpl },
|
||||
#endif
|
||||
|
@ -1,30 +0,0 @@
|
||||
APPLICATION = zep
|
||||
include ../Makefile.tests_common
|
||||
|
||||
# though it would work in theory on other boards I'm currently not willing/to
|
||||
# time-constraint to put effort into this for other boards.
|
||||
BOARD_WHITELIST = native
|
||||
|
||||
USEMODULE += gnrc_zep
|
||||
USEMODULE += gnrc_netdev_default
|
||||
USEMODULE += auto_init_gnrc_netif
|
||||
USEMODULE += gnrc_ipv6_default
|
||||
USEMODULE += gnrc_nomac
|
||||
USEMODULE += gnrc_pktdump
|
||||
USEMODULE += shell
|
||||
USEMODULE += shell_commands
|
||||
|
||||
# set optional default values for ZEP parameters if unset
|
||||
ZEP_DST ?= "\"::1\""
|
||||
ZEP_SRC_PORT ?= GNRC_ZEP_DEFAULT_PORT
|
||||
ZEP_DST_PORT ?= GNRC_ZEP_DEFAULT_PORT
|
||||
|
||||
# export ZEP parameters
|
||||
CFLAGS += -DZEP_DST="\"$(ZEP_DST)\""
|
||||
CFLAGS += -DZEP_SRC_PORT=$(ZEP_SRC_PORT)
|
||||
CFLAGS += -DZEP_DST_PORT=$(ZEP_DST_PORT)
|
||||
|
||||
# one for gnrc_netdev_default and one for ZEP
|
||||
CFLAGS += -DGNRC_NETIF_NUMOF=2
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Freie Universität Berlin
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup tests
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Test application for ZEP module
|
||||
*
|
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "shell.h"
|
||||
#include "shell_commands.h"
|
||||
#include "net/gnrc.h"
|
||||
#include "net/gnrc/pktdump.h"
|
||||
|
||||
/**
|
||||
* @brief Maybe you are a golfer?!
|
||||
*/
|
||||
int main(void)
|
||||
{
|
||||
gnrc_netreg_entry_t dump = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL,
|
||||
gnrc_pktdump_pid);
|
||||
|
||||
puts("ZEP module test");
|
||||
|
||||
/* initialize and register pktdump */
|
||||
if (gnrc_pktdump_pid <= KERNEL_PID_UNDEF) {
|
||||
puts("Error starting pktdump thread");
|
||||
return -1;
|
||||
}
|
||||
|
||||
gnrc_netreg_register(GNRC_NETTYPE_NETIF, &dump);
|
||||
|
||||
/* start the shell */
|
||||
puts("Initialization OK, starting shell now");
|
||||
char line_buf[SHELL_DEFAULT_BUFSIZE];
|
||||
shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user