diff --git a/net/netdev/netdev.h b/net/netdev/netdev.h index cedfc6b14a2..5377c2d2d87 100644 --- a/net/netdev/netdev.h +++ b/net/netdev/netdev.h @@ -77,26 +77,94 @@ EXTERN struct net_driver_s *g_netdevices; * Public Function Prototypes ****************************************************************************/ -/* netdev_register.c *********************************************************/ +/**************************************************************************** + * Function: netdev_seminit + * + * Description: + * Initialize the network device semaphore. + * + ****************************************************************************/ #if CONFIG_NSOCKET_DESCRIPTORS > 0 void netdev_seminit(void); +#endif + +/**************************************************************************** + * Function: netdev_semtake + * + * Description: + * Get exclusive access to the network device list. + * + ****************************************************************************/ + +#if CONFIG_NSOCKET_DESCRIPTORS > 0 void netdev_semtake(void); +#endif + +/**************************************************************************** + * Function: netdev_semgive + * + * Description: + * Release exclusive access to the network device list + * + ****************************************************************************/ + +#if CONFIG_NSOCKET_DESCRIPTORS > 0 void netdev_semgive(void); #endif -/* netdev_ioctl.c ************************************************************/ +/**************************************************************************** + * Name: netdev_ifup / netdev_ifdown + * + * Description: + * Bring the interface up/down + * + ****************************************************************************/ void netdev_ifup(FAR struct net_driver_s *dev); void netdev_ifdown(FAR struct net_driver_s *dev); -/* netdev_findbyname.c *******************************************************/ +/**************************************************************************** + * Function: netdev_findbyname + * + * Description: + * Find a previously registered network device using its assigned + * network interface name + * + * Parameters: + * ifname The interface name of the device of interest + * + * Returned Value: + * Pointer to driver on success; null on failure + * + * Assumptions: + * Called from normal user mode + * + ****************************************************************************/ #if CONFIG_NSOCKET_DESCRIPTORS > 0 FAR struct net_driver_s *netdev_findbyname(FAR const char *ifname); #endif -/* netdev_findbyaddr.c *******************************************************/ +/**************************************************************************** + * Function: netdev_findby_ipv4addr + * + * Description: + * Find a previously registered network device by matching an arbitrary + * IPv4 address. + * + * Parameters: + * lipaddr - Local, bound address of a connection. Used only if ripaddr + * is the broadcast address. Used only if CONFIG_NETDEV_MULTINIC. + * ripaddr - Remote address of a connection to use in the lookup + * + * Returned Value: + * Pointer to driver on success; null on failure + * + * Assumptions: + * Called from normal user mode + * + ****************************************************************************/ #if CONFIG_NSOCKET_DESCRIPTORS > 0 #ifdef CONFIG_NET_IPv4 @@ -108,6 +176,26 @@ FAR struct net_driver_s *netdev_findby_ipv4addr(in_addr_t ripaddr); #endif #endif +/**************************************************************************** + * Function: netdev_findby_ipv6addr + * + * Description: + * Find a previously registered network device by matching an arbitrary + * IPv6 address. + * + * Parameters: + * lipaddr - Local, bound address of a connection. Used only if ripaddr + * is the broadcast address. Used only if CONFIG_NETDEV_MULTINIC. + * ripaddr - Remote address of a connection to use in the lookup + * + * Returned Value: + * Pointer to driver on success; null on failure + * + * Assumptions: + * Called from normal user mode + * + ****************************************************************************/ + #ifdef CONFIG_NET_IPv6 #ifdef CONFIG_NETDEV_MULTINIC FAR struct net_driver_s *netdev_findby_ipv6addr(const net_ipv6addr_t lipaddr, @@ -118,13 +206,52 @@ FAR struct net_driver_s *netdev_findby_ipv6addr(const net_ipv6addr_t ripaddr); #endif #endif -/* netdev_default.c ***********************************************************/ +/**************************************************************************** + * Function: netdev_default + * + * 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??? + * + * Parameters: + * NULL + * + * Returned Value: + * Pointer to default network driver on success; null on failure + * + * Assumptions: + * Called from normal user mode + * + ****************************************************************************/ #if CONFIG_NSOCKET_DESCRIPTORS > 0 FAR struct net_driver_s *netdev_default(void); #endif -/* netdev_txnotify.c *********************************************************/ +/**************************************************************************** + * Function: netdev_ipv4_txnotify + * + * Description: + * Notify the device driver that forwards the IPv4 address that new TX + * data is available. + * + * Parameters: + * lipaddr - The local address bound to the socket + * ripaddr - The remote address to send the data + * + * Returned Value: + * None + * + * Assumptions: + * Called from normal user mode + * + ****************************************************************************/ #if CONFIG_NSOCKET_DESCRIPTORS > 0 #ifdef CONFIG_NET_IPv4 @@ -135,6 +262,25 @@ void netdev_ipv4_txnotify(in_addr_t ripaddr); # endif #endif /* CONFIG_NET_IPv4 */ +/**************************************************************************** + * Function: netdev_ipv6_txnotify + * + * Description: + * Notify the device driver that forwards the IPv4 address that new TX + * data is available. + * + * Parameters: + * lipaddr - The local address bound to the socket + * ripaddr - The remote address to send the data + * + * Returned Value: + * None + * + * Assumptions: + * Called from normal user mode + * + ****************************************************************************/ + #ifdef CONFIG_NET_IPv6 # ifdef CONFIG_NETDEV_MULTINIC void netdev_ipv6_txnotify(FAR const net_ipv6addr_t lipaddr, @@ -145,9 +291,45 @@ void netdev_ipv6_txnotify(FAR const net_ipv6addr_t ripaddr); #endif /* CONFIG_NET_IPv6 */ #endif /* CONFIG_NSOCKET_DESCRIPTORS > 0 */ +/**************************************************************************** + * Function: netdev_txnotify_dev + * + * 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. + * + * Parameters: + * dev - The network device driver state structure. + * + * Returned Value: + * None + * + * Assumptions: + * Called from normal user mode + * + ****************************************************************************/ + void netdev_txnotify_dev(FAR struct net_driver_s *dev); -/* netdev_rxnotify.c *********************************************************/ +/**************************************************************************** + * Function: netdev_ipv4_rxnotify + * + * Description: + * Notify the device driver that forwards the IPv4 address that the + * application waits for RX data. + * + * Parameters: + * lipaddr - The local board IPv6 address of the socket + * ripaddr - The remote IPv4 address to send the data + * + * Returned Value: + * None + * + * Assumptions: + * Called from normal user mode + * + ****************************************************************************/ #if CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET_RXAVAIL) @@ -159,6 +341,25 @@ void netdev_ipv4_rxnotify(in_addr_t ripaddr); # endif #endif /* CONFIG_NET_IPv4 */ +/**************************************************************************** + * Function: netdev_ipv6_rxnotify + * + * Description: + * Notify the device driver that forwards the IPv6 address that the + * application waits for RX data. + * + * Parameters: + * lipaddr - The local board IPv6 address of the socket + * ripaddr - The remote IPv6 address to send the data + * + * Returned Value: + * None + * + * Assumptions: + * Called from normal user mode + * + ****************************************************************************/ + #ifdef CONFIG_NET_IPv6 # ifdef CONFIG_NETDEV_MULTINIC void netdev_ipv6_rxnotify(FAR const net_ipv6addr_t lipaddr, @@ -186,7 +387,22 @@ void netdev_ipv6_rxnotify(FAR const net_ipv6addr_t ripaddr); #endif /* CONFIG_NET_IPv6 */ #endif -/* netdev_count.c ************************************************************/ +/**************************************************************************** + * Function: netdev_count + * + * Description: + * Return the number of network devices + * + * Parameters: + * None + * + * Returned Value: + * The number of network devices + * + * Assumptions: + * Called from normal user mode + * + ****************************************************************************/ #if CONFIG_NSOCKET_DESCRIPTORS > 0 int netdev_count(void);