all: fix for new netreg_entry_t structure
This commit is contained in:
parent
97adff5eac
commit
0016463687
@ -94,7 +94,7 @@ static void start_server(char *port_str)
|
|||||||
uint16_t port;
|
uint16_t port;
|
||||||
|
|
||||||
/* check if server is already running */
|
/* 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",
|
printf("Error: server already running on port %" PRIu32 "\n",
|
||||||
server.demux_ctx);
|
server.demux_ctx);
|
||||||
return;
|
return;
|
||||||
@ -106,7 +106,7 @@ static void start_server(char *port_str)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* start server (which means registering pktdump for the chosen port) */
|
/* 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;
|
server.demux_ctx = (uint32_t)port;
|
||||||
gnrc_netreg_register(GNRC_NETTYPE_UDP, &server);
|
gnrc_netreg_register(GNRC_NETTYPE_UDP, &server);
|
||||||
printf("Success: started UDP server on port %" PRIu16 "\n", port);
|
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)
|
static void stop_server(void)
|
||||||
{
|
{
|
||||||
/* check if server is running at all */
|
/* 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");
|
printf("Error: server was not running\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* stop server */
|
/* stop server */
|
||||||
gnrc_netreg_unregister(GNRC_NETTYPE_UDP, &server);
|
gnrc_netreg_unregister(GNRC_NETTYPE_UDP, &server);
|
||||||
server.pid = KERNEL_PID_UNDEF;
|
server.target.pid = KERNEL_PID_UNDEF;
|
||||||
puts("Success: stopped UDP server");
|
puts("Success: stopped UDP server");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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)
|
void conn_ip_close(conn_ip_t *conn)
|
||||||
{
|
{
|
||||||
assert(conn->l4_type == GNRC_NETTYPE_UNDEF);
|
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);
|
gnrc_netreg_unregister(conn->l3_type, &conn->netreg_entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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)
|
void conn_udp_close(conn_udp_t *conn)
|
||||||
{
|
{
|
||||||
assert(conn->l4_type == GNRC_NETTYPE_UDP);
|
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);
|
gnrc_netreg_unregister(GNRC_NETTYPE_UDP, &conn->netreg_entry);
|
||||||
conn->netreg_entry.pid = KERNEL_PID_UNDEF;
|
conn->netreg_entry.target.pid = KERNEL_PID_UNDEF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -68,7 +68,7 @@ kernel_pid_t gnrc_rpl_init(kernel_pid_t if_pid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
_me_reg.demux_ctx = ICMPV6_RPL_CTRL;
|
_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 */
|
/* register interest in all ICMPv6 packets */
|
||||||
gnrc_netreg_register(GNRC_NETTYPE_ICMPV6, &_me_reg);
|
gnrc_netreg_register(GNRC_NETTYPE_ICMPV6, &_me_reg);
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,7 @@ int main(void)
|
|||||||
puts("SLIP test");
|
puts("SLIP test");
|
||||||
|
|
||||||
/* register pktdump */
|
/* register pktdump */
|
||||||
if (dump.pid <= KERNEL_PID_UNDEF) {
|
if (dump.target.pid <= KERNEL_PID_UNDEF) {
|
||||||
puts("Error starting pktdump thread");
|
puts("Error starting pktdump thread");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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_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_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_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)));
|
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]);
|
gnrc_netreg_unregister(GNRC_NETTYPE_TEST, &entries[0]);
|
||||||
TEST_ASSERT_NOT_NULL((res = gnrc_netreg_lookup(GNRC_NETTYPE_TEST, TEST_UINT16)));
|
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_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]);
|
gnrc_netreg_unregister(GNRC_NETTYPE_TEST, &entries[1]);
|
||||||
TEST_ASSERT_NULL(gnrc_netreg_lookup(GNRC_NETTYPE_TEST, TEST_UINT16));
|
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]);
|
gnrc_netreg_unregister(GNRC_NETTYPE_TEST, &entries[1]);
|
||||||
TEST_ASSERT_NOT_NULL((res = gnrc_netreg_lookup(GNRC_NETTYPE_TEST, TEST_UINT16)));
|
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_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]);
|
gnrc_netreg_unregister(GNRC_NETTYPE_TEST, &entries[0]);
|
||||||
TEST_ASSERT_NULL(gnrc_netreg_lookup(GNRC_NETTYPE_TEST, TEST_UINT16));
|
TEST_ASSERT_NULL(gnrc_netreg_lookup(GNRC_NETTYPE_TEST, TEST_UINT16));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user