Skip to content

Commit

Permalink
Merge pull request #2454 from authmillenon/ng_ipv6/feat/initial
Browse files Browse the repository at this point in the history
ng_ipv6: initial import
  • Loading branch information
miri64 committed Apr 22, 2015
2 parents b6c1dda + a0c6db6 commit 8e4edf2
Show file tree
Hide file tree
Showing 7 changed files with 607 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,19 @@ ifneq (,$(filter ng_ipv6_hdr,$(USEMODULE)))
USEMODULE += ng_pktbuf
endif

ifneq (,$(filter ng_ipv6_router,$(USEMODULE)))
USEMODULE += ng_ipv6
endif

ifneq (,$(filter ng_ipv6,$(USEMODULE)))
USEMODULE += ng_inet_csum
USEMODULE += ng_ipv6_addr
USEMODULE += ng_ipv6_hdr
USEMODULE += ng_ipv6_nc
USEMODULE += ng_ipv6_netif
USEMODULE += ng_netbase
endif

ifneq (,$(filter ng_ipv6_nc,$(USEMODULE)))
USEMODULE += ng_ipv6_addr
endif
Expand Down
1 change: 1 addition & 0 deletions Makefile.pseudomodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
PSEUDOMODULES += defaulttransceiver
PSEUDOMODULES += transport_layer
PSEUDOMODULES += ng_ipv6_router
PSEUDOMODULES += pktqueue
PSEUDOMODULES += ng_netbase
3 changes: 3 additions & 0 deletions sys/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ endif
ifneq (,$(filter oneway_malloc,$(USEMODULE)))
DIRS += oneway-malloc
endif
ifneq (,$(filter ng_ipv6,$(USEMODULE)))
DIRS += net/network_layer/ng_ipv6
endif
ifneq (,$(filter ng_ipv6_addr,$(USEMODULE)))
DIRS += net/network_layer/ng_ipv6/addr
endif
Expand Down
8 changes: 8 additions & 0 deletions sys/auto_init/auto_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@
#include "periph/cpuid.h"
#endif

#ifdef MODULE_NG_IPV6
#include "net/ng_ipv6.h"
#endif

#ifdef MODULE_L2_PING
#include "l2_ping.h"
#endif
Expand Down Expand Up @@ -280,4 +284,8 @@ void auto_init(void)
DEBUG("Auto init ng_pktdump module.\n");
ng_pktdump_init();
#endif
#ifdef MODULE_NG_IPV6
DEBUG("Auto init ng_ipv6 module.\n");
ng_ipv6_init();
#endif
}
56 changes: 56 additions & 0 deletions sys/include/net/ng_ipv6.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
* @defgroup net_ng_ipv6 IPv6
* @ingroup net
* @brief New IPv6 implementation
*
* The IPv6 control thread understands messages of type
*
* * @ref NG_NETAPI_MSG_TYPE_RCV, and
* * @ref NG_NETAPI_MSG_TYPE_SND,
*
* @{
*
* @file
Expand All @@ -22,14 +28,64 @@
#ifndef NG_IPV6_H_
#define NG_IPV6_H_

#include "kernel_types.h"
#include "net/ng_netbase.h"
#include "thread.h"

#include "net/ng_ipv6/addr.h"
#include "net/ng_ipv6/hdr.h"
#include "net/ng_ipv6/nc.h"
#include "net/ng_ipv6/netif.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @brief Default stack size to use for the IPv6 thread
*/
#ifndef NG_IPV6_STACK_SIZE
#define NG_IPV6_STACK_SIZE (KERNEL_CONF_STACKSIZE_DEFAULT)
#endif

/**
* @brief Default name for the IPv6 thread
*/
#ifndef NG_IPV6_PRIO
#define NG_IPV6_PRIO (PRIORITY_MAIN - 3)
#endif

/**
* @brief Default message queue size to use for the IPv6 thread.
*/
#ifndef NG_IPV6_MSG_QUEUE_SIZE
#define NG_IPV6_MSG_QUEUE_SIZE (8U)
#endif

/**
* @brief Initialization of the IPv6 thread.
*
* @return The PID to the IPv6 thread, on success.
* @return a negative errno on error.
* @return -EOVERFLOW, if there are too many threads running already
* @return -EEXIST, if IPv6 was already initialized.
*/
kernel_pid_t ng_ipv6_init(void);

/**
* @brief Demultiplexes a packet according to @p nh.
*
* @internal
*
* **Do not use outside this module or its submodules!!!**
* Public access needed for Extension Headers.
*
* @param[in] iface The receiving interface.
* @param[in] pkt A packet.
* @param[in] nh A protocol number (see @ref net_ng_protnum).
*/
void ng_ipv6_demux(kernel_pid_t iface, ng_pktsnip_t *pkt, uint8_t nh);

#ifdef __cplusplus
}
#endif
Expand Down
1 change: 1 addition & 0 deletions sys/net/network_layer/ng_ipv6/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include $(RIOTBASE)/Makefile.base
Loading

0 comments on commit 8e4edf2

Please sign in to comment.