Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ng_ipv6: initial import #2454

Merged
merged 1 commit into from
Apr 22, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this number based on a certain assumption or just an educated guess?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's basically my go-to number for message queue size. But https://lists.riot-os.org/pipermail/devel/2015-April/002458.html seems to indicate it is a good one in this context.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, thanks for explanation.

#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