mirror of
https://github.com/apache/nuttx.git
synced 2026-05-22 22:20:01 +08:00
Networking: Hook in ICMPv6 polling operations into periodic network logic
This commit is contained in:
+46
-9
@@ -51,6 +51,7 @@
|
||||
#include "udp/udp.h"
|
||||
#include "pkt/pkt.h"
|
||||
#include "icmp/icmp.h"
|
||||
#include "icmpv6/icmpv6.h"
|
||||
#include "igmp/igmp.h"
|
||||
|
||||
/****************************************************************************
|
||||
@@ -101,11 +102,7 @@ static int devif_poll_pkt_connections(FAR struct net_driver_s *dev,
|
||||
* Function: devif_poll_icmp
|
||||
*
|
||||
* Description:
|
||||
* Poll all UDP connections for available packets to send.
|
||||
*
|
||||
* Assumptions:
|
||||
* This function is called from the MAC device driver and may be called from
|
||||
* the timer interrupt/watchdog handle level.
|
||||
* Poll all of the connections waiting to send an ICMP ECHO request
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -113,7 +110,7 @@ static int devif_poll_pkt_connections(FAR struct net_driver_s *dev,
|
||||
static inline int devif_poll_icmp(FAR struct net_driver_s *dev,
|
||||
devif_poll_callback_t callback)
|
||||
{
|
||||
/* Perform the UDP TX poll */
|
||||
/* Perform the ICMP poll */
|
||||
|
||||
icmp_poll(dev);
|
||||
|
||||
@@ -123,6 +120,28 @@ static inline int devif_poll_icmp(FAR struct net_driver_s *dev,
|
||||
}
|
||||
#endif /* CONFIG_NET_ICMP && CONFIG_NET_ICMP_PING */
|
||||
|
||||
/****************************************************************************
|
||||
* Function: devif_poll_icmpv6
|
||||
*
|
||||
* Description:
|
||||
* Poll all of the connections waiting to send an ICMPv6 ECHO request
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_NET_ICMPv6) && defined(CONFIG_NET_ICMPv6_PING)
|
||||
static inline int devif_poll_icmpv6(FAR struct net_driver_s *dev,
|
||||
devif_poll_callback_t callback)
|
||||
{
|
||||
/* Perform the ICMPv6 poll */
|
||||
|
||||
icmpv6_poll(dev);
|
||||
|
||||
/* Call back into the driver */
|
||||
|
||||
return callback(dev);
|
||||
}
|
||||
#endif /* CONFIG_NET_ICMPv6 && CONFIG_NET_ICMPv6_PING */
|
||||
|
||||
/****************************************************************************
|
||||
* Function: devif_poll_igmp
|
||||
*
|
||||
@@ -271,7 +290,7 @@ static inline int devif_poll_tcp_timer(FAR struct net_driver_s *dev,
|
||||
*
|
||||
* Description:
|
||||
* This function will traverse each active uIP connection structure and
|
||||
* will perform TCP and UDP polling operations. devif_poll() may be called
|
||||
* will perform network polling operations. devif_poll() may be called
|
||||
* asynchronously with the network driver can accept another outgoing
|
||||
* packet.
|
||||
*
|
||||
@@ -352,6 +371,15 @@ int devif_poll(FAR struct net_driver_s *dev, devif_poll_callback_t callback)
|
||||
bstop = devif_poll_icmp(dev, callback);
|
||||
}
|
||||
|
||||
if (!bstop)
|
||||
#endif
|
||||
#if defined(CONFIG_NET_ICMPv6) && defined(CONFIG_NET_ICMPv6_PING)
|
||||
{
|
||||
/* Traverse all of the tasks waiting to send an ICMPv6 ECHO request. */
|
||||
|
||||
bstop = devif_poll_icmpv6(dev, callback);
|
||||
}
|
||||
|
||||
if (!bstop)
|
||||
#endif
|
||||
{
|
||||
@@ -366,8 +394,8 @@ int devif_poll(FAR struct net_driver_s *dev, devif_poll_callback_t callback)
|
||||
*
|
||||
* Description:
|
||||
* These function will traverse each active uIP connection structure and
|
||||
* perform TCP timer operations (and UDP polling operations). The Ethernet
|
||||
* driver MUST implement logic to periodically call devif_timer().
|
||||
* perform network timer operations. The Ethernet driver MUST implement
|
||||
* logic to periodically call devif_timer().
|
||||
*
|
||||
* This function will call the provided callback function for every active
|
||||
* connection. Polling will continue until all connections have been polled
|
||||
@@ -457,6 +485,15 @@ int devif_timer(FAR struct net_driver_s *dev, devif_poll_callback_t callback,
|
||||
bstop = devif_poll_icmp(dev, callback);
|
||||
}
|
||||
|
||||
if (!bstop)
|
||||
#endif
|
||||
#if defined(CONFIG_NET_ICMP6) && defined(CONFIG_NET_ICMPv6_PING)
|
||||
{
|
||||
/* Traverse all of the tasks waiting to send an ICMP ECHO request. */
|
||||
|
||||
bstop = devif_poll_icmp6(dev, callback);
|
||||
}
|
||||
|
||||
if (!bstop)
|
||||
#endif
|
||||
{
|
||||
|
||||
@@ -297,7 +297,7 @@ end_wait:
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: imcp_ping
|
||||
* Name: imcpv6_ping
|
||||
*
|
||||
* Description:
|
||||
* Send a ECHO request and wait for the ECHO response
|
||||
|
||||
Reference in New Issue
Block a user