2011-05-10 00:21:10 +02:00
|
|
|
/****************************************************************************
|
2014-07-03 00:04:25 +02:00
|
|
|
* apps/include/netutils/netlib.h
|
2011-05-10 00:21:10 +02:00
|
|
|
* Various non-standard APIs to support netutils. All non-standard and
|
|
|
|
* intended only for internal use.
|
|
|
|
*
|
2017-03-13 17:16:20 +01:00
|
|
|
* Copyright (C) 2007, 2009, 2011, 2015, 2017 Gregory Nutt. All rights reserved.
|
2012-07-17 05:58:11 +02:00
|
|
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
2011-05-10 00:21:10 +02:00
|
|
|
*
|
2014-07-03 01:23:25 +02:00
|
|
|
* Some of these APIs derive from uIP. uIP also has a BSD style license:
|
2011-05-10 00:21:10 +02:00
|
|
|
*
|
|
|
|
* Author: Adam Dunkels <adam@sics.se>
|
|
|
|
* Copyright (c) 2002, Adam Dunkels.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
*
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above
|
|
|
|
* copyright notice, this list of conditions and the following
|
|
|
|
* disclaimer in the documentation and/or other materials provided
|
|
|
|
* with the distribution.
|
|
|
|
* 3. The name of the author may not be used to endorse or promote
|
|
|
|
* products derived from this software without specific prior
|
|
|
|
* written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
|
|
|
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
|
|
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
|
|
|
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
|
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
|
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2014-07-03 00:04:25 +02:00
|
|
|
#ifndef __APPS_INCLUDE_NETUTILS_NETLIB_H
|
|
|
|
#define __APPS_INCLUDE_NETUTILS_NETLIB_H
|
2011-05-10 00:21:10 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
2018-08-03 18:50:24 +02:00
|
|
|
#include <sys/socket.h>
|
2011-05-10 00:21:10 +02:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
2017-09-20 18:35:56 +02:00
|
|
|
#include <stdio.h>
|
2011-05-10 00:21:10 +02:00
|
|
|
#include <pthread.h>
|
|
|
|
|
2019-11-10 00:38:02 +01:00
|
|
|
#include <net/if.h>
|
2011-05-10 00:21:10 +02:00
|
|
|
#include <netinet/in.h>
|
2014-06-24 16:53:28 +02:00
|
|
|
#include <nuttx/net/netconfig.h>
|
2011-05-10 00:21:10 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
2017-09-20 18:35:56 +02:00
|
|
|
#undef HAVE_ROUTE_PROCFS
|
|
|
|
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_NET_ROUTE) && \
|
|
|
|
defined(CONFIG_FS_PROCFS) && !defined(CONFIG_FS_PROCFS_EXCLUDE_ROUTE)
|
|
|
|
# define HAVE_ROUTE_PROCFS
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_ROUTE_PROCFS
|
|
|
|
# ifndef CONFIG_NETLIB_PROCFS_MOUNTPT
|
|
|
|
# define CONFIG_NETLIB_PROCFS_MOUNTPT "/proc"
|
|
|
|
# endif
|
|
|
|
|
|
|
|
# define IPv4_ROUTE_PATH CONFIG_NETLIB_PROCFS_MOUNTPT "/net/route/ipv4"
|
|
|
|
# define IPv6_ROUTE_PATH CONFIG_NETLIB_PROCFS_MOUNTPT "/net/route/ipv6"
|
|
|
|
#endif
|
|
|
|
|
2019-11-10 00:38:02 +01:00
|
|
|
/* Using the following definitions, the following socket() arguments should
|
2017-10-30 21:11:42 +01:00
|
|
|
* provide a valid socket in all configurations:
|
|
|
|
*
|
2017-10-30 21:16:37 +01:00
|
|
|
* ret = socket(NETLIB_SOCK_FAMILY, NETLIB_SOCK_TYPE, NETLIB_SOCK_PROTOCOL);
|
2017-10-30 21:11:42 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* The address family that we used to create the socket really does not
|
|
|
|
* matter. It should, however, be valid in the current configuration.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#if defined(CONFIG_NET_IPv4)
|
2017-10-30 21:16:37 +01:00
|
|
|
# define NETLIB_SOCK_FAMILY AF_INET
|
2017-10-30 21:11:42 +01:00
|
|
|
#elif defined(CONFIG_NET_IPv6)
|
2017-10-30 21:16:37 +01:00
|
|
|
# define NETLIB_SOCK_FAMILY AF_INET6
|
2017-10-30 21:11:42 +01:00
|
|
|
#elif defined(CONFIG_NET_LOCAL)
|
2017-10-30 21:16:37 +01:00
|
|
|
# define NETLIB_SOCK_FAMILY AF_LOCAL
|
2017-10-30 21:11:42 +01:00
|
|
|
#elif defined(CONFIG_NET_PKT)
|
2017-10-30 21:16:37 +01:00
|
|
|
# define NETLIB_SOCK_FAMILY AF_PACKET
|
2017-10-30 21:11:42 +01:00
|
|
|
#elif defined(CONFIG_NET_IEEE802154)
|
2017-10-30 21:16:37 +01:00
|
|
|
# define NETLIB_SOCK_FAMILY AF_IEEE802154
|
2017-11-03 16:57:05 +01:00
|
|
|
#elif defined(CONFIG_WIRELESS_PKTRADIO)
|
|
|
|
# define NETLIB_SOCK_FAMILY AF_PKTRADIO
|
2018-04-03 18:01:55 +02:00
|
|
|
#elif defined(CONFIG_NET_BLUETOOTH)
|
|
|
|
# define NETLIB_SOCK_FAMILY AF_BLUETOOTH
|
2017-10-30 21:11:42 +01:00
|
|
|
#elif defined(CONFIG_NET_USRSOCK)
|
2017-10-30 21:16:37 +01:00
|
|
|
# define NETLIB_SOCK_FAMILY AF_INET
|
2019-11-19 16:49:36 +01:00
|
|
|
#elif defined(CONFIG_NET_NETLINK)
|
|
|
|
# define NETLIB_SOCK_FAMILY AF_NETLINK
|
2017-11-03 16:57:05 +01:00
|
|
|
#else
|
|
|
|
# define NETLIB_SOCK_FAMILY AF_UNSPEC
|
2017-10-30 21:11:42 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Socket protocol of zero normally works */
|
|
|
|
|
|
|
|
#define NETLIB_SOCK_PROTOCOL 0
|
|
|
|
|
2011-05-10 00:21:10 +02:00
|
|
|
/* SOCK_DGRAM is the preferred socket type to use when we just want a
|
2017-10-30 21:11:42 +01:00
|
|
|
* socket for performing driver ioctls. However, we can't use SOCK_DRAM
|
2011-05-10 00:21:10 +02:00
|
|
|
* if UDP is disabled.
|
2017-10-30 21:11:42 +01:00
|
|
|
*
|
|
|
|
* Pick a socket type (and perhaps protocol) compatible with the currently
|
|
|
|
* selected address family.
|
2011-05-10 00:21:10 +02:00
|
|
|
*/
|
|
|
|
|
2017-10-30 21:16:37 +01:00
|
|
|
#if NETLIB_SOCK_FAMILY == AF_INET
|
2017-10-30 21:11:42 +01:00
|
|
|
# if defined(CONFIG_NET_UDP)
|
2017-10-30 21:16:37 +01:00
|
|
|
# define NETLIB_SOCK_TYPE SOCK_DGRAM
|
2017-10-30 21:11:42 +01:00
|
|
|
# elif defined(CONFIG_NET_TCP)
|
2017-10-30 21:16:37 +01:00
|
|
|
# define NETLIB_SOCK_TYPE SOCK_STREAM
|
2017-10-30 21:11:42 +01:00
|
|
|
# elif defined(CONFIG_NET_ICMP_SOCKET)
|
2017-10-30 21:16:37 +01:00
|
|
|
# define NETLIB_SOCK_TYPE SOCK_DGRAM
|
2017-10-30 21:11:42 +01:00
|
|
|
# undef NETLIB_SOCK_PROTOCOL
|
|
|
|
# define NETLIB_SOCK_PROTOCOL IPPROTO_ICMP
|
|
|
|
# endif
|
2017-10-30 21:16:37 +01:00
|
|
|
#elif NETLIB_SOCK_FAMILY == AF_INET6
|
2017-10-30 21:11:42 +01:00
|
|
|
# if defined(CONFIG_NET_UDP)
|
2017-10-30 21:16:37 +01:00
|
|
|
# define NETLIB_SOCK_TYPE SOCK_DGRAM
|
2017-10-30 21:11:42 +01:00
|
|
|
# elif defined(CONFIG_NET_TCP)
|
2017-10-30 21:16:37 +01:00
|
|
|
# define NETLIB_SOCK_TYPE SOCK_STREAM
|
2017-10-30 21:11:42 +01:00
|
|
|
# elif defined(CONFIG_NET_ICMPv6_SOCKET)
|
2017-10-30 21:16:37 +01:00
|
|
|
# define NETLIB_SOCK_TYPE SOCK_DGRAM
|
2017-10-30 21:11:42 +01:00
|
|
|
# undef NETLIB_SOCK_PROTOCOL
|
|
|
|
# define NETLIB_SOCK_PROTOCOL IPPROTO_ICMP6
|
|
|
|
# endif
|
2017-10-30 21:16:37 +01:00
|
|
|
#elif NETLIB_SOCK_FAMILY == AF_LOCAL
|
2017-10-30 21:11:42 +01:00
|
|
|
# if defined(CONFIG_NET_LOCAL_DGRAM)
|
2017-10-30 21:16:37 +01:00
|
|
|
# define NETLIB_SOCK_TYPE SOCK_DGRAM
|
2017-10-30 21:11:42 +01:00
|
|
|
# elif defined(CONFIG_NET_LOCAL_STREAM)
|
2017-10-30 21:16:37 +01:00
|
|
|
# define NETLIB_SOCK_TYPE SOCK_STREAM
|
2017-10-30 21:11:42 +01:00
|
|
|
# endif
|
2017-10-30 21:16:37 +01:00
|
|
|
#elif NETLIB_SOCK_FAMILY == AF_PACKET
|
|
|
|
# define NETLIB_SOCK_TYPE SOCK_RAW
|
|
|
|
#elif NETLIB_SOCK_FAMILY == AF_IEEE802154
|
|
|
|
# define NETLIB_SOCK_TYPE SOCK_DGRAM
|
2018-04-03 18:01:55 +02:00
|
|
|
#elif NETLIB_SOCK_FAMILY == AF_BLUETOOTH
|
|
|
|
# define NETLIB_SOCK_TYPE SOCK_RAW
|
2019-11-19 16:49:36 +01:00
|
|
|
#elif NETLIB_SOCK_FAMILY == AF_NETLINK
|
|
|
|
# define NETLIB_SOCK_TYPE SOCK_DGRAM
|
2011-05-10 00:21:10 +02:00
|
|
|
#endif
|
|
|
|
|
2017-09-20 18:35:56 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Types
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef HAVE_ROUTE_PROCFS
|
2019-11-10 19:36:34 +01:00
|
|
|
#ifdef CONFIG_NET_IPv4
|
2017-09-20 18:35:56 +02:00
|
|
|
/* Describes one entry from the IPv4 routing table. All addresses are in
|
|
|
|
* host byte order!
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct netlib_ipv4_route_s
|
|
|
|
{
|
|
|
|
in_addr_t prefix; /* Routing prefix */
|
|
|
|
in_addr_t netmask; /* Routing netmask */
|
|
|
|
in_addr_t router; /* Router IPv4 address */
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2019-11-10 19:36:34 +01:00
|
|
|
#ifdef CONFIG_NET_IPv6
|
2017-09-20 18:35:56 +02:00
|
|
|
/* Describes one entry from the IPv6 routing table. All addresses are in
|
|
|
|
* host byte order!
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct netlib_ipv6_route_s
|
|
|
|
{
|
|
|
|
uint16_t prefix[8]; /* Routing prefix */
|
|
|
|
uint16_t netmask[8]; /* Routing netmask */
|
|
|
|
uint16_t router[8]; /* Router IPv6 address */
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
#endif /* HAVE_ROUTE_PROCFS */
|
|
|
|
|
2019-11-10 00:38:02 +01:00
|
|
|
#ifdef CONFIG_NETLINK_ROUTE
|
|
|
|
/* Describes one device returned by netlib_get_devices() */
|
|
|
|
|
|
|
|
struct netlib_device_s
|
|
|
|
{
|
|
|
|
#ifdef CONFIG_NETDEV_IFINDEX
|
|
|
|
uint8_t ifindex; /* Interface index */
|
|
|
|
#endif
|
|
|
|
char ifname[IFNAMSIZ]; /* Interface name */
|
|
|
|
};
|
2019-11-10 19:36:34 +01:00
|
|
|
#endif /* CONFIG_NETLINK_ROUTE*/
|
2019-11-10 00:38:02 +01:00
|
|
|
|
2019-04-26 21:08:38 +02:00
|
|
|
#ifdef CONFIG_NETUTILS_NETLIB_GENERICURLPARSER
|
|
|
|
struct url_s
|
|
|
|
{
|
|
|
|
FAR char *scheme;
|
|
|
|
int schemelen;
|
|
|
|
FAR char *user;
|
|
|
|
int userlen;
|
|
|
|
FAR char *password;
|
|
|
|
int passwordlen;
|
|
|
|
FAR char *host;
|
|
|
|
int hostlen;
|
|
|
|
int port;
|
|
|
|
FAR char *path;
|
|
|
|
int pathlen;
|
|
|
|
FAR char *parameters;
|
|
|
|
int parameterslen;
|
|
|
|
FAR char *bookmark;
|
|
|
|
int bookmarklen;
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2011-05-10 00:21:10 +02:00
|
|
|
/****************************************************************************
|
2015-07-12 19:53:23 +02:00
|
|
|
* Public Data
|
2011-05-10 00:21:10 +02:00
|
|
|
****************************************************************************/
|
|
|
|
|
2012-07-17 05:58:11 +02:00
|
|
|
#undef EXTERN
|
|
|
|
#if defined(__cplusplus)
|
|
|
|
#define EXTERN extern "C"
|
2014-01-21 17:21:45 +01:00
|
|
|
extern "C"
|
|
|
|
{
|
2012-07-17 05:58:11 +02:00
|
|
|
#else
|
|
|
|
#define EXTERN extern
|
|
|
|
#endif
|
|
|
|
|
2015-07-12 19:53:23 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Function Prototypes
|
|
|
|
****************************************************************************/
|
|
|
|
|
2019-11-10 00:38:02 +01:00
|
|
|
#ifdef CONFIG_NETLINK_ROUTE
|
|
|
|
/* Return a list of all devices */
|
|
|
|
|
|
|
|
ssize_t netlib_get_devices(FAR struct netlib_device_s *devlist,
|
|
|
|
unsigned int nentries, sa_family_t family);
|
|
|
|
#endif
|
|
|
|
|
2011-05-10 00:21:10 +02:00
|
|
|
/* Convert a textual representation of an IP address to a numerical representation.
|
|
|
|
*
|
|
|
|
* This function takes a textual representation of an IP address in
|
|
|
|
* the form a.b.c.d and converts it into a 4-byte array that can be
|
|
|
|
* used by other uIP functions.
|
|
|
|
*
|
|
|
|
* addrstr A pointer to a string containing the IP address in
|
|
|
|
* textual form.
|
|
|
|
*
|
|
|
|
* addr A pointer to a 4-byte array that will be filled in with
|
|
|
|
* the numerical representation of the address.
|
|
|
|
*
|
|
|
|
* Return: 0 If the IP address could not be parsed.
|
|
|
|
* Return: Non-zero If the IP address was parsed.
|
|
|
|
*/
|
|
|
|
|
2016-02-08 23:09:24 +01:00
|
|
|
bool netlib_ipv4addrconv(FAR const char *addrstr, FAR uint8_t *addr);
|
|
|
|
bool netlib_ethaddrconv(FAR const char *hwstr, FAR uint8_t *hw);
|
2011-05-10 00:21:10 +02:00
|
|
|
|
2015-07-12 19:53:23 +02:00
|
|
|
#ifdef CONFIG_NET_ETHERNET
|
2011-05-10 00:21:10 +02:00
|
|
|
/* Get and set IP/MAC addresses (Ethernet L2 only) */
|
|
|
|
|
2016-02-08 23:09:24 +01:00
|
|
|
int netlib_setmacaddr(FAR const char *ifname, FAR const uint8_t *macaddr);
|
|
|
|
int netlib_getmacaddr(FAR const char *ifname, FAR uint8_t *macaddr);
|
2011-05-10 00:21:10 +02:00
|
|
|
#endif
|
|
|
|
|
2017-08-02 20:40:50 +02:00
|
|
|
#ifdef CONFIG_WIRELESS_IEEE802154
|
|
|
|
/* IEEE 802.15.4 MAC IOCTL commands. */
|
2017-04-07 00:00:41 +02:00
|
|
|
|
2017-06-17 18:04:18 +02:00
|
|
|
int netlib_seteaddr(FAR const char *ifname, FAR const uint8_t *eaddr);
|
2017-06-19 11:56:52 +02:00
|
|
|
int netlib_getpanid(FAR const char *ifname, FAR uint8_t *panid);
|
2017-08-18 20:07:41 +02:00
|
|
|
bool netlib_saddrconv(FAR const char *hwstr, FAR uint8_t *hw);
|
2017-06-17 18:04:18 +02:00
|
|
|
bool netlib_eaddrconv(FAR const char *hwstr, FAR uint8_t *hw);
|
2017-04-07 00:00:41 +02:00
|
|
|
#endif
|
|
|
|
|
2017-08-02 20:40:50 +02:00
|
|
|
#ifdef CONFIG_WIRELESS_PKTRADIO
|
|
|
|
/* IEEE 802.15.4 MAC IOCTL commands. */
|
|
|
|
|
|
|
|
struct pktradio_properties_s; /* Forward reference */
|
|
|
|
struct pktradio_addr_s; /* Forward reference */
|
|
|
|
|
|
|
|
int netlib_getproperties(FAR const char *ifname,
|
|
|
|
FAR struct pktradio_properties_s *properties);
|
|
|
|
int netlib_setnodeaddr(FAR const char *ifname,
|
|
|
|
FAR const struct pktradio_addr_s *nodeaddr);
|
|
|
|
int netlib_getnodnodeaddr(FAR const char *ifname,
|
|
|
|
FAR struct pktradio_addr_s *nodeaddr);
|
2017-08-02 22:30:34 +02:00
|
|
|
bool netlib_nodeaddrconv(FAR const char *addrstr,
|
|
|
|
FAR struct pktradio_addr_s *nodeaddr);
|
2017-08-02 20:40:50 +02:00
|
|
|
#endif
|
|
|
|
|
2011-05-10 00:21:10 +02:00
|
|
|
/* IP address support */
|
|
|
|
|
2015-01-18 21:17:00 +01:00
|
|
|
#ifdef CONFIG_NET_IPv4
|
|
|
|
int netlib_get_ipv4addr(FAR const char *ifname, FAR struct in_addr *addr);
|
|
|
|
int netlib_set_ipv4addr(FAR const char *ifname, FAR const struct in_addr *addr);
|
|
|
|
int netlib_set_dripv4addr(FAR const char *ifname, FAR const struct in_addr *addr);
|
2016-01-14 14:24:36 +01:00
|
|
|
int netlib_get_dripv4addr(FAR const char *ifname, FAR struct in_addr *addr);
|
2015-01-18 21:17:00 +01:00
|
|
|
int netlib_set_ipv4netmask(FAR const char *ifname, FAR const struct in_addr *addr);
|
2016-01-14 14:24:36 +01:00
|
|
|
int netlib_get_ipv4netmask(FAR const char *ifname, FAR struct in_addr *addr);
|
2017-09-19 23:21:13 +02:00
|
|
|
int netlib_ipv4adaptor(in_addr_t destipaddr, FAR in_addr_t *srcipaddr);
|
2015-01-18 21:17:00 +01:00
|
|
|
#endif
|
|
|
|
|
2011-05-10 00:21:10 +02:00
|
|
|
#ifdef CONFIG_NET_IPv6
|
2015-01-18 21:17:00 +01:00
|
|
|
int netlib_get_ipv6addr(FAR const char *ifname, FAR struct in6_addr *addr);
|
|
|
|
int netlib_set_ipv6addr(FAR const char *ifname, FAR const struct in6_addr *addr);
|
|
|
|
int netlib_set_dripv6addr(FAR const char *ifname, FAR const struct in6_addr *addr);
|
|
|
|
int netlib_set_ipv6netmask(FAR const char *ifname, FAR const struct in6_addr *addr);
|
2017-09-20 14:52:05 +02:00
|
|
|
int netlib_ipv6adaptor(FAR const struct in6_addr *destipaddr,
|
|
|
|
FAR struct in6_addr *srcipaddr);
|
2015-02-06 17:23:15 +01:00
|
|
|
|
|
|
|
uint8_t netlib_ipv6netmask2prefix(FAR const uint16_t *mask);
|
|
|
|
void netlib_prefix2ipv6netmask(uint8_t preflen, FAR struct in6_addr *netmask);
|
2019-11-08 18:30:32 +01:00
|
|
|
#ifdef CONFIG_NETLINK_ROUTE
|
|
|
|
struct neighbor_entry_s;
|
|
|
|
ssize_t netlib_get_nbtable(FAR struct neighbor_entry_s *nbtab,
|
|
|
|
unsigned int nentries);
|
|
|
|
#endif
|
2019-11-11 20:40:57 +01:00
|
|
|
#endif /* CONFIG_NET_IPv6 */
|
2011-05-10 00:21:10 +02:00
|
|
|
|
2017-03-13 17:16:20 +01:00
|
|
|
#ifdef CONFIG_NETDEV_WIRELESS_IOCTL
|
2017-03-13 21:16:26 +01:00
|
|
|
int netlib_getessid(FAR const char *ifname, FAR char *essid, size_t idlen);
|
2017-03-13 17:16:20 +01:00
|
|
|
int netlib_setessid(FAR const char *ifname, FAR const char *essid);
|
|
|
|
#endif
|
|
|
|
|
2016-02-08 18:44:59 +01:00
|
|
|
#ifdef CONFIG_NET_ARP
|
|
|
|
/* ARP Table Support */
|
|
|
|
|
|
|
|
int netlib_del_arpmapping(FAR const struct sockaddr_in *inaddr);
|
|
|
|
int netlib_get_arpmapping(FAR const struct sockaddr_in *inaddr,
|
|
|
|
FAR uint8_t *macaddr);
|
|
|
|
int netlib_set_arpmapping(FAR const struct sockaddr_in *inaddr,
|
|
|
|
FAR const uint8_t *macaddr);
|
2019-11-03 22:13:47 +01:00
|
|
|
#ifdef CONFIG_NETLINK_ROUTE
|
2019-11-04 02:29:20 +01:00
|
|
|
struct arp_entry_s;
|
2019-11-03 23:19:14 +01:00
|
|
|
ssize_t netlib_get_arptable(FAR struct arp_entry_s *arptab,
|
|
|
|
unsigned int nentries);
|
2019-11-03 22:13:47 +01:00
|
|
|
#endif
|
2016-02-08 18:44:59 +01:00
|
|
|
#endif
|
|
|
|
|
2017-09-20 18:35:56 +02:00
|
|
|
#ifdef HAVE_ROUTE_PROCFS
|
|
|
|
# ifdef CONFIG_NET_IPv4
|
|
|
|
# define netlib_open_ipv4route() fopen(IPv4_ROUTE_PATH, "r")
|
|
|
|
# define netlib_close_ipv4route(stream) fclose(stream)
|
|
|
|
ssize_t netlib_read_ipv4route(FILE *stream,
|
|
|
|
FAR struct netlib_ipv4_route_s *route);
|
|
|
|
int netlib_ipv4router(FAR const struct in_addr *destipaddr,
|
|
|
|
FAR struct in_addr *router);
|
|
|
|
# endif
|
|
|
|
# ifdef CONFIG_NET_IPv6
|
|
|
|
# define netlib_open_ipv6route() fopen(IPv6_ROUTE_PATH, "r")
|
|
|
|
# define netlib_close_ipv6route(stream) fclose(stream)
|
|
|
|
ssize_t netlib_read_ipv6route(FILE *stream,
|
|
|
|
FAR struct netlib_ipv6_route_s *route);
|
|
|
|
int netlib_ipv6router(FAR const struct in6_addr *destipaddr,
|
|
|
|
FAR struct in6_addr *router);
|
|
|
|
# endif
|
|
|
|
#endif
|
2019-11-10 19:36:34 +01:00
|
|
|
|
|
|
|
#if defined(CONFIG_NETLINK_ROUTE) && defined(CONFIG_NET_ROUTE)
|
|
|
|
struct rtentry; /* Forward reference */
|
|
|
|
ssize_t netlib_get_route(FAR struct rtentry *rtelist,
|
|
|
|
unsigned int nentries, sa_family_t family);
|
|
|
|
#endif
|
2017-09-20 18:35:56 +02:00
|
|
|
|
2015-07-12 19:53:23 +02:00
|
|
|
#ifdef CONFIG_NET_ICMPv6_AUTOCONF
|
2015-02-03 15:01:55 +01:00
|
|
|
/* ICMPv6 Autoconfiguration */
|
|
|
|
|
|
|
|
int netlib_icmpv6_autoconfiguration(FAR const char *ifname);
|
|
|
|
#endif
|
|
|
|
|
2011-05-10 00:21:10 +02:00
|
|
|
/* HTTP support */
|
|
|
|
|
2014-07-03 00:52:02 +02:00
|
|
|
int netlib_parsehttpurl(FAR const char *url, uint16_t *port,
|
2014-01-21 17:21:45 +01:00
|
|
|
FAR char *hostname, int hostlen,
|
|
|
|
FAR char *filename, int namelen);
|
2011-05-10 00:21:10 +02:00
|
|
|
|
2019-04-26 21:08:38 +02:00
|
|
|
#ifdef CONFIG_NETUTILS_NETLIB_GENERICURLPARSER
|
|
|
|
int netlib_parseurl(FAR const char *str, FAR struct url_s *url);
|
|
|
|
#endif
|
|
|
|
|
2011-05-10 00:21:10 +02:00
|
|
|
/* Generic server logic */
|
|
|
|
|
2014-07-03 00:52:02 +02:00
|
|
|
int netlib_listenon(uint16_t portno);
|
|
|
|
void netlib_server(uint16_t portno, pthread_startroutine_t handler,
|
2014-01-21 17:21:45 +01:00
|
|
|
int stacksize);
|
2012-07-17 05:58:11 +02:00
|
|
|
|
2014-07-03 00:52:02 +02:00
|
|
|
int netlib_getifstatus(FAR const char *ifname, FAR uint8_t *flags);
|
|
|
|
int netlib_ifup(FAR const char *ifname);
|
|
|
|
int netlib_ifdown(FAR const char *ifname);
|
2012-11-04 19:54:04 +01:00
|
|
|
|
2015-07-12 19:53:23 +02:00
|
|
|
/* DNS server addressing */
|
|
|
|
|
|
|
|
#if defined(CONFIG_NET_IPv4) && defined(CONFIG_NETDB_DNSCLIENT)
|
|
|
|
int netlib_set_ipv4dnsaddr(FAR const struct in_addr *inaddr);
|
|
|
|
#endif
|
|
|
|
|
2012-07-17 05:58:11 +02:00
|
|
|
#undef EXTERN
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2011-05-10 00:21:10 +02:00
|
|
|
|
2014-07-03 00:04:25 +02:00
|
|
|
#endif /* __APPS_INCLUDE_NETUTILS_NETLIB_H */
|