2007-09-17 00:12:04 +02:00
|
|
|
/****************************************************************************
|
2014-06-27 18:00:28 +02:00
|
|
|
* net/netdev/netdev.h
|
2007-09-17 00:12:04 +02:00
|
|
|
*
|
2021-02-19 12:45:37 +01:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2007-09-17 00:12:04 +02:00
|
|
|
*
|
2021-02-19 12:45:37 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2007-09-17 00:12:04 +02:00
|
|
|
*
|
2021-02-19 12:45:37 +01:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2007-09-17 00:12:04 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-06-27 18:00:28 +02:00
|
|
|
#ifndef __NET_NETDEV_NETDEV_H
|
|
|
|
#define __NET_NETDEV_NETDEV_H
|
|
|
|
|
2007-09-17 00:12:04 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
2014-06-27 18:00:28 +02:00
|
|
|
#include <sys/types.h>
|
2015-05-29 19:01:03 +02:00
|
|
|
#include <stdbool.h>
|
2007-09-17 00:12:04 +02:00
|
|
|
|
2014-07-05 03:13:08 +02:00
|
|
|
#include <nuttx/net/ip.h>
|
|
|
|
|
2018-09-09 23:01:44 +02:00
|
|
|
#ifdef CONFIG_NETDOWN_NOTIFIER
|
|
|
|
# include <nuttx/wqueue.h>
|
|
|
|
#endif
|
|
|
|
|
2007-09-17 00:12:04 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Data
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-06-27 18:00:28 +02:00
|
|
|
#undef EXTERN
|
|
|
|
#if defined(__cplusplus)
|
|
|
|
#define EXTERN extern "C"
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#else
|
|
|
|
#define EXTERN extern
|
|
|
|
#endif
|
2007-09-17 00:12:04 +02:00
|
|
|
|
2015-05-31 16:34:03 +02:00
|
|
|
/* List of registered Ethernet device drivers. You must have the network
|
|
|
|
* locked in order to access this list.
|
|
|
|
*
|
|
|
|
* NOTE that this duplicates a declaration in net/tcp/tcp.h
|
2015-05-30 17:12:27 +02:00
|
|
|
*/
|
|
|
|
|
2014-06-28 00:48:12 +02:00
|
|
|
EXTERN struct net_driver_s *g_netdevices;
|
2007-09-17 00:12:04 +02:00
|
|
|
|
2018-06-25 20:08:10 +02:00
|
|
|
#ifdef CONFIG_NETDEV_IFINDEX
|
|
|
|
/* The set of network devices that have been registered. This is used to
|
|
|
|
* assign a unique device index to the newly registered device.
|
|
|
|
*
|
|
|
|
* REVISIT: The width of g_nassigned limits the number of registered
|
|
|
|
* devices to 32 (MAX_IFINDEX).
|
|
|
|
*/
|
|
|
|
|
|
|
|
EXTERN uint32_t g_devset;
|
2018-06-25 20:57:42 +02:00
|
|
|
|
|
|
|
/* The set of network devices that have been freed. The purpose of this
|
|
|
|
* set is to postpone reuse of a interface index for as long as possible,
|
|
|
|
* i.e., don't reuse an interface index until all of the possible indices
|
|
|
|
* have been used.
|
|
|
|
*/
|
|
|
|
|
|
|
|
EXTERN uint32_t g_devfreed;
|
2018-06-25 20:08:10 +02:00
|
|
|
#endif
|
|
|
|
|
2017-07-01 16:39:39 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Types
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/* Callback from netdev_foreach() */
|
|
|
|
|
|
|
|
struct net_driver_s; /* Forward reference */
|
2021-02-19 15:01:46 +01:00
|
|
|
typedef int (*netdev_callback_t)(FAR struct net_driver_s *dev,
|
|
|
|
FAR void *arg);
|
2017-07-01 16:39:39 +02:00
|
|
|
|
2007-09-17 00:12:04 +02:00
|
|
|
/****************************************************************************
|
2014-06-27 18:00:28 +02:00
|
|
|
* Public Function Prototypes
|
2007-09-17 00:12:04 +02:00
|
|
|
****************************************************************************/
|
|
|
|
|
2015-05-29 19:01:03 +02:00
|
|
|
/****************************************************************************
|
2017-04-22 00:33:14 +02:00
|
|
|
* Name: netdev_verify
|
2015-05-29 19:01:03 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Verify that the specified device still exists
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* The caller has locked the network.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
bool netdev_verify(FAR struct net_driver_s *dev);
|
|
|
|
|
2015-05-27 22:34:15 +02:00
|
|
|
/****************************************************************************
|
2017-04-22 00:33:14 +02:00
|
|
|
* Name: netdev_findbyname
|
2015-05-27 22:34:15 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Find a previously registered network device using its assigned
|
|
|
|
* network interface name
|
|
|
|
*
|
2018-03-13 16:52:27 +01:00
|
|
|
* Input Parameters:
|
2015-05-27 22:34:15 +02:00
|
|
|
* ifname The interface name of the device of interest
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Pointer to driver on success; null on failure
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2014-06-27 18:00:28 +02:00
|
|
|
|
2014-06-28 00:48:12 +02:00
|
|
|
FAR struct net_driver_s *netdev_findbyname(FAR const char *ifname);
|
2014-06-27 18:00:28 +02:00
|
|
|
|
2017-07-01 16:39:39 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: netdev_foreach
|
|
|
|
*
|
|
|
|
* Description:
|
2019-08-24 21:06:43 +02:00
|
|
|
* Enumerate each registered network device. This function will terminate
|
|
|
|
* when either (1) all devices have been enumerated or (2) when a callback
|
|
|
|
* returns any non-zero value.
|
2017-07-01 16:39:39 +02:00
|
|
|
*
|
2019-08-24 21:06:43 +02:00
|
|
|
* NOTE 1: The network must be locked throughout the enumeration.
|
|
|
|
* NOTE 2: No checks are made on devices. For examples, callbacks will
|
|
|
|
* will be made on network devices that are in the 'down' state.
|
|
|
|
* The callback implementations must take into account all
|
|
|
|
* network device state. Typically, a network in the down state
|
|
|
|
* would not terminate the traversal.
|
2017-07-01 16:39:39 +02:00
|
|
|
*
|
2018-03-13 16:52:27 +01:00
|
|
|
* Input Parameters:
|
2017-07-01 16:39:39 +02:00
|
|
|
* callback - Will be called for each registered device
|
2019-08-24 21:06:43 +02:00
|
|
|
* arg - Opaque user argument passed to callback()
|
2017-07-01 16:39:39 +02:00
|
|
|
*
|
|
|
|
* Returned Value:
|
2019-08-24 21:06:43 +02:00
|
|
|
* 0: Enumeration completed
|
|
|
|
* 1: Enumeration terminated early by callback
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* The network is locked.
|
2017-07-01 16:39:39 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
int netdev_foreach(netdev_callback_t callback, FAR void *arg);
|
|
|
|
|
2018-10-29 13:50:47 +01:00
|
|
|
/****************************************************************************
|
2018-10-29 19:20:44 +01:00
|
|
|
* Name: netdev_findby_lipv4addr
|
2018-10-29 13:50:47 +01:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Find a previously registered network device by matching a local address
|
|
|
|
* with the subnet served by the device. Only "up" devices are considered
|
|
|
|
* (since a "down" device has no meaningful address).
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
2018-10-29 23:25:57 +01:00
|
|
|
* lipaddr - Local, IPv4 address assigned to the network device. Or any
|
|
|
|
* IPv4 address on the sub-net served by the network device.
|
2018-10-29 13:50:47 +01:00
|
|
|
*
|
|
|
|
* Returned Value:
|
2018-10-29 23:25:57 +01:00
|
|
|
* Pointer to driver on success; null on failure
|
2018-10-29 13:50:47 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_IPv4
|
2018-10-29 19:20:44 +01:00
|
|
|
FAR struct net_driver_s *netdev_findby_lipv4addr(in_addr_t lipaddr);
|
2018-10-29 13:50:47 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
2018-10-29 19:20:44 +01:00
|
|
|
* Name: netdev_findby_lipv6addr
|
2018-10-29 13:50:47 +01:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Find a previously registered network device by matching a local address
|
|
|
|
* with the subnet served by the device. Only "up" devices are considered
|
|
|
|
* (since a "down" device has no meaningful address).
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
2018-10-29 23:25:57 +01:00
|
|
|
* lipaddr - Local, IPv6 address assigned to the network device. Or any
|
|
|
|
* IPv6 address on the sub-net served by the network device.
|
2018-10-29 13:50:47 +01:00
|
|
|
*
|
|
|
|
* Returned Value:
|
2018-10-29 23:25:57 +01:00
|
|
|
* Pointer to driver on success; null on failure
|
2018-10-29 13:50:47 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_IPv6
|
2021-02-19 15:01:46 +01:00
|
|
|
FAR struct net_driver_s *netdev_findby_lipv6addr(
|
|
|
|
const net_ipv6addr_t lipaddr);
|
2018-10-29 13:50:47 +01:00
|
|
|
#endif
|
|
|
|
|
2015-05-27 22:34:15 +02:00
|
|
|
/****************************************************************************
|
2018-10-29 19:20:44 +01:00
|
|
|
* Name: netdev_findby_ripv4addr
|
2015-05-27 22:34:15 +02:00
|
|
|
*
|
|
|
|
* Description:
|
2018-10-29 13:50:47 +01:00
|
|
|
* Find a previously registered network device by matching the remote
|
|
|
|
* IPv4 address that can be reached by the device.
|
2015-05-27 22:34:15 +02:00
|
|
|
*
|
2018-03-13 16:52:27 +01:00
|
|
|
* Input Parameters:
|
2018-10-29 23:25:57 +01:00
|
|
|
* lipaddr - Local, bound address of a connection (used only if ripaddr is
|
|
|
|
* the broadcast address).
|
2015-05-27 22:34:15 +02:00
|
|
|
* ripaddr - Remote address of a connection to use in the lookup
|
|
|
|
*
|
|
|
|
* Returned Value:
|
2018-10-29 23:25:57 +01:00
|
|
|
* Pointer to driver on success; null on failure
|
2015-05-27 22:34:15 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
2014-06-27 18:00:28 +02:00
|
|
|
|
2015-01-16 15:51:18 +01:00
|
|
|
#ifdef CONFIG_NET_IPv4
|
2018-10-29 19:20:44 +01:00
|
|
|
FAR struct net_driver_s *netdev_findby_ripv4addr(in_addr_t lipaddr,
|
|
|
|
in_addr_t ripaddr);
|
2015-01-16 15:51:18 +01:00
|
|
|
#endif
|
|
|
|
|
2015-05-27 22:34:15 +02:00
|
|
|
/****************************************************************************
|
2018-10-29 19:20:44 +01:00
|
|
|
* Name: netdev_findby_ripv6addr
|
2015-05-27 22:34:15 +02:00
|
|
|
*
|
|
|
|
* Description:
|
2018-10-29 13:50:47 +01:00
|
|
|
* Find a previously registered network device by matching the remote
|
|
|
|
* IPv6 address that can be reached by the device.
|
2015-05-27 22:34:15 +02:00
|
|
|
*
|
2018-03-13 16:52:27 +01:00
|
|
|
* Input Parameters:
|
2018-10-29 23:25:57 +01:00
|
|
|
* lipaddr - Local, bound address of a connection (used only if ripaddr is
|
|
|
|
* a multicast address).
|
2015-05-27 22:34:15 +02:00
|
|
|
* ripaddr - Remote address of a connection to use in the lookup
|
|
|
|
*
|
|
|
|
* Returned Value:
|
2018-10-29 23:25:57 +01:00
|
|
|
* Pointer to driver on success; null on failure
|
2015-05-27 22:34:15 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2015-01-16 15:51:18 +01:00
|
|
|
#ifdef CONFIG_NET_IPv6
|
2021-02-19 15:01:46 +01:00
|
|
|
FAR struct net_driver_s *netdev_findby_ripv6addr(
|
|
|
|
const net_ipv6addr_t lipaddr,
|
|
|
|
const net_ipv6addr_t ripaddr);
|
2014-06-27 18:00:28 +02:00
|
|
|
#endif
|
|
|
|
|
2015-11-27 23:39:14 +01:00
|
|
|
/****************************************************************************
|
2017-04-22 00:33:14 +02:00
|
|
|
* Name: netdev_findbyindex
|
2015-11-27 23:39:14 +01:00
|
|
|
*
|
|
|
|
* Description:
|
2018-06-25 20:08:10 +02:00
|
|
|
* Find a previously registered network device by assigned interface index.
|
2015-11-27 23:39:14 +01:00
|
|
|
*
|
2018-03-13 16:52:27 +01:00
|
|
|
* Input Parameters:
|
2018-06-26 00:55:45 +02:00
|
|
|
* ifindex - The interface index. This is a one-based index and must be
|
|
|
|
* greater than zero.
|
2015-11-27 23:39:14 +01:00
|
|
|
*
|
|
|
|
* Returned Value:
|
2018-06-25 20:08:10 +02:00
|
|
|
* Pointer to driver on success; NULL on failure. This function will return
|
|
|
|
* NULL only if there is no device corresponding to the provided index.
|
2015-11-27 23:39:14 +01:00
|
|
|
*
|
2018-06-25 20:08:10 +02:00
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
FAR struct net_driver_s *netdev_findbyindex(int ifindex);
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: netdev_nextindex
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Return the interface index to the next valid device.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* ifindex - The first interface index to check. Usually in a traversal
|
2018-06-26 00:55:45 +02:00
|
|
|
* this would be the previous interface index plus 1.
|
2018-06-25 20:08:10 +02:00
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* The interface index for the next network driver. -ENODEV is returned if
|
|
|
|
* there are no further devices with assigned interface indices.
|
2015-11-27 23:39:14 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2018-06-25 20:08:10 +02:00
|
|
|
#ifdef CONFIG_NETDEV_IFINDEX
|
|
|
|
int netdev_nextindex(int ifindex);
|
|
|
|
#endif
|
|
|
|
|
2015-05-27 22:34:15 +02:00
|
|
|
/****************************************************************************
|
2017-04-22 00:33:14 +02:00
|
|
|
* Name: netdev_default
|
2015-05-27 22:34:15 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Return the default network device. REVISIT: At present this function
|
|
|
|
* arbitrarily returns the first UP device at the head of the device
|
|
|
|
* list. Perhaps the default device should be a device name
|
|
|
|
* configuration option?
|
|
|
|
*
|
|
|
|
* So why is this here: It represents my current though for what to do
|
|
|
|
* if a socket is connected with INADDY_ANY. In this case, I suppose we
|
|
|
|
* should use the IP address associated with some default device???
|
|
|
|
*
|
2018-03-13 16:52:27 +01:00
|
|
|
* Input Parameters:
|
2015-05-27 22:34:15 +02:00
|
|
|
* NULL
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Pointer to default network driver on success; null on failure
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2014-11-21 21:14:39 +01:00
|
|
|
|
|
|
|
FAR struct net_driver_s *netdev_default(void);
|
|
|
|
|
2015-05-27 22:34:15 +02:00
|
|
|
/****************************************************************************
|
2017-04-22 00:33:14 +02:00
|
|
|
* Name: netdev_ipv4_txnotify
|
2015-05-27 22:34:15 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Notify the device driver that forwards the IPv4 address that new TX
|
|
|
|
* data is available.
|
|
|
|
*
|
2018-03-13 16:52:27 +01:00
|
|
|
* Input Parameters:
|
2015-05-27 22:34:15 +02:00
|
|
|
* lipaddr - The local address bound to the socket
|
|
|
|
* ripaddr - The remote address to send the data
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2014-06-27 18:00:28 +02:00
|
|
|
|
2015-01-16 19:30:18 +01:00
|
|
|
#ifdef CONFIG_NET_IPv4
|
|
|
|
void netdev_ipv4_txnotify(in_addr_t lipaddr, in_addr_t ripaddr);
|
|
|
|
#endif /* CONFIG_NET_IPv4 */
|
|
|
|
|
2015-05-27 22:34:15 +02:00
|
|
|
/****************************************************************************
|
2017-04-22 00:33:14 +02:00
|
|
|
* Name: netdev_ipv6_txnotify
|
2015-05-27 22:34:15 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Notify the device driver that forwards the IPv4 address that new TX
|
|
|
|
* data is available.
|
|
|
|
*
|
2018-03-13 16:52:27 +01:00
|
|
|
* Input Parameters:
|
2015-05-27 22:34:15 +02:00
|
|
|
* lipaddr - The local address bound to the socket
|
|
|
|
* ripaddr - The remote address to send the data
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2015-01-16 19:30:18 +01:00
|
|
|
#ifdef CONFIG_NET_IPv6
|
|
|
|
void netdev_ipv6_txnotify(FAR const net_ipv6addr_t lipaddr,
|
|
|
|
FAR const net_ipv6addr_t ripaddr);
|
|
|
|
#endif /* CONFIG_NET_IPv6 */
|
2014-06-27 18:00:28 +02:00
|
|
|
|
2015-05-27 22:34:15 +02:00
|
|
|
/****************************************************************************
|
2017-04-22 00:33:14 +02:00
|
|
|
* Name: netdev_txnotify_dev
|
2015-05-27 22:34:15 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Notify the device driver that new TX data is available. This variant
|
|
|
|
* would be called when the upper level logic already understands how the
|
|
|
|
* packet will be routed.
|
|
|
|
*
|
2018-03-13 16:52:27 +01:00
|
|
|
* Input Parameters:
|
2015-05-27 22:34:15 +02:00
|
|
|
* dev - The network device driver state structure.
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2015-05-27 19:39:44 +02:00
|
|
|
void netdev_txnotify_dev(FAR struct net_driver_s *dev);
|
|
|
|
|
2015-05-27 22:34:15 +02:00
|
|
|
/****************************************************************************
|
2017-04-22 00:33:14 +02:00
|
|
|
* Name: netdev_count
|
2015-05-27 22:34:15 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Return the number of network devices
|
|
|
|
*
|
2018-03-13 16:52:27 +01:00
|
|
|
* Input Parameters:
|
2015-05-27 22:34:15 +02:00
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* The number of network devices
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2014-06-27 18:00:28 +02:00
|
|
|
|
|
|
|
int netdev_count(void);
|
2007-09-17 00:12:04 +02:00
|
|
|
|
2017-09-19 22:17:05 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: netdev_ipv4_ifconf
|
|
|
|
*
|
|
|
|
* Description:
|
2018-10-29 23:25:57 +01:00
|
|
|
* Return the IPv4 configuration of each network adapter
|
2017-09-19 22:17:05 +02:00
|
|
|
*
|
2018-03-13 16:52:27 +01:00
|
|
|
* Input Parameters:
|
2017-09-19 22:17:05 +02:00
|
|
|
* ifc - A reference to the instance of struct ifconf in which to return
|
|
|
|
* the information.
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Zero is returned on success; a negated errno value is returned on any
|
|
|
|
* failure.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
2020-02-23 09:50:23 +01:00
|
|
|
* The network is locked
|
2017-09-19 22:17:05 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_IPv4
|
|
|
|
struct ifconf; /* Forward reference */
|
|
|
|
int netdev_ipv4_ifconf(FAR struct ifconf *ifc);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: netdev_ipv6_ifconf
|
|
|
|
*
|
|
|
|
* Description:
|
2018-10-29 23:25:57 +01:00
|
|
|
* Return the IPv6 configuration of each network adapter
|
2017-09-19 22:17:05 +02:00
|
|
|
*
|
2018-03-13 16:52:27 +01:00
|
|
|
* Input Parameters:
|
2017-09-19 22:17:05 +02:00
|
|
|
* lifc - A reference to the instance of struct lifconf in which to return
|
|
|
|
* the information.
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Zero is returned on success; a negated errno value is returned on any
|
|
|
|
* failure.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
2020-02-23 09:50:23 +01:00
|
|
|
* The network is locked
|
2017-09-19 22:17:05 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_IPv6
|
|
|
|
struct lifconf; /* Forward reference */
|
|
|
|
int netdev_ipv6_ifconf(FAR struct lifconf *lifc);
|
|
|
|
#endif
|
|
|
|
|
2018-09-09 18:39:25 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: netdown_notifier_setup
|
|
|
|
*
|
|
|
|
* Description:
|
2019-11-28 21:20:40 +01:00
|
|
|
* Set up to perform a callback to the worker function when the network
|
|
|
|
* goes down. The worker function will execute on the high priority
|
|
|
|
* worker thread.
|
2018-09-09 18:39:25 +02:00
|
|
|
*
|
|
|
|
* Input Parameters:
|
2018-09-09 23:01:44 +02:00
|
|
|
* worker - The worker function to execute on the high priority work
|
|
|
|
* queue when data is available in the UDP readahead buffer.
|
2018-09-09 18:39:25 +02:00
|
|
|
* dev - The network driver to be monitored
|
2018-09-09 23:01:44 +02:00
|
|
|
* arg - A user-defined argument that will be available to the worker
|
|
|
|
* function when it runs.
|
2018-09-09 18:39:25 +02:00
|
|
|
* Returned Value:
|
|
|
|
* > 0 - The signal notification is in place. The returned value is a
|
|
|
|
* key that may be used later in a call to
|
|
|
|
* netdown_notifier_teardown().
|
|
|
|
* == 0 - The the device is already down. No signal notification will
|
|
|
|
* be provided.
|
|
|
|
* < 0 - An unexpected error occurred and no signal will be sent. The
|
|
|
|
* returned value is a negated errno value that indicates the
|
|
|
|
* nature of the failure.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_NETDOWN_NOTIFIER
|
2018-09-09 23:01:44 +02:00
|
|
|
int netdown_notifier_setup(worker_t worker, FAR struct net_driver_s *dev,
|
|
|
|
FAR void *arg);
|
2018-09-09 18:39:25 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: netdown_notifier_teardown
|
|
|
|
*
|
|
|
|
* Description:
|
2018-09-09 23:01:44 +02:00
|
|
|
* Eliminate a network down notification previously setup by
|
2018-09-09 18:39:25 +02:00
|
|
|
* netdown_notifier_setup(). This function should only be called if the
|
|
|
|
* notification should be aborted prior to the notification. The
|
|
|
|
* notification will automatically be torn down after the signal is sent.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* key - The key value returned from a previous call to
|
|
|
|
* netdown_notifier_setup().
|
|
|
|
*
|
|
|
|
* Returned Value:
|
2022-05-13 12:26:42 +02:00
|
|
|
* None.
|
2018-09-09 18:39:25 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_NETDOWN_NOTIFIER
|
2022-05-13 12:26:42 +02:00
|
|
|
void netdown_notifier_teardown(int key);
|
2018-09-09 18:39:25 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: netdown_notifier_signal
|
|
|
|
*
|
|
|
|
* Description:
|
2018-09-09 23:01:44 +02:00
|
|
|
* A network has gone down has been buffered. Execute worker thread
|
|
|
|
* functions for all threads monitoring the state of the device.
|
2018-09-09 18:39:25 +02:00
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* dev - The TCP connection where read-ahead data was just buffered.
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* None.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_NETDOWN_NOTIFIER
|
|
|
|
void netdown_notifier_signal(FAR struct net_driver_s *dev);
|
|
|
|
#endif
|
|
|
|
|
2014-06-27 18:00:28 +02:00
|
|
|
#undef EXTERN
|
|
|
|
#ifdef __cplusplus
|
2007-09-17 00:12:04 +02:00
|
|
|
}
|
2014-06-27 18:00:28 +02:00
|
|
|
#endif
|
2007-09-17 00:12:04 +02:00
|
|
|
|
2014-06-27 18:00:28 +02:00
|
|
|
#endif /* __NET_NETDEV_NETDEV_H */
|