diff --git a/net/icmp/icmp.h b/net/icmp/icmp.h index b1379f8eab..7c6a36862a 100644 --- a/net/icmp/icmp.h +++ b/net/icmp/icmp.h @@ -34,6 +34,7 @@ #include #include +#include #include #if defined(CONFIG_NET_ICMP) && !defined(CONFIG_NET_ICMP_NO_STACK) @@ -47,9 +48,9 @@ /* Allocate/free an ICMP data callback */ #define icmp_callback_alloc(dev, conn) \ - devif_callback_alloc((dev), &(conn)->list, &(conn)->list_tail) + devif_callback_alloc((dev), &(conn)->sconn.list, &(conn)->sconn.list_tail) #define icmp_callback_free(dev, conn, cb) \ - devif_conn_callback_free((dev), (cb), &(conn)->list, &(conn)->list_tail) + devif_conn_callback_free((dev), (cb), &(conn)->sconn.list, &(conn)->sconn.list_tail) /**************************************************************************** * Public types @@ -77,14 +78,7 @@ struct icmp_conn_s { /* Common prologue of all connection structures. */ - dq_entry_t node; /* Supports a doubly linked list */ - - /* This is a list of ICMP callbacks. Each callback represents a thread - * that is stalled, waiting for a device-specific event. - */ - - FAR struct devif_callback_s *list; - FAR struct devif_callback_s *list_tail; + struct socket_conn_s sconn; /* ICMP-specific content follows */ diff --git a/net/icmp/icmp_conn.c b/net/icmp/icmp_conn.c index 079b322055..9fcc7b328d 100644 --- a/net/icmp/icmp_conn.c +++ b/net/icmp/icmp_conn.c @@ -91,7 +91,8 @@ void icmp_sock_initialize(void) { /* Move the connection structure to the free list */ - dq_addlast(&g_icmp_connections[i].node, &g_free_icmp_connections); + dq_addlast(&g_icmp_connections[i].sconn.node, + &g_free_icmp_connections); } #endif } @@ -124,7 +125,8 @@ FAR struct icmp_conn_s *icmp_alloc(void) { for (ret = 0; ret < CONFIG_NET_ICMP_NCONNS; ret++) { - dq_addlast(&conn[ret].node, &g_free_icmp_connections); + dq_addlast(&conn[ret].sconn.node, + &g_free_icmp_connections); } } } @@ -135,7 +137,7 @@ FAR struct icmp_conn_s *icmp_alloc(void) { /* Enqueue the connection into the active list */ - dq_addlast(&conn->node, &g_active_icmp_connections); + dq_addlast(&conn->sconn.node, &g_active_icmp_connections); } nxsem_post(&g_free_sem); @@ -177,7 +179,7 @@ void icmp_free(FAR struct icmp_conn_s *conn) { /* Remove the connection from the active list */ - dq_rem(&conn->node, &g_active_icmp_connections); + dq_rem(&conn->sconn.node, &g_active_icmp_connections); /* Clear the connection structure */ @@ -185,7 +187,7 @@ void icmp_free(FAR struct icmp_conn_s *conn) /* Free the connection */ - dq_addlast(&conn->node, &g_free_icmp_connections); + dq_addlast(&conn->sconn.node, &g_free_icmp_connections); } nxsem_post(&g_free_sem); @@ -221,7 +223,7 @@ FAR struct icmp_conn_s *icmp_active(uint16_t id) /* Look at the next active connection */ - conn = (FAR struct icmp_conn_s *)conn->node.flink; + conn = (FAR struct icmp_conn_s *)conn->sconn.node.flink; } return conn; @@ -246,7 +248,7 @@ FAR struct icmp_conn_s *icmp_nextconn(FAR struct icmp_conn_s *conn) } else { - return (FAR struct icmp_conn_s *)conn->node.flink; + return (FAR struct icmp_conn_s *)conn->sconn.node.flink; } } diff --git a/net/icmp/icmp_input.c b/net/icmp/icmp_input.c index 525ee2c145..6f19156284 100644 --- a/net/icmp/icmp_input.c +++ b/net/icmp/icmp_input.c @@ -332,7 +332,7 @@ void icmp_input(FAR struct net_driver_s *dev) goto drop; } - flags = devif_conn_event(dev, conn, ICMP_NEWDATA, conn->list); + flags = devif_conn_event(dev, conn, ICMP_NEWDATA, conn->sconn.list); if ((flags & ICMP_NEWDATA) != 0) { uint16_t nbuffered; diff --git a/net/icmp/icmp_poll.c b/net/icmp/icmp_poll.c index bd0f761341..b99b317f35 100644 --- a/net/icmp/icmp_poll.c +++ b/net/icmp/icmp_poll.c @@ -72,7 +72,7 @@ void icmp_poll(FAR struct net_driver_s *dev, FAR struct icmp_conn_s *conn) /* Perform the application callback */ - devif_conn_event(dev, conn, ICMP_POLL, conn->list); + devif_conn_event(dev, conn, ICMP_POLL, conn->sconn.list); } #endif /* CONFIG_NET && CONFIG_NET_ICMP && CONFIG_NET_ICMP_SOCKET */