mirror of
https://github.com/apache/nuttx.git
synced 2026-05-20 12:33:27 +08:00
netlib: Supplement the netlib_check_ifconnectivity documentation
Build Documentation / build-html (push) Has been cancelled
Build Documentation / build-html (push) Has been cancelled
A brief introduction to the interface functions, parameters, and return values. Signed-off-by: zhangshuai39 <zhangshuai39@xiaomi.com>
This commit is contained in:
@@ -343,6 +343,7 @@ Network Connectivity
|
||||
=====================
|
||||
|
||||
- :c:func:`netlib_check_ipconnectivity`
|
||||
- :c:func:`netlib_check_ifconnectivity`
|
||||
|
||||
.. c:function:: int netlib_check_ipconnectivity(FAR const char *ip, int timeout, int retry)
|
||||
|
||||
@@ -365,6 +366,28 @@ Network Connectivity
|
||||
function is blocking and will wait for all ping attempts to complete before
|
||||
returning.
|
||||
|
||||
.. c:function:: int netlib_check_ifconnectivity(FAR const char *ifname, int timeout, int retry)
|
||||
|
||||
Check network interface connectivity by pinging the gateway. This function
|
||||
retrieves the default gateway address for the specified network interface and
|
||||
then sends ICMP echo requests to the gateway to verify connectivity.
|
||||
|
||||
:param ifname: Network interface name (e.g., ``"eth0"``, ``"wlan0"``).
|
||||
:param timeout: Maximum timeout for each ping attempt in milliseconds.
|
||||
:param retry: Number of ping attempts to send.
|
||||
|
||||
:return: Number of gateway ping replies received (0 or positive) on success.
|
||||
A value of 0 indicates that no replies were received (gateway unreachable
|
||||
or timeout). A negative value indicates an error occurred (e.g., if the
|
||||
gateway address cannot be retrieved for the interface, or if the gateway
|
||||
address is invalid).
|
||||
|
||||
**Note:** This function requires ``CONFIG_NETUTILS_PING`` to be enabled. The
|
||||
function is blocking and will wait for all ping attempts to complete before
|
||||
returning. The function internally calls :c:func:`netlib_get_dripv4addr` to
|
||||
retrieve the gateway address and then uses :c:func:`netlib_check_ipconnectivity`
|
||||
to perform the actual ping test.
|
||||
|
||||
ARP Table Support
|
||||
==================
|
||||
|
||||
|
||||
Reference in New Issue
Block a user