gnrc: use new netreg helper functions everywhere
This commit is contained in:
parent
262d0d7573
commit
dc45cd2610
@ -53,10 +53,8 @@ int main(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MODULE_NETIF
|
#ifdef MODULE_NETIF
|
||||||
gnrc_netreg_entry_t dump;
|
gnrc_netreg_entry_t dump = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL,
|
||||||
|
gnrc_pktdump_pid);
|
||||||
dump.pid = gnrc_pktdump_pid;
|
|
||||||
dump.demux_ctx = GNRC_NETREG_DEMUX_CTX_ALL;
|
|
||||||
gnrc_netreg_register(GNRC_NETTYPE_UNDEF, &dump);
|
gnrc_netreg_register(GNRC_NETTYPE_UNDEF, &dump);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,8 @@
|
|||||||
#include "timex.h"
|
#include "timex.h"
|
||||||
#include "xtimer.h"
|
#include "xtimer.h"
|
||||||
|
|
||||||
static gnrc_netreg_entry_t server = { NULL, GNRC_NETREG_DEMUX_CTX_ALL, KERNEL_PID_UNDEF };
|
static gnrc_netreg_entry_t server = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL,
|
||||||
|
KERNEL_PID_UNDEF);
|
||||||
|
|
||||||
|
|
||||||
static void send(char *addr_str, char *port_str, char *data, unsigned int num,
|
static void send(char *addr_str, char *port_str, char *data, unsigned int num,
|
||||||
|
|||||||
@ -0,0 +1,27 @@
|
|||||||
|
From 3f675f891794b3655c06b721c7f34c462233e7a5 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Martine Lenders <mail@martine-lenders.eu>
|
||||||
|
Date: Fri, 26 Aug 2016 11:48:26 +0200
|
||||||
|
Subject: [PATCH] RIOT adapter: port to new netreg struct
|
||||||
|
|
||||||
|
---
|
||||||
|
src/ccn-lite-riot.c | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/ccn-lite-riot.c b/src/ccn-lite-riot.c
|
||||||
|
index b5e7660..ba0a2cc 100644
|
||||||
|
--- a/src/ccn-lite-riot.c
|
||||||
|
+++ b/src/ccn-lite-riot.c
|
||||||
|
@@ -229,8 +229,8 @@ ccnl_open_netif(kernel_pid_t if_pid, gnrc_nettype_t netreg_type)
|
||||||
|
/* configure the interface to use the specified nettype protocol */
|
||||||
|
gnrc_netapi_set(if_pid, NETOPT_PROTO, 0, &netreg_type, sizeof(gnrc_nettype_t));
|
||||||
|
/* register for this nettype */
|
||||||
|
- _ccnl_ne.demux_ctx = GNRC_NETREG_DEMUX_CTX_ALL;
|
||||||
|
- _ccnl_ne.pid = _ccnl_event_loop_pid;
|
||||||
|
+ gnrc_netreg_entry_init_pid(&_ccnl_ne, GNRC_NETREG_DEMUX_CTX_ALL,
|
||||||
|
+ _ccnl_event_loop_pid);
|
||||||
|
return gnrc_netreg_register(netreg_type, &_ccnl_ne);
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.7.4
|
||||||
|
|
||||||
@ -66,10 +66,9 @@
|
|||||||
* static msg_t _msg_q[Q_SZ];
|
* static msg_t _msg_q[Q_SZ];
|
||||||
* (void)arg;
|
* (void)arg;
|
||||||
* msg_init_queue(_msg_q, Q_SZ);
|
* msg_init_queue(_msg_q, Q_SZ);
|
||||||
* gnrc_netreg_entry me_reg = {
|
* gnrc_netreg_entry me_reg = GNRC_NETREG_ENTRY_INIT_PID(
|
||||||
* .demux_ctx = GNRC_NETREG_DEMUX_CTX_ALL,
|
* GNRC_NETREG_DEMUX_CTX_ALL,
|
||||||
* .pid = thread_getpid()
|
* sched_active_pid);
|
||||||
* };
|
|
||||||
* gnrc_netreg_register(GNRC_NETTYPE_IPV6, &me_reg);
|
* gnrc_netreg_register(GNRC_NETTYPE_IPV6, &me_reg);
|
||||||
* while (1) {
|
* while (1) {
|
||||||
* msg_receive(&msg);
|
* msg_receive(&msg);
|
||||||
|
|||||||
@ -83,8 +83,7 @@ struct conn_udp {
|
|||||||
static inline void gnrc_conn_reg(gnrc_netreg_entry_t *entry, gnrc_nettype_t type,
|
static inline void gnrc_conn_reg(gnrc_netreg_entry_t *entry, gnrc_nettype_t type,
|
||||||
uint32_t demux_ctx)
|
uint32_t demux_ctx)
|
||||||
{
|
{
|
||||||
entry->pid = sched_active_pid;
|
gnrc_netreg_entry_init_pid(entry, demux_ctx, sched_active_pid);
|
||||||
entry->demux_ctx = demux_ctx;
|
|
||||||
gnrc_netreg_register(type, entry);
|
gnrc_netreg_register(type, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -77,7 +77,7 @@ typedef struct gnrc_netreg_entry {
|
|||||||
void gnrc_netreg_init(void);
|
void gnrc_netreg_init(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initializes a netreg entry statically with PID
|
* @brief Initializes a netreg entry dynamically with PID
|
||||||
*
|
*
|
||||||
* @param[out] entry A netreg entry
|
* @param[out] entry A netreg entry
|
||||||
* @param[in] demux_ctx The @ref gnrc_netreg_entry_t::demux_ctx "demux context"
|
* @param[in] demux_ctx The @ref gnrc_netreg_entry_t::demux_ctx "demux context"
|
||||||
|
|||||||
@ -454,8 +454,8 @@ int _tftp_server(tftp_context_t *ctxt)
|
|||||||
{
|
{
|
||||||
msg_t msg;
|
msg_t msg;
|
||||||
bool active = true;
|
bool active = true;
|
||||||
gnrc_netreg_entry_t entry = { NULL, GNRC_TFTP_DEFAULT_DST_PORT,
|
gnrc_netreg_entry_t entry = GNRC_NETREG_ENTRY_INIT_PID(GNRC_TFTP_DEFAULT_DST_PORT,
|
||||||
thread_getpid() };
|
sched_active_pid);
|
||||||
|
|
||||||
while (active) {
|
while (active) {
|
||||||
int ret = TS_BUSY;
|
int ret = TS_BUSY;
|
||||||
@ -520,7 +520,8 @@ int _tftp_do_client_transfer(tftp_context_t *ctxt)
|
|||||||
tftp_state ret = TS_BUSY;
|
tftp_state ret = TS_BUSY;
|
||||||
|
|
||||||
/* register our DNS response listener */
|
/* register our DNS response listener */
|
||||||
gnrc_netreg_entry_t entry = { NULL, ctxt->src_port, thread_getpid() };
|
gnrc_netreg_entry_t entry = GNRC_NETREG_ENTRY_INIT_PID(ctxt->src_port,
|
||||||
|
sched_active_pid);
|
||||||
|
|
||||||
if (gnrc_netreg_register(GNRC_NETTYPE_UDP, &entry)) {
|
if (gnrc_netreg_register(GNRC_NETTYPE_UDP, &entry)) {
|
||||||
DEBUG("tftp: error starting server.");
|
DEBUG("tftp: error starting server.");
|
||||||
@ -636,9 +637,8 @@ tftp_state _tftp_state_processes(tftp_context_t *ctxt, msg_t *m)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* register a listener for the UDP port */
|
/* register a listener for the UDP port */
|
||||||
ctxt->entry.next = NULL;
|
gnrc_netreg_entry_init_pid(&(ctxt->entry), ctxt->src_port,
|
||||||
ctxt->entry.demux_ctx = ctxt->src_port;
|
sched_active_pid);
|
||||||
ctxt->entry.pid = thread_getpid();
|
|
||||||
gnrc_netreg_register(GNRC_NETTYPE_UDP, &(ctxt->entry));
|
gnrc_netreg_register(GNRC_NETTYPE_UDP, &(ctxt->entry));
|
||||||
|
|
||||||
/* try to decode the options */
|
/* try to decode the options */
|
||||||
|
|||||||
@ -557,14 +557,11 @@ void *_event_loop(void *args)
|
|||||||
msg_t msg, ack, msg_q[GNRC_ZEP_MSG_QUEUE_SIZE];
|
msg_t msg, ack, msg_q[GNRC_ZEP_MSG_QUEUE_SIZE];
|
||||||
gnrc_netdev_t *dev = (gnrc_netdev_t *)args;
|
gnrc_netdev_t *dev = (gnrc_netdev_t *)args;
|
||||||
gnrc_netapi_opt_t *opt;
|
gnrc_netapi_opt_t *opt;
|
||||||
gnrc_netreg_entry_t my_reg = { NULL, ((gnrc_zep_t *)args)->src_port,
|
gnrc_netreg_entry_t my_reg = GNRC_NETREG_ENTRY_INIT_PID(((gnrc_zep_t *)args)->src_port,
|
||||||
KERNEL_PID_UNDEF
|
sched_active_pid);
|
||||||
};
|
|
||||||
|
|
||||||
msg_init_queue(msg_q, GNRC_ZEP_MSG_QUEUE_SIZE);
|
msg_init_queue(msg_q, GNRC_ZEP_MSG_QUEUE_SIZE);
|
||||||
|
|
||||||
my_reg.pid = thread_getpid();
|
|
||||||
|
|
||||||
gnrc_netreg_register(GNRC_NETTYPE_UDP, &my_reg);
|
gnrc_netreg_register(GNRC_NETTYPE_UDP, &my_reg);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|||||||
@ -111,7 +111,8 @@ gnrc_nettest_res_t gnrc_nettest_send(kernel_pid_t pid, gnrc_pktsnip_t *in,
|
|||||||
const gnrc_pktsnip_t **exp_out,
|
const gnrc_pktsnip_t **exp_out,
|
||||||
gnrc_nettype_t exp_type, uint32_t exp_demux_ctx)
|
gnrc_nettype_t exp_type, uint32_t exp_demux_ctx)
|
||||||
{
|
{
|
||||||
gnrc_netreg_entry_t reg_entry = { NULL, exp_demux_ctx, thread_getpid() };
|
gnrc_netreg_entry_t reg_entry = GNRC_NETREG_ENTRY_INIT_PID(exp_demux_ctx,
|
||||||
|
sched_active_pid);
|
||||||
gnrc_nettest_res_t res;
|
gnrc_nettest_res_t res;
|
||||||
|
|
||||||
gnrc_netreg_register(exp_type, ®_entry);
|
gnrc_netreg_register(exp_type, ®_entry);
|
||||||
@ -147,7 +148,8 @@ gnrc_nettest_res_t gnrc_nettest_receive(kernel_pid_t pid, gnrc_pktsnip_t *in,
|
|||||||
const gnrc_pktsnip_t **exp_out,
|
const gnrc_pktsnip_t **exp_out,
|
||||||
gnrc_nettype_t exp_type, uint32_t exp_demux_ctx)
|
gnrc_nettype_t exp_type, uint32_t exp_demux_ctx)
|
||||||
{
|
{
|
||||||
gnrc_netreg_entry_t reg_entry = { NULL, exp_demux_ctx, thread_getpid() };
|
gnrc_netreg_entry_t reg_entry = GNRC_NETREG_ENTRY_INIT_PID(exp_demux_ctx,
|
||||||
|
sched_active_pid);
|
||||||
gnrc_nettest_res_t res;
|
gnrc_nettest_res_t res;
|
||||||
|
|
||||||
gnrc_netreg_register(exp_type, ®_entry);
|
gnrc_netreg_register(exp_type, ®_entry);
|
||||||
|
|||||||
@ -251,14 +251,12 @@ static void _dispatch_next_header(gnrc_pktsnip_t *current, gnrc_pktsnip_t *pkt,
|
|||||||
static void *_event_loop(void *args)
|
static void *_event_loop(void *args)
|
||||||
{
|
{
|
||||||
msg_t msg, reply, msg_q[GNRC_IPV6_MSG_QUEUE_SIZE];
|
msg_t msg, reply, msg_q[GNRC_IPV6_MSG_QUEUE_SIZE];
|
||||||
gnrc_netreg_entry_t me_reg;
|
gnrc_netreg_entry_t me_reg = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL,
|
||||||
|
sched_active_pid);
|
||||||
|
|
||||||
(void)args;
|
(void)args;
|
||||||
msg_init_queue(msg_q, GNRC_IPV6_MSG_QUEUE_SIZE);
|
msg_init_queue(msg_q, GNRC_IPV6_MSG_QUEUE_SIZE);
|
||||||
|
|
||||||
me_reg.demux_ctx = GNRC_NETREG_DEMUX_CTX_ALL;
|
|
||||||
me_reg.pid = thread_getpid();
|
|
||||||
|
|
||||||
/* register interest in all IPv6 packets */
|
/* register interest in all IPv6 packets */
|
||||||
gnrc_netreg_register(GNRC_NETTYPE_IPV6, &me_reg);
|
gnrc_netreg_register(GNRC_NETTYPE_IPV6, &me_reg);
|
||||||
|
|
||||||
|
|||||||
@ -310,14 +310,12 @@ static void _send(gnrc_pktsnip_t *pkt)
|
|||||||
static void *_event_loop(void *args)
|
static void *_event_loop(void *args)
|
||||||
{
|
{
|
||||||
msg_t msg, reply, msg_q[GNRC_SIXLOWPAN_MSG_QUEUE_SIZE];
|
msg_t msg, reply, msg_q[GNRC_SIXLOWPAN_MSG_QUEUE_SIZE];
|
||||||
gnrc_netreg_entry_t me_reg;
|
gnrc_netreg_entry_t me_reg = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL,
|
||||||
|
sched_active_pid);
|
||||||
|
|
||||||
(void)args;
|
(void)args;
|
||||||
msg_init_queue(msg_q, GNRC_SIXLOWPAN_MSG_QUEUE_SIZE);
|
msg_init_queue(msg_q, GNRC_SIXLOWPAN_MSG_QUEUE_SIZE);
|
||||||
|
|
||||||
me_reg.demux_ctx = GNRC_NETREG_DEMUX_CTX_ALL;
|
|
||||||
me_reg.pid = thread_getpid();
|
|
||||||
|
|
||||||
/* register interest in all 6LoWPAN packets */
|
/* register interest in all 6LoWPAN packets */
|
||||||
gnrc_netreg_register(GNRC_NETTYPE_SIXLOWPAN, &me_reg);
|
gnrc_netreg_register(GNRC_NETTYPE_SIXLOWPAN, &me_reg);
|
||||||
|
|
||||||
|
|||||||
@ -222,16 +222,14 @@ static void *_event_loop(void *arg)
|
|||||||
(void)arg;
|
(void)arg;
|
||||||
msg_t msg, reply;
|
msg_t msg, reply;
|
||||||
msg_t msg_queue[GNRC_UDP_MSG_QUEUE_SIZE];
|
msg_t msg_queue[GNRC_UDP_MSG_QUEUE_SIZE];
|
||||||
gnrc_netreg_entry_t netreg;
|
gnrc_netreg_entry_t netreg = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL,
|
||||||
|
sched_active_pid);
|
||||||
/* preset reply message */
|
/* preset reply message */
|
||||||
reply.type = GNRC_NETAPI_MSG_TYPE_ACK;
|
reply.type = GNRC_NETAPI_MSG_TYPE_ACK;
|
||||||
reply.content.value = (uint32_t)-ENOTSUP;
|
reply.content.value = (uint32_t)-ENOTSUP;
|
||||||
/* initialize message queue */
|
/* initialize message queue */
|
||||||
msg_init_queue(msg_queue, GNRC_UDP_MSG_QUEUE_SIZE);
|
msg_init_queue(msg_queue, GNRC_UDP_MSG_QUEUE_SIZE);
|
||||||
/* register UPD at netreg */
|
/* register UPD at netreg */
|
||||||
netreg.demux_ctx = GNRC_NETREG_DEMUX_CTX_ALL;
|
|
||||||
netreg.pid = thread_getpid();
|
|
||||||
gnrc_netreg_register(GNRC_NETTYPE_UDP, &netreg);
|
gnrc_netreg_register(GNRC_NETTYPE_UDP, &netreg);
|
||||||
|
|
||||||
/* dispatch NETAPI messages */
|
/* dispatch NETAPI messages */
|
||||||
|
|||||||
@ -211,10 +211,10 @@ int _ccnl_interest(int argc, char **argv)
|
|||||||
memset(_int_buf, '\0', BUF_SIZE);
|
memset(_int_buf, '\0', BUF_SIZE);
|
||||||
memset(_cont_buf, '\0', BUF_SIZE);
|
memset(_cont_buf, '\0', BUF_SIZE);
|
||||||
for (int cnt = 0; cnt < CCNL_INTEREST_RETRIES; cnt++) {
|
for (int cnt = 0; cnt < CCNL_INTEREST_RETRIES; cnt++) {
|
||||||
gnrc_netreg_entry_t _ne;
|
gnrc_netreg_entry_t _ne =
|
||||||
|
GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL,
|
||||||
|
sched_active_pid);
|
||||||
/* register for content chunks */
|
/* register for content chunks */
|
||||||
_ne.demux_ctx = GNRC_NETREG_DEMUX_CTX_ALL;
|
|
||||||
_ne.pid = sched_active_pid;
|
|
||||||
gnrc_netreg_register(GNRC_NETTYPE_CCN_CHUNK, &_ne);
|
gnrc_netreg_register(GNRC_NETTYPE_CCN_CHUNK, &_ne);
|
||||||
|
|
||||||
struct ccnl_prefix_s *prefix = ccnl_URItoPrefix(argv[1], CCNL_SUITE_NDNTLV, NULL, 0);
|
struct ccnl_prefix_s *prefix = ccnl_URItoPrefix(argv[1], CCNL_SUITE_NDNTLV, NULL, 0);
|
||||||
|
|||||||
@ -153,7 +153,8 @@ int _icmpv6_ping(int argc, char **argv)
|
|||||||
ipv6_addr_t addr;
|
ipv6_addr_t addr;
|
||||||
kernel_pid_t src_iface;
|
kernel_pid_t src_iface;
|
||||||
msg_t msg;
|
msg_t msg;
|
||||||
gnrc_netreg_entry_t my_entry = { NULL, ICMPV6_ECHO_REP, thread_getpid() };
|
gnrc_netreg_entry_t my_entry = GNRC_NETREG_ENTRY_INIT_PID(ICMPV6_ECHO_REP,
|
||||||
|
sched_active_pid);
|
||||||
uint32_t min_rtt = UINT32_MAX, max_rtt = 0;
|
uint32_t min_rtt = UINT32_MAX, max_rtt = 0;
|
||||||
uint64_t sum_rtt = 0;
|
uint64_t sum_rtt = 0;
|
||||||
uint64_t ping_start;
|
uint64_t ping_start;
|
||||||
|
|||||||
@ -26,14 +26,13 @@
|
|||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
gnrc_netreg_entry_t dump;
|
gnrc_netreg_entry_t dump = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL,
|
||||||
|
gnrc_pktdump_pid);
|
||||||
|
|
||||||
puts("KW2XRF device driver test");
|
puts("KW2XRF device driver test");
|
||||||
|
|
||||||
/* register the pktdump thread */
|
/* register the pktdump thread */
|
||||||
puts("Register the packet dump thread for GNRC_NETTYPE_UNDEF packets");
|
puts("Register the packet dump thread for GNRC_NETTYPE_UNDEF packets");
|
||||||
dump.pid = gnrc_pktdump_pid;
|
|
||||||
dump.demux_ctx = GNRC_NETREG_DEMUX_CTX_ALL;
|
|
||||||
gnrc_netreg_register(GNRC_NETTYPE_UNDEF, &dump);
|
gnrc_netreg_register(GNRC_NETTYPE_UNDEF, &dump);
|
||||||
|
|
||||||
/* start the shell */
|
/* start the shell */
|
||||||
|
|||||||
@ -31,7 +31,8 @@ static char nomac_stack[THREAD_STACKSIZE_DEFAULT];
|
|||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
gnrc_netdev_t dev;
|
gnrc_netdev_t dev;
|
||||||
gnrc_netreg_entry_t netobj;
|
gnrc_netreg_entry_t netobj = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL,
|
||||||
|
gnrc_pktdump_pid);
|
||||||
|
|
||||||
puts("\nManual test for the minimal NRF51822 radio driver\n");
|
puts("\nManual test for the minimal NRF51822 radio driver\n");
|
||||||
puts("Use the 'ifconfig' and 'txtsnd' shell commands to verify the driver");
|
puts("Use the 'ifconfig' and 'txtsnd' shell commands to verify the driver");
|
||||||
@ -41,8 +42,6 @@ int main(void)
|
|||||||
gnrc_nomac_init(nomac_stack, sizeof(nomac_stack), 5, "nomac", &dev);
|
gnrc_nomac_init(nomac_stack, sizeof(nomac_stack), 5, "nomac", &dev);
|
||||||
|
|
||||||
/* initialize packet dumper */
|
/* initialize packet dumper */
|
||||||
netobj.pid = gnrc_pktdump_pid;
|
|
||||||
netobj.demux_ctx = GNRC_NETREG_DEMUX_CTX_ALL;
|
|
||||||
gnrc_netreg_register(GNRC_NETTYPE_UNDEF, &netobj);
|
gnrc_netreg_register(GNRC_NETTYPE_UNDEF, &netobj);
|
||||||
|
|
||||||
/* initialize and run the shell */
|
/* initialize and run the shell */
|
||||||
|
|||||||
@ -30,17 +30,16 @@
|
|||||||
*/
|
*/
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
gnrc_netreg_entry_t dump;
|
gnrc_netreg_entry_t dump = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL,
|
||||||
|
gnrc_pktdump_pid);
|
||||||
|
|
||||||
puts("Xbee S1 device driver test");
|
puts("Xbee S1 device driver test");
|
||||||
|
|
||||||
/* initialize and register pktdump */
|
/* initialize and register pktdump */
|
||||||
dump.pid = gnrc_pktdump_pid;
|
if (gnrc_pktdump_pid <= KERNEL_PID_UNDEF) {
|
||||||
if (dump.pid <= KERNEL_PID_UNDEF) {
|
|
||||||
puts("Error starting pktdump thread");
|
puts("Error starting pktdump thread");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
dump.demux_ctx = GNRC_NETREG_DEMUX_CTX_ALL;
|
|
||||||
gnrc_netreg_register(GNRC_NETTYPE_UNDEF, &dump);
|
gnrc_netreg_register(GNRC_NETTYPE_UNDEF, &dump);
|
||||||
|
|
||||||
/* start the shell */
|
/* start the shell */
|
||||||
|
|||||||
@ -123,10 +123,10 @@ static void _send_packet(void)
|
|||||||
0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00,
|
||||||
};
|
};
|
||||||
|
|
||||||
gnrc_netreg_entry_t dump_6lowpan = { NULL, GNRC_NETREG_DEMUX_CTX_ALL, gnrc_pktdump_pid };
|
gnrc_netreg_entry_t dump_6lowpan = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL, gnrc_pktdump_pid);
|
||||||
gnrc_netreg_entry_t dump_ipv6 = { NULL, GNRC_NETREG_DEMUX_CTX_ALL, gnrc_pktdump_pid };
|
gnrc_netreg_entry_t dump_ipv6 = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL, gnrc_pktdump_pid);
|
||||||
gnrc_netreg_entry_t dump_udp = { NULL, GNRC_NETREG_DEMUX_CTX_ALL, gnrc_pktdump_pid };
|
gnrc_netreg_entry_t dump_udp = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL, gnrc_pktdump_pid);
|
||||||
gnrc_netreg_entry_t dump_udp_61616 = { NULL, 61616, gnrc_pktdump_pid };
|
gnrc_netreg_entry_t dump_udp_61616 = GNRC_NETREG_ENTRY_INIT_PID(61616, gnrc_pktdump_pid);
|
||||||
|
|
||||||
gnrc_netreg_register(GNRC_NETTYPE_SIXLOWPAN, &dump_6lowpan);
|
gnrc_netreg_register(GNRC_NETTYPE_SIXLOWPAN, &dump_6lowpan);
|
||||||
gnrc_netreg_register(GNRC_NETTYPE_IPV6, &dump_ipv6);
|
gnrc_netreg_register(GNRC_NETTYPE_IPV6, &dump_ipv6);
|
||||||
|
|||||||
@ -133,8 +133,8 @@ static int test_receive(void)
|
|||||||
ethernet_hdr_t *rcv_mac = (ethernet_hdr_t *)_tmp;
|
ethernet_hdr_t *rcv_mac = (ethernet_hdr_t *)_tmp;
|
||||||
uint8_t *rcv_payload = _tmp + sizeof(ethernet_hdr_t);
|
uint8_t *rcv_payload = _tmp + sizeof(ethernet_hdr_t);
|
||||||
gnrc_pktsnip_t *pkt, *hdr;
|
gnrc_pktsnip_t *pkt, *hdr;
|
||||||
gnrc_netreg_entry_t me = { NULL, GNRC_NETREG_DEMUX_CTX_ALL,
|
gnrc_netreg_entry_t me = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL,
|
||||||
thread_getpid() };
|
sched_active_pid);
|
||||||
msg_t msg;
|
msg_t msg;
|
||||||
|
|
||||||
if (_dev.netdev.event_callback == NULL) {
|
if (_dev.netdev.event_callback == NULL) {
|
||||||
|
|||||||
@ -30,14 +30,12 @@
|
|||||||
*/
|
*/
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
gnrc_netreg_entry_t dump;
|
gnrc_netreg_entry_t dump = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL,
|
||||||
|
gnrc_pktdump_pid);
|
||||||
|
|
||||||
puts("SLIP test");
|
puts("SLIP test");
|
||||||
|
|
||||||
/* initialize and register pktdump */
|
/* register pktdump */
|
||||||
dump.pid = gnrc_pktdump_pid;
|
|
||||||
dump.demux_ctx = GNRC_NETREG_DEMUX_CTX_ALL;
|
|
||||||
|
|
||||||
if (dump.pid <= KERNEL_PID_UNDEF) {
|
if (dump.pid <= KERNEL_PID_UNDEF) {
|
||||||
puts("Error starting pktdump thread");
|
puts("Error starting pktdump thread");
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@ -22,8 +22,8 @@
|
|||||||
#include "tests-netreg.h"
|
#include "tests-netreg.h"
|
||||||
|
|
||||||
static gnrc_netreg_entry_t entries[] = {
|
static gnrc_netreg_entry_t entries[] = {
|
||||||
{ NULL, TEST_UINT16, TEST_UINT8 },
|
GNRC_NETREG_ENTRY_INIT_PID(TEST_UINT16, TEST_UINT8),
|
||||||
{ NULL, TEST_UINT16, TEST_UINT8 + 1 }
|
GNRC_NETREG_ENTRY_INIT_PID(TEST_UINT16, TEST_UINT8 + 1)
|
||||||
};
|
};
|
||||||
|
|
||||||
static void set_up(void)
|
static void set_up(void)
|
||||||
|
|||||||
@ -30,19 +30,17 @@
|
|||||||
*/
|
*/
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
gnrc_netreg_entry_t dump;
|
gnrc_netreg_entry_t dump = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL,
|
||||||
|
gnrc_pktdump_pid);
|
||||||
|
|
||||||
puts("ZEP module test");
|
puts("ZEP module test");
|
||||||
|
|
||||||
/* initialize and register pktdump */
|
/* initialize and register pktdump */
|
||||||
dump.pid = gnrc_pktdump_pid;
|
if (gnrc_pktdump_pid <= KERNEL_PID_UNDEF) {
|
||||||
|
|
||||||
if (dump.pid <= KERNEL_PID_UNDEF) {
|
|
||||||
puts("Error starting pktdump thread");
|
puts("Error starting pktdump thread");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
dump.demux_ctx = GNRC_NETREG_DEMUX_CTX_ALL;
|
|
||||||
gnrc_netreg_register(GNRC_NETTYPE_NETIF, &dump);
|
gnrc_netreg_register(GNRC_NETTYPE_NETIF, &dump);
|
||||||
|
|
||||||
/* start the shell */
|
/* start the shell */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user