Changes to netlib and nsh so that you build build with PF_IEEE802154 enabled and 6LoWPAN disabled.
This commit is contained in:
parent
6cbf2b9130
commit
41ce937ed0
@ -145,7 +145,7 @@ int pfserver_main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (client.sa_addr.s_mode == IEEE802154_ADDRMODE_SHORT)
|
if (client.sa_addr.s_mode == IEEE802154_ADDRMODE_SHORT)
|
||||||
{
|
{
|
||||||
printf("server: %d. Received %d bytes from %02x:02x\n",
|
printf("server: %d. Received %d bytes from %02x:%02x\n",
|
||||||
offset, nbytes,
|
offset, nbytes,
|
||||||
client.sa_addr.s_saddr[0], client.sa_addr.s_saddr[1]);
|
client.sa_addr.s_saddr[0], client.sa_addr.s_saddr[1]);
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,6 @@ int netlib_setmacaddr(FAR const char *ifname, FAR const uint8_t *macaddr);
|
|||||||
int netlib_getmacaddr(FAR const char *ifname, FAR uint8_t *macaddr);
|
int netlib_getmacaddr(FAR const char *ifname, FAR uint8_t *macaddr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_NET_6LOWPAN
|
|
||||||
#ifdef CONFIG_WIRELESS_IEEE802154
|
#ifdef CONFIG_WIRELESS_IEEE802154
|
||||||
/* IEEE 802.15.4 MAC IOCTL commands. */
|
/* IEEE 802.15.4 MAC IOCTL commands. */
|
||||||
|
|
||||||
@ -139,7 +138,6 @@ int netlib_getnodnodeaddr(FAR const char *ifname,
|
|||||||
bool netlib_nodeaddrconv(FAR const char *addrstr,
|
bool netlib_nodeaddrconv(FAR const char *addrstr,
|
||||||
FAR struct pktradio_addr_s *nodeaddr);
|
FAR struct pktradio_addr_s *nodeaddr);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
/* IP address support */
|
/* IP address support */
|
||||||
|
|
||||||
|
@ -86,15 +86,14 @@ ifeq ($(CONFIG_NET_ETHERNET),y)
|
|||||||
CSRCS += netlib_setmacaddr.c netlib_getmacaddr.c
|
CSRCS += netlib_setmacaddr.c netlib_getmacaddr.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_NET_6LOWPAN),y)
|
|
||||||
ifeq ($(CONFIG_WIRELESS_IEEE802154),y)
|
ifeq ($(CONFIG_WIRELESS_IEEE802154),y)
|
||||||
CSRCS += netlib_seteaddr.c netlib_getpanid.c netlib_saddrconv.c netlib_eaddrconv.c
|
CSRCS += netlib_seteaddr.c netlib_getpanid.c netlib_saddrconv.c netlib_eaddrconv.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_WIRELESS_PKTRADIO),y)
|
ifeq ($(CONFIG_WIRELESS_PKTRADIO),y)
|
||||||
CSRCS += netlib_getproperties.c netlib_getnodeaddr.c netlib_setnodeaddr.c
|
CSRCS += netlib_getproperties.c netlib_getnodeaddr.c netlib_setnodeaddr.c
|
||||||
CSRCS += netlib_nodeaddrconv.c
|
CSRCS += netlib_nodeaddrconv.c
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
|
|
||||||
# IGMP support
|
# IGMP support
|
||||||
|
|
||||||
|
@ -38,7 +38,6 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
|
|
||||||
|
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
@ -54,6 +53,8 @@
|
|||||||
|
|
||||||
#include "netutils/netlib.h"
|
#include "netutils/netlib.h"
|
||||||
|
|
||||||
|
#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -64,11 +65,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(CONFIG_NET_IPv4)
|
#if defined(CONFIG_NET_IPv4)
|
||||||
# define PF_INETX PF_INET
|
# define PF_FAMILY PF_INET
|
||||||
# define AF_INETX AF_INET
|
# define AF_FAMILY AF_INET
|
||||||
#elif defined(CONFIG_NET_IPv6)
|
#elif defined(CONFIG_NET_IPv6)
|
||||||
# define PF_INETX PF_INET6
|
# define PF_FAMILY PF_INET6
|
||||||
# define AF_INETX AF_INET6
|
# define AF_FAMILY AF_INET6
|
||||||
|
#elif defined(CONFIG_NET_IEEE802154)
|
||||||
|
# define PF_FAMILY PF_IEEE802154
|
||||||
|
# define AF_FAMILY AF_IEEE802154
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -100,7 +104,7 @@ int netlib_getessid(FAR const char *ifname, FAR char *essid, size_t idlen)
|
|||||||
{
|
{
|
||||||
/* Get a socket (only so that we get access to the INET subsystem) */
|
/* Get a socket (only so that we get access to the INET subsystem) */
|
||||||
|
|
||||||
int sockfd = socket(PF_INETX, NETLIB_SOCK_IOCTL, 0);
|
int sockfd = socket(PF_FAMILY, NETLIB_SOCK_IOCTL, 0);
|
||||||
if (sockfd >= 0)
|
if (sockfd >= 0)
|
||||||
{
|
{
|
||||||
struct iwreq req;
|
struct iwreq req;
|
||||||
|
@ -38,7 +38,6 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
|
|
||||||
|
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
@ -53,6 +52,8 @@
|
|||||||
|
|
||||||
#include "netutils/netlib.h"
|
#include "netutils/netlib.h"
|
||||||
|
|
||||||
|
#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -61,15 +62,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(CONFIG_NET_IPv4)
|
#if defined(CONFIG_NET_IPv4)
|
||||||
# define PF_INETX PF_INET
|
# define AF_FAMILY AF_INET
|
||||||
#elif defined(CONFIG_NET_IPv6)
|
#elif defined(CONFIG_NET_IPv6)
|
||||||
# define PF_INETX PF_INET6
|
# define AF_FAMILY AF_INET6
|
||||||
#elif defined(CONFIG_NET_LOCAL)
|
#elif defined(CONFIG_NET_LOCAL)
|
||||||
# define PF_INETX PF_LOCAL
|
# define AF_FAMILY AF_LOCAL
|
||||||
#elif defined(CONFIG_NET_PKT)
|
#elif defined(CONFIG_NET_PKT)
|
||||||
# define PF_INETX PF_PACKET
|
# define AF_FAMILY AF_PACKET
|
||||||
|
#elif defined(CONFIG_NET_IEEE802154)
|
||||||
|
# define AF_FAMILY AF_IEEE802154
|
||||||
#elif defined(CONFIG_NET_USRSOCK)
|
#elif defined(CONFIG_NET_USRSOCK)
|
||||||
# define PF_INETX PF_INET
|
# define AF_FAMILY AF_INET
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -98,7 +101,7 @@ int netlib_getifstatus(FAR const char *ifname, FAR uint8_t *flags)
|
|||||||
{
|
{
|
||||||
/* Get a socket (only so that we get access to the INET subsystem) */
|
/* Get a socket (only so that we get access to the INET subsystem) */
|
||||||
|
|
||||||
int sockfd = socket(PF_INETX, NETLIB_SOCK_IOCTL, 0);
|
int sockfd = socket(AF_FAMILY, NETLIB_SOCK_IOCTL, 0);
|
||||||
if (sockfd >= 0)
|
if (sockfd >= 0)
|
||||||
{
|
{
|
||||||
struct ifreq req;
|
struct ifreq req;
|
||||||
|
@ -38,7 +38,6 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
|
|
||||||
|
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
@ -52,6 +51,8 @@
|
|||||||
|
|
||||||
#include "netutils/netlib.h"
|
#include "netutils/netlib.h"
|
||||||
|
|
||||||
|
#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -60,13 +61,15 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(CONFIG_NET_IPv4)
|
#if defined(CONFIG_NET_IPv4)
|
||||||
# define PF_INETX PF_INET
|
# define AF_FAMILY AF_INET
|
||||||
#elif defined(CONFIG_NET_IPv6)
|
#elif defined(CONFIG_NET_IPv6)
|
||||||
# define PF_INETX PF_INET6
|
# define AF_FAMILY AF_INET6
|
||||||
#elif defined(CONFIG_NET_PKT)
|
#elif defined(CONFIG_NET_PKT)
|
||||||
# define PF_INETX PF_PACKET
|
# define AF_FAMILY AF_PACKET
|
||||||
|
#elif defined(CONFIG_NET_IEEE802154)
|
||||||
|
# define AF_FAMILY AF_IEEE802154
|
||||||
#elif defined(CONFIG_NET_USRSOCK)
|
#elif defined(CONFIG_NET_USRSOCK)
|
||||||
# define PF_INETX PF_INET
|
# define AF_FAMILY AF_INET
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -95,7 +98,7 @@ int netlib_getmacaddr(const char *ifname, uint8_t *macaddr)
|
|||||||
{
|
{
|
||||||
/* Get a socket (only so that we get access to the INET subsystem) */
|
/* Get a socket (only so that we get access to the INET subsystem) */
|
||||||
|
|
||||||
int sockfd = socket(PF_INETX, NETLIB_SOCK_IOCTL, 0);
|
int sockfd = socket(AF_FAMILY, NETLIB_SOCK_IOCTL, 0);
|
||||||
if (sockfd >= 0)
|
if (sockfd >= 0)
|
||||||
{
|
{
|
||||||
struct ifreq req;
|
struct ifreq req;
|
||||||
@ -114,6 +117,7 @@ int netlib_getmacaddr(const char *ifname, uint8_t *macaddr)
|
|||||||
|
|
||||||
memcpy(macaddr, &req.ifr_hwaddr.sa_data, IFHWADDRLEN);
|
memcpy(macaddr, &req.ifr_hwaddr.sa_data, IFHWADDRLEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
close(sockfd);
|
close(sockfd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,8 @@
|
|||||||
#include "nuttx/wireless/pktradio.h"
|
#include "nuttx/wireless/pktradio.h"
|
||||||
#include "netutils/netlib.h"
|
#include "netutils/netlib.h"
|
||||||
|
|
||||||
#if defined(CONFIG_NET_6LOWPAN) && CONFIG_NSOCKET_DESCRIPTORS > 0
|
#if (defined(CONFIG_NET_6LOWPAN) || defined(CONFIG_NET_IEEE802154)) && \
|
||||||
|
CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
@ -108,4 +109,4 @@ int netlib_getnodnodeaddr(FAR const char *ifname,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_NET_6LOWPAN && CONFIG_NSOCKET_DESCRIPTORS */
|
#endif /* (CONFIG_NET_6LOWPAN || CONFIG_NET_IEEE802154) && CONFIG_NSOCKET_DESCRIPTORS */
|
||||||
|
@ -42,14 +42,18 @@
|
|||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "wireless/ieee802154.h"
|
#include <net/if.h>
|
||||||
|
#include <nuttx/wireless/ieee802154/ieee802154_mac.h>
|
||||||
|
|
||||||
#include "netutils/netlib.h"
|
#include "netutils/netlib.h"
|
||||||
|
|
||||||
#if defined(CONFIG_NET_6LOWPAN) && CONFIG_NSOCKET_DESCRIPTORS > 0
|
#if (defined(CONFIG_NET_6LOWPAN) || defined(CONFIG_NET_IEEE802154)) && \
|
||||||
|
CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
@ -72,6 +76,7 @@
|
|||||||
|
|
||||||
int netlib_getpanid(FAR const char *ifname, FAR uint8_t *panid)
|
int netlib_getpanid(FAR const char *ifname, FAR uint8_t *panid)
|
||||||
{
|
{
|
||||||
|
struct ieee802154_netmac_s arg;
|
||||||
int ret = ERROR;
|
int ret = ERROR;
|
||||||
|
|
||||||
if (ifname != NULL && panid != NULL)
|
if (ifname != NULL && panid != NULL)
|
||||||
@ -81,14 +86,26 @@ int netlib_getpanid(FAR const char *ifname, FAR uint8_t *panid)
|
|||||||
int sockfd = socket(PF_INET6, NETLIB_SOCK_IOCTL, 0);
|
int sockfd = socket(PF_INET6, NETLIB_SOCK_IOCTL, 0);
|
||||||
if (sockfd >= 0)
|
if (sockfd >= 0)
|
||||||
{
|
{
|
||||||
/* Use the helper provided in libmac */
|
/* Perform the IOCTL */
|
||||||
|
|
||||||
|
strncpy(arg.ifr_name, ifname, IFNAMSIZ);
|
||||||
|
arg.u.getreq.attr = IEEE802154_ATTR_MAC_PANID;
|
||||||
|
|
||||||
|
ret = ioctl(sockfd, MAC802154IOC_MLME_GET_REQUEST,
|
||||||
|
(unsigned long)((uintptr_t)&arg));
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
ret = -errno;
|
||||||
|
fprintf(stderr, "MAC802154IOC_MLME_GET_REQUEST failed: %d\n",
|
||||||
|
ret);
|
||||||
|
}
|
||||||
|
|
||||||
ret = sixlowpan_getpanid(sockfd, ifname, panid);
|
|
||||||
close(sockfd);
|
close(sockfd);
|
||||||
|
IEEE802154_PANIDCOPY(panid, arg.u.getreq.attrval.mac.panid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_NET_6LOWPAN && CONFIG_NSOCKET_DESCRIPTORS */
|
#endif /* (CONFIG_NET_6LOWPAN || CONFIG_NET_IEEE802154) && CONFIG_NSOCKET_DESCRIPTORS */
|
||||||
|
@ -50,7 +50,8 @@
|
|||||||
#include "nuttx/wireless/pktradio.h"
|
#include "nuttx/wireless/pktradio.h"
|
||||||
#include "netutils/netlib.h"
|
#include "netutils/netlib.h"
|
||||||
|
|
||||||
#if defined(CONFIG_NET_6LOWPAN) && CONFIG_NSOCKET_DESCRIPTORS > 0
|
#if (defined(CONFIG_NET_6LOWPAN) || defined(CONFIG_NET_IEEE802154)) && \
|
||||||
|
CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
@ -108,4 +109,4 @@ int netlib_getproperties(FAR const char *ifname,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_NET_6LOWPAN && CONFIG_NSOCKET_DESCRIPTORS */
|
#endif /* (CONFIG_NET_6LOWPAN || CONFIG_NET_IEEE802154) && CONFIG_NSOCKET_DESCRIPTORS */
|
||||||
|
@ -52,7 +52,8 @@
|
|||||||
#include "nuttx/wireless/pktradio.h"
|
#include "nuttx/wireless/pktradio.h"
|
||||||
#include "netutils/netlib.h"
|
#include "netutils/netlib.h"
|
||||||
|
|
||||||
#if defined(CONFIG_NET_6LOWPAN) && CONFIG_NSOCKET_DESCRIPTORS > 0
|
#if (defined(CONFIG_NET_6LOWPAN) || defined(CONFIG_NET_IEEE802154)) && \
|
||||||
|
CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
@ -189,4 +190,5 @@ bool netlib_nodeaddrconv(FAR const char *addrstr,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_NET_6LOWPAN && CONFIG_NSOCKET_DESCRIPTORS */
|
#endif /* (CONFIG_NET_6LOWPAN || CONFIG_NET_IEEE802154) && CONFIG_NSOCKET_DESCRIPTORS */
|
||||||
|
|
||||||
|
@ -42,14 +42,18 @@
|
|||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "wireless/ieee802154.h"
|
#include <net/if.h>
|
||||||
|
#include <nuttx/wireless/ieee802154/ieee802154_mac.h>
|
||||||
|
|
||||||
#include "netutils/netlib.h"
|
#include "netutils/netlib.h"
|
||||||
|
|
||||||
#if defined(CONFIG_NET_6LOWPAN) && CONFIG_NSOCKET_DESCRIPTORS > 0
|
#if (defined(CONFIG_NET_6LOWPAN) || defined(CONFIG_NET_IEEE802154)) && \
|
||||||
|
CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
@ -72,6 +76,7 @@
|
|||||||
|
|
||||||
int netlib_seteaddr(FAR const char *ifname, FAR const uint8_t *eaddr)
|
int netlib_seteaddr(FAR const char *ifname, FAR const uint8_t *eaddr)
|
||||||
{
|
{
|
||||||
|
struct ieee802154_netmac_s arg;
|
||||||
int ret = ERROR;
|
int ret = ERROR;
|
||||||
|
|
||||||
if (ifname != NULL)
|
if (ifname != NULL)
|
||||||
@ -81,14 +86,26 @@ int netlib_seteaddr(FAR const char *ifname, FAR const uint8_t *eaddr)
|
|||||||
int sockfd = socket(PF_INET6, NETLIB_SOCK_IOCTL, 0);
|
int sockfd = socket(PF_INET6, NETLIB_SOCK_IOCTL, 0);
|
||||||
if (sockfd >= 0)
|
if (sockfd >= 0)
|
||||||
{
|
{
|
||||||
/* Use the helper provided in libmac */
|
/* Perform the IOCTL */
|
||||||
|
|
||||||
ret = sixlowpan_seteaddr(sockfd, ifname, eaddr);
|
strncpy(arg.ifr_name, ifname, IFNAMSIZ);
|
||||||
close(sockfd);
|
arg.u.setreq.attr = IEEE802154_ATTR_MAC_EADDR;
|
||||||
|
IEEE802154_EADDRCOPY(arg.u.setreq.attrval.mac.eaddr, eaddr);
|
||||||
|
|
||||||
|
ret = ioctl(sockfd, MAC802154IOC_MLME_SET_REQUEST,
|
||||||
|
(unsigned long)((uintptr_t)&arg));
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
ret = -errno;
|
||||||
|
fprintf(stderr, "MAC802154IOC_MLME_SET_REQUEST failed: %d\n",
|
||||||
|
ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
close(sockfd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_NET_6LOWPAN && CONFIG_NSOCKET_DESCRIPTORS */
|
#endif /* (CONFIG_NET_6LOWPAN || CONFIG_NET_IEEE802154) && CONFIG_NSOCKET_DESCRIPTORS */
|
||||||
|
@ -38,7 +38,6 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
|
|
||||||
|
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
@ -54,6 +53,8 @@
|
|||||||
|
|
||||||
#include "netutils/netlib.h"
|
#include "netutils/netlib.h"
|
||||||
|
|
||||||
|
#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -64,11 +65,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(CONFIG_NET_IPv4)
|
#if defined(CONFIG_NET_IPv4)
|
||||||
# define PF_INETX PF_INET
|
# define PF_FAMILY PF_INET
|
||||||
# define AF_INETX AF_INET
|
# define AF_FAMILY AF_INET
|
||||||
#elif defined(CONFIG_NET_IPv6)
|
#elif defined(CONFIG_NET_IPv6)
|
||||||
# define PF_INETX PF_INET6
|
# define PF_FAMILY PF_INET6
|
||||||
# define AF_INETX AF_INET6
|
# define AF_FAMILY AF_INET6
|
||||||
|
#elif defined(CONFIG_NET_IEEE802154)
|
||||||
|
# define PF_FAMILY PF_IEEE802154
|
||||||
|
# define AF_FAMILY AF_IEEE802154
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -99,7 +103,7 @@ int netlib_setessid(FAR const char *ifname, FAR const char *essid)
|
|||||||
{
|
{
|
||||||
/* Get a socket (only so that we get access to the INET subsystem) */
|
/* Get a socket (only so that we get access to the INET subsystem) */
|
||||||
|
|
||||||
int sockfd = socket(PF_INETX, NETLIB_SOCK_IOCTL, 0);
|
int sockfd = socket(PF_FAMILY, NETLIB_SOCK_IOCTL, 0);
|
||||||
if (sockfd >= 0)
|
if (sockfd >= 0)
|
||||||
{
|
{
|
||||||
struct iwreq req;
|
struct iwreq req;
|
||||||
|
@ -38,7 +38,6 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
|
|
||||||
|
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
@ -52,6 +51,8 @@
|
|||||||
|
|
||||||
#include "netutils/netlib.h"
|
#include "netutils/netlib.h"
|
||||||
|
|
||||||
|
#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -60,15 +61,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(CONFIG_NET_IPv4)
|
#if defined(CONFIG_NET_IPv4)
|
||||||
# define PF_INETX PF_INET
|
# define AF_FAMILY AF_INET
|
||||||
#elif defined(CONFIG_NET_IPv6)
|
#elif defined(CONFIG_NET_IPv6)
|
||||||
# define PF_INETX PF_INET6
|
# define AF_FAMILY AF_INET6
|
||||||
#elif defined(CONFIG_NET_LOCAL)
|
#elif defined(CONFIG_NET_LOCAL)
|
||||||
# define PF_INETX PF_LOCAL
|
# define AF_FAMILY AF_LOCAL
|
||||||
#elif defined(CONFIG_NET_PKT)
|
#elif defined(CONFIG_NET_PKT)
|
||||||
# define PF_INETX PF_PACKET
|
# define AF_FAMILY AF_PACKET
|
||||||
|
#elif defined(CONFIG_NET_IEEE802154)
|
||||||
|
# define AF_FAMILY AF_IEEE802154
|
||||||
#elif defined(CONFIG_NET_USRSOCK)
|
#elif defined(CONFIG_NET_USRSOCK)
|
||||||
# define PF_INETX PF_INET
|
# define AF_FAMILY AF_INET
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -96,7 +99,7 @@ int netlib_ifup(const char *ifname)
|
|||||||
{
|
{
|
||||||
/* Get a socket (only so that we get access to the INET subsystem) */
|
/* Get a socket (only so that we get access to the INET subsystem) */
|
||||||
|
|
||||||
int sockfd = socket(PF_INETX, NETLIB_SOCK_IOCTL, 0);
|
int sockfd = socket(AF_FAMILY, NETLIB_SOCK_IOCTL, 0);
|
||||||
if (sockfd >= 0)
|
if (sockfd >= 0)
|
||||||
{
|
{
|
||||||
struct ifreq req;
|
struct ifreq req;
|
||||||
@ -139,7 +142,7 @@ int netlib_ifdown(const char *ifname)
|
|||||||
{
|
{
|
||||||
/* Get a socket (only so that we get access to the INET subsystem) */
|
/* Get a socket (only so that we get access to the INET subsystem) */
|
||||||
|
|
||||||
int sockfd = socket(PF_INETX, NETLIB_SOCK_IOCTL, 0);
|
int sockfd = socket(AF_FAMILY, NETLIB_SOCK_IOCTL, 0);
|
||||||
if (sockfd >= 0)
|
if (sockfd >= 0)
|
||||||
{
|
{
|
||||||
struct ifreq req;
|
struct ifreq req;
|
||||||
|
@ -38,7 +38,6 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
|
|
||||||
|
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
@ -52,6 +51,8 @@
|
|||||||
|
|
||||||
#include "netutils/netlib.h"
|
#include "netutils/netlib.h"
|
||||||
|
|
||||||
|
#if defined(CONFIG_NET) && CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -61,17 +62,20 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(CONFIG_NET_IPv4)
|
#if defined(CONFIG_NET_IPv4)
|
||||||
# define PF_INETX PF_INET
|
# define PF_FAMILY PF_INET
|
||||||
# define AF_INETX AF_INET
|
# define AF_FAMILY AF_INET
|
||||||
#elif defined(CONFIG_NET_IPv6)
|
#elif defined(CONFIG_NET_IPv6)
|
||||||
# define PF_INETX PF_INET6
|
# define PF_FAMILY PF_INET6
|
||||||
# define AF_INETX AF_INET6
|
# define AF_FAMILY AF_INET6
|
||||||
#elif defined(CONFIG_NET_PKT)
|
#elif defined(CONFIG_NET_PKT)
|
||||||
# define PF_INETX PF_PACKET
|
# define PF_FAMILY PF_PACKET
|
||||||
# define AF_INETX AF_PACKET
|
# define AF_FAMILY AF_PACKET
|
||||||
|
#elif defined(CONFIG_NET_IEEE802154)
|
||||||
|
# define PF_FAMILY PF_IEEE802154
|
||||||
|
# define AF_FAMILY AF_IEEE802154
|
||||||
#elif defined(CONFIG_NET_USRSOCK)
|
#elif defined(CONFIG_NET_USRSOCK)
|
||||||
# define PF_INETX PF_INET
|
# define PF_FAMILY PF_INET
|
||||||
# define AF_INETX AF_INET
|
# define AF_FAMILY AF_INET
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -101,7 +105,7 @@ int netlib_setmacaddr(const char *ifname, const uint8_t *macaddr)
|
|||||||
{
|
{
|
||||||
/* Get a socket (only so that we get access to the INET subsystem) */
|
/* Get a socket (only so that we get access to the INET subsystem) */
|
||||||
|
|
||||||
int sockfd = socket(PF_INETX, NETLIB_SOCK_IOCTL, 0);
|
int sockfd = socket(PF_FAMILY, NETLIB_SOCK_IOCTL, 0);
|
||||||
if (sockfd >= 0)
|
if (sockfd >= 0)
|
||||||
{
|
{
|
||||||
struct ifreq req;
|
struct ifreq req;
|
||||||
@ -112,7 +116,7 @@ int netlib_setmacaddr(const char *ifname, const uint8_t *macaddr)
|
|||||||
|
|
||||||
/* Put the new MAC address into the request */
|
/* Put the new MAC address into the request */
|
||||||
|
|
||||||
req.ifr_hwaddr.sa_family = AF_INETX;
|
req.ifr_hwaddr.sa_family = AF_FAMILY;
|
||||||
memcpy(&req.ifr_hwaddr.sa_data, macaddr, IFHWADDRLEN);
|
memcpy(&req.ifr_hwaddr.sa_data, macaddr, IFHWADDRLEN);
|
||||||
|
|
||||||
/* Perform the ioctl to set the MAC address */
|
/* Perform the ioctl to set the MAC address */
|
||||||
|
@ -50,7 +50,8 @@
|
|||||||
#include "nuttx/wireless/pktradio.h"
|
#include "nuttx/wireless/pktradio.h"
|
||||||
#include "netutils/netlib.h"
|
#include "netutils/netlib.h"
|
||||||
|
|
||||||
#if defined(CONFIG_NET_6LOWPAN) && CONFIG_NSOCKET_DESCRIPTORS > 0
|
#if (defined(CONFIG_NET_6LOWPAN) || defined(CONFIG_NET_IEEE802154)) && \
|
||||||
|
CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
@ -104,4 +105,4 @@ int netlib_setnodeaddr(FAR const char *ifname,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_NET_6LOWPAN && CONFIG_NSOCKET_DESCRIPTORS */
|
#endif /* (CONFIG_NET_6LOWPAN || CONFIG_NET_IEEE802154) && CONFIG_NSOCKET_DESCRIPTORS */
|
||||||
|
@ -76,6 +76,10 @@
|
|||||||
# include <nuttx/net/sixlowpan.h>
|
# include <nuttx/net/sixlowpan.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_IEEE802154
|
||||||
|
# include <nuttx/net/ieee802154.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_NETUTILS_NTPCLIENT
|
#ifdef CONFIG_NETUTILS_NTPCLIENT
|
||||||
# include "netutils/ntpclient.h"
|
# include "netutils/ntpclient.h"
|
||||||
#endif
|
#endif
|
||||||
@ -100,26 +104,34 @@
|
|||||||
# undef CONFIG_NET_TUN
|
# undef CONFIG_NET_TUN
|
||||||
# undef CONFIG_NET_LOCAL
|
# undef CONFIG_NET_LOCAL
|
||||||
# undef CONFIG_NET_USRSOCK
|
# undef CONFIG_NET_USRSOCK
|
||||||
|
# undef CONFIG_NET_IEEE802154
|
||||||
# undef CONFIG_NET_LOOPBACK
|
# undef CONFIG_NET_LOOPBACK
|
||||||
#elif defined(CONFIG_NET_6LOWPAN)
|
#elif defined(CONFIG_NET_6LOWPAN)
|
||||||
# undef CONFIG_NET_SLIP
|
# undef CONFIG_NET_SLIP
|
||||||
# undef CONFIG_NET_TUN
|
# undef CONFIG_NET_TUN
|
||||||
# undef CONFIG_NET_LOCAL
|
# undef CONFIG_NET_LOCAL
|
||||||
# undef CONFIG_NET_USRSOCK
|
# undef CONFIG_NET_USRSOCK
|
||||||
|
# undef CONFIG_NET_IEEE802154
|
||||||
# undef CONFIG_NET_LOOPBACK
|
# undef CONFIG_NET_LOOPBACK
|
||||||
#elif defined(CONFIG_NET_SLIP)
|
#elif defined(CONFIG_NET_SLIP)
|
||||||
# undef CONFIG_NET_TUN
|
# undef CONFIG_NET_TUN
|
||||||
# undef CONFIG_NET_LOCAL
|
# undef CONFIG_NET_LOCAL
|
||||||
# undef CONFIG_NET_USRSOCK
|
# undef CONFIG_NET_USRSOCK
|
||||||
|
# undef CONFIG_NET_IEEE802154
|
||||||
# undef CONFIG_NET_LOOPBACK
|
# undef CONFIG_NET_LOOPBACK
|
||||||
#elif defined(CONFIG_NET_TUN)
|
#elif defined(CONFIG_NET_TUN)
|
||||||
# undef CONFIG_NET_LOCAL
|
# undef CONFIG_NET_LOCAL
|
||||||
# undef CONFIG_NET_USRSOCK
|
# undef CONFIG_NET_USRSOCK
|
||||||
|
# undef CONFIG_NET_IEEE802154
|
||||||
# undef CONFIG_NET_LOOPBACK
|
# undef CONFIG_NET_LOOPBACK
|
||||||
#elif defined(CONFIG_NET_LOCAL)
|
#elif defined(CONFIG_NET_LOCAL)
|
||||||
# undef CONFIG_NET_USRSOCK
|
# undef CONFIG_NET_USRSOCK
|
||||||
|
# undef CONFIG_NET_IEEE802154
|
||||||
# undef CONFIG_NET_LOOPBACK
|
# undef CONFIG_NET_LOOPBACK
|
||||||
#elif defined(CONFIG_NET_USRSOCK)
|
#elif defined(CONFIG_NET_USRSOCK)
|
||||||
|
# undef CONFIG_NET_IEEE802154
|
||||||
|
# undef CONFIG_NET_LOOPBACK
|
||||||
|
#elif defined(CONFIG_NET_IEEE802154)
|
||||||
# undef CONFIG_NET_LOOPBACK
|
# undef CONFIG_NET_LOOPBACK
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -174,7 +186,7 @@
|
|||||||
#elif defined(CONFIG_NET_ETHERNET)
|
#elif defined(CONFIG_NET_ETHERNET)
|
||||||
# define NET_DEVNAME "eth0"
|
# define NET_DEVNAME "eth0"
|
||||||
# define NSH_HAVE_NETDEV
|
# define NSH_HAVE_NETDEV
|
||||||
#elif defined(CONFIG_NET_6LOWPAN)
|
#elif defined(CONFIG_NET_6LOWPAN) || defined(CONFIG_NET_IEEE802154)
|
||||||
# define NET_DEVNAME "wpan0"
|
# define NET_DEVNAME "wpan0"
|
||||||
# define NSH_HAVE_NETDEV
|
# define NSH_HAVE_NETDEV
|
||||||
#elif defined(CONFIG_NET_SLIP)
|
#elif defined(CONFIG_NET_SLIP)
|
||||||
@ -344,7 +356,8 @@ static void nsh_set_macaddr(void)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#if defined(NSH_HAVE_NETDEV) && !defined(CONFIG_NET_6LOWPAN)
|
#if defined(NSH_HAVE_NETDEV) && !defined(CONFIG_NET_6LOWPAN) && ! \
|
||||||
|
defined(CONFIG_NET_IEEE802154)
|
||||||
static void nsh_set_ipaddrs(void)
|
static void nsh_set_ipaddrs(void)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_NET_IPv4
|
#ifdef CONFIG_NET_IPv4
|
||||||
|
Loading…
Reference in New Issue
Block a user