mirror of
https://github.com/apache/nuttx.git
synced 2026-05-29 04:19:37 +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 "udp/udp.h"
|
||||||
#include "pkt/pkt.h"
|
#include "pkt/pkt.h"
|
||||||
#include "icmp/icmp.h"
|
#include "icmp/icmp.h"
|
||||||
|
#include "icmpv6/icmpv6.h"
|
||||||
#include "igmp/igmp.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
|
* Function: devif_poll_icmp
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Poll all UDP connections for available packets to send.
|
* Poll all of the connections waiting to send an ICMP ECHO request
|
||||||
*
|
|
||||||
* Assumptions:
|
|
||||||
* This function is called from the MAC device driver and may be called from
|
|
||||||
* the timer interrupt/watchdog handle level.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@@ -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,
|
static inline int devif_poll_icmp(FAR struct net_driver_s *dev,
|
||||||
devif_poll_callback_t callback)
|
devif_poll_callback_t callback)
|
||||||
{
|
{
|
||||||
/* Perform the UDP TX poll */
|
/* Perform the ICMP poll */
|
||||||
|
|
||||||
icmp_poll(dev);
|
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 */
|
#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
|
* Function: devif_poll_igmp
|
||||||
*
|
*
|
||||||
@@ -271,7 +290,7 @@ static inline int devif_poll_tcp_timer(FAR struct net_driver_s *dev,
|
|||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function will traverse each active uIP connection structure and
|
* 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
|
* asynchronously with the network driver can accept another outgoing
|
||||||
* packet.
|
* 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);
|
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)
|
if (!bstop)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@@ -366,8 +394,8 @@ int devif_poll(FAR struct net_driver_s *dev, devif_poll_callback_t callback)
|
|||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* These function will traverse each active uIP connection structure and
|
* These function will traverse each active uIP connection structure and
|
||||||
* perform TCP timer operations (and UDP polling operations). The Ethernet
|
* perform network timer operations. The Ethernet driver MUST implement
|
||||||
* driver MUST implement logic to periodically call devif_timer().
|
* logic to periodically call devif_timer().
|
||||||
*
|
*
|
||||||
* This function will call the provided callback function for every active
|
* This function will call the provided callback function for every active
|
||||||
* connection. Polling will continue until all connections have been polled
|
* 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);
|
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)
|
if (!bstop)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -297,7 +297,7 @@ end_wait:
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: imcp_ping
|
* Name: imcpv6_ping
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Send a ECHO request and wait for the ECHO response
|
* Send a ECHO request and wait for the ECHO response
|
||||||
|
|||||||
Reference in New Issue
Block a user