From 0016463687b704bfb2dd71dbea69b414a46182d7 Mon Sep 17 00:00:00 2001
From: Martine Lenders <mail@martine-lenders.eu>
Date: Thu, 11 Aug 2016 15:13:50 +0200
Subject: [PATCH] all: fix for new netreg_entry_t structure

---
 examples/gnrc_networking/udp.c              | 8 ++++----
 sys/net/gnrc/conn/ip/gnrc_conn_ip.c         | 2 +-
 sys/net/gnrc/conn/udp/gnrc_conn_udp.c       | 4 ++--
 sys/net/gnrc/routing/rpl/gnrc_rpl.c         | 2 +-
 tests/slip/main.c                           | 2 +-
 tests/unittests/tests-netreg/tests-netreg.c | 6 +++---
 6 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/examples/gnrc_networking/udp.c b/examples/gnrc_networking/udp.c
index a422934e48..f7619a8fc3 100644
--- a/examples/gnrc_networking/udp.c
+++ b/examples/gnrc_networking/udp.c
@@ -94,7 +94,7 @@ static void start_server(char *port_str)
     uint16_t port;
 
     /* check if server is already running */
-    if (server.pid != KERNEL_PID_UNDEF) {
+    if (server.target.pid != KERNEL_PID_UNDEF) {
         printf("Error: server already running on port %" PRIu32 "\n",
                server.demux_ctx);
         return;
@@ -106,7 +106,7 @@ static void start_server(char *port_str)
         return;
     }
     /* start server (which means registering pktdump for the chosen port) */
-    server.pid = gnrc_pktdump_pid;
+    server.target.pid = gnrc_pktdump_pid;
     server.demux_ctx = (uint32_t)port;
     gnrc_netreg_register(GNRC_NETTYPE_UDP, &server);
     printf("Success: started UDP server on port %" PRIu16 "\n", port);
@@ -115,13 +115,13 @@ static void start_server(char *port_str)
 static void stop_server(void)
 {
     /* check if server is running at all */
-    if (server.pid == KERNEL_PID_UNDEF) {
+    if (server.target.pid == KERNEL_PID_UNDEF) {
         printf("Error: server was not running\n");
         return;
     }
     /* stop server */
     gnrc_netreg_unregister(GNRC_NETTYPE_UDP, &server);
-    server.pid = KERNEL_PID_UNDEF;
+    server.target.pid = KERNEL_PID_UNDEF;
     puts("Success: stopped UDP server");
 }
 
diff --git a/sys/net/gnrc/conn/ip/gnrc_conn_ip.c b/sys/net/gnrc/conn/ip/gnrc_conn_ip.c
index b2311b7b2e..d616f3b013 100644
--- a/sys/net/gnrc/conn/ip/gnrc_conn_ip.c
+++ b/sys/net/gnrc/conn/ip/gnrc_conn_ip.c
@@ -52,7 +52,7 @@ int conn_ip_create(conn_ip_t *conn, const void *addr, size_t addr_len, int famil
 void conn_ip_close(conn_ip_t *conn)
 {
     assert(conn->l4_type == GNRC_NETTYPE_UNDEF);
-    if (conn->netreg_entry.pid != KERNEL_PID_UNDEF) {
+    if (conn->netreg_entry.target.pid != KERNEL_PID_UNDEF) {
         gnrc_netreg_unregister(conn->l3_type, &conn->netreg_entry);
     }
 }
diff --git a/sys/net/gnrc/conn/udp/gnrc_conn_udp.c b/sys/net/gnrc/conn/udp/gnrc_conn_udp.c
index fc18a950ce..89ee02443b 100644
--- a/sys/net/gnrc/conn/udp/gnrc_conn_udp.c
+++ b/sys/net/gnrc/conn/udp/gnrc_conn_udp.c
@@ -56,9 +56,9 @@ int conn_udp_create(conn_udp_t *conn, const void *addr, size_t addr_len,
 void conn_udp_close(conn_udp_t *conn)
 {
     assert(conn->l4_type == GNRC_NETTYPE_UDP);
-    if (conn->netreg_entry.pid != KERNEL_PID_UNDEF) {
+    if (conn->netreg_entry.target.pid != KERNEL_PID_UNDEF) {
         gnrc_netreg_unregister(GNRC_NETTYPE_UDP, &conn->netreg_entry);
-        conn->netreg_entry.pid = KERNEL_PID_UNDEF;
+        conn->netreg_entry.target.pid = KERNEL_PID_UNDEF;
     }
 }
 
diff --git a/sys/net/gnrc/routing/rpl/gnrc_rpl.c b/sys/net/gnrc/routing/rpl/gnrc_rpl.c
index df4e5ab89a..29fffd03b5 100644
--- a/sys/net/gnrc/routing/rpl/gnrc_rpl.c
+++ b/sys/net/gnrc/routing/rpl/gnrc_rpl.c
@@ -68,7 +68,7 @@ kernel_pid_t gnrc_rpl_init(kernel_pid_t if_pid)
         }
 
         _me_reg.demux_ctx = ICMPV6_RPL_CTRL;
-        _me_reg.pid = gnrc_rpl_pid;
+        _me_reg.target.pid = gnrc_rpl_pid;
         /* register interest in all ICMPv6 packets */
         gnrc_netreg_register(GNRC_NETTYPE_ICMPV6, &_me_reg);
 
diff --git a/tests/slip/main.c b/tests/slip/main.c
index 6d7299ef99..89fbaf88c0 100644
--- a/tests/slip/main.c
+++ b/tests/slip/main.c
@@ -36,7 +36,7 @@ int main(void)
     puts("SLIP test");
 
     /* register pktdump */
-    if (dump.pid <= KERNEL_PID_UNDEF) {
+    if (dump.target.pid <= KERNEL_PID_UNDEF) {
         puts("Error starting pktdump thread");
         return -1;
     }
diff --git a/tests/unittests/tests-netreg/tests-netreg.c b/tests/unittests/tests-netreg/tests-netreg.c
index d6b2d8a9a4..b56a68861f 100644
--- a/tests/unittests/tests-netreg/tests-netreg.c
+++ b/tests/unittests/tests-netreg/tests-netreg.c
@@ -45,7 +45,7 @@ static void test_netreg_register__success(void)
     TEST_ASSERT_EQUAL_INT(0, gnrc_netreg_register(GNRC_NETTYPE_TEST, &entries[0]));
     TEST_ASSERT_NOT_NULL((res = gnrc_netreg_lookup(GNRC_NETTYPE_TEST, TEST_UINT16)));
     TEST_ASSERT_EQUAL_INT(TEST_UINT16, res->demux_ctx);
-    TEST_ASSERT_EQUAL_INT(TEST_UINT8, res->pid);
+    TEST_ASSERT_EQUAL_INT(TEST_UINT8, res->target.pid);
     TEST_ASSERT_NULL((gnrc_netreg_getnext(res)));
 }
 
@@ -66,7 +66,7 @@ void test_netreg_unregister__success2(void)
     gnrc_netreg_unregister(GNRC_NETTYPE_TEST, &entries[0]);
     TEST_ASSERT_NOT_NULL((res = gnrc_netreg_lookup(GNRC_NETTYPE_TEST, TEST_UINT16)));
     TEST_ASSERT_EQUAL_INT(TEST_UINT16, res->demux_ctx);
-    TEST_ASSERT_EQUAL_INT(TEST_UINT8 + 1, res->pid);
+    TEST_ASSERT_EQUAL_INT(TEST_UINT8 + 1, res->target.pid);
     gnrc_netreg_unregister(GNRC_NETTYPE_TEST, &entries[1]);
     TEST_ASSERT_NULL(gnrc_netreg_lookup(GNRC_NETTYPE_TEST, TEST_UINT16));
 }
@@ -80,7 +80,7 @@ void test_netreg_unregister__success3(void)
     gnrc_netreg_unregister(GNRC_NETTYPE_TEST, &entries[1]);
     TEST_ASSERT_NOT_NULL((res = gnrc_netreg_lookup(GNRC_NETTYPE_TEST, TEST_UINT16)));
     TEST_ASSERT_EQUAL_INT(TEST_UINT16, res->demux_ctx);
-    TEST_ASSERT_EQUAL_INT(TEST_UINT8, res->pid);
+    TEST_ASSERT_EQUAL_INT(TEST_UINT8, res->target.pid);
     gnrc_netreg_unregister(GNRC_NETTYPE_TEST, &entries[0]);
     TEST_ASSERT_NULL(gnrc_netreg_lookup(GNRC_NETTYPE_TEST, TEST_UINT16));
 }
-- 
GitLab