Skip to content
...@@ -83,7 +83,7 @@ static dq_queue_t g_active_ieee802154_connections; ...@@ -83,7 +83,7 @@ static dq_queue_t g_active_ieee802154_connections;
* Name: ieee802154_conn_initialize * Name: ieee802154_conn_initialize
* *
* Description: * Description:
* Initialize the IEEE 802.15.5 connection structure allocator. Called * Initialize the IEEE 802.15.4 connection structure allocator. Called
* once and only from ieee802154_initialize(). * once and only from ieee802154_initialize().
* *
* Assumptions: * Assumptions:
...@@ -218,7 +218,7 @@ FAR struct ieee802154_conn_s * ...@@ -218,7 +218,7 @@ FAR struct ieee802154_conn_s *
conn = (FAR struct ieee802154_conn_s *)conn->node.flink) conn = (FAR struct ieee802154_conn_s *)conn->node.flink)
{ {
/* Does the destination address match the bound address of the socket. */ /* Does the destination address match the bound address of the socket. */
/* REVISIT: Currently and explict address must be assigned. Should we /* REVISIT: Currently and explicit address must be assigned. Should we
* support some moral equivalent to INADDR_ANY? * support some moral equivalent to INADDR_ANY?
*/ */
......
/**************************************************************************** /****************************************************************************
* wireless/pktradio/ieee802154_container.c * net/ieee802154/ieee802154_container.c
* *
* Copyright (C) 2017 Gregory Nutt. All rights reserved. * Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
......
/**************************************************************************** /****************************************************************************
* net/ieee802154/ieee802154_finddev.c * net/ieee802154/ieee802154_finddev.c
* *
* Copyright (C) 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -65,7 +65,7 @@ struct ieee802154_finddev_s ...@@ -65,7 +65,7 @@ struct ieee802154_finddev_s
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: ieee8021545_dev_callback * Name: ieee802154_dev_callback
* *
* Description: * Description:
* Check if this device matches the connections local address. * Check if this device matches the connections local address.
...@@ -79,7 +79,7 @@ struct ieee802154_finddev_s ...@@ -79,7 +79,7 @@ struct ieee802154_finddev_s
* *
****************************************************************************/ ****************************************************************************/
static int ieee8021545_dev_callback(FAR struct net_driver_s *dev, FAR void *arg) static int ieee802154_dev_callback(FAR struct net_driver_s *dev, FAR void *arg)
{ {
FAR struct ieee802154_finddev_s *match = FAR struct ieee802154_finddev_s *match =
(FAR struct ieee802154_finddev_s *)arg; (FAR struct ieee802154_finddev_s *)arg;
...@@ -174,10 +174,10 @@ FAR struct radio_driver_s * ...@@ -174,10 +174,10 @@ FAR struct radio_driver_s *
addr->s_mode == IEEE802154_ADDRMODE_EXTENDED); addr->s_mode == IEEE802154_ADDRMODE_EXTENDED);
/* Other, search for the IEEE 802.15.4 network device whose MAC is equal to /* Other, search for the IEEE 802.15.4 network device whose MAC is equal to
* the sockets bount local address. * the sockets bound local address.
*/ */
ret = netdev_foreach(ieee8021545_dev_callback, (FAR void *)&match); ret = netdev_foreach(ieee802154_dev_callback, (FAR void *)&match);
if (ret == 1) if (ret == 1)
{ {
DEBUGASSERT(match.radio != NULL); DEBUGASSERT(match.radio != NULL);
......
...@@ -94,7 +94,7 @@ static int ieee802154_count_frames(FAR struct ieee802154_conn_s *conn) ...@@ -94,7 +94,7 @@ static int ieee802154_count_frames(FAR struct ieee802154_conn_s *conn)
* Input Parameters: * Input Parameters:
* conn - The socket connection structure. * conn - The socket connection structure.
* framel - A single frame to add to the RX queue. * framel - A single frame to add to the RX queue.
* meta - Meta data characterizing the received frane. * meta - Meta data characterizing the received frame.
* *
* Returned Value: * Returned Value:
* Zero (OK) is returned on success; A negated errno value is returned on * Zero (OK) is returned on success; A negated errno value is returned on
...@@ -222,9 +222,9 @@ static int ieee802154_queue_frame(FAR struct ieee802154_conn_s *conn, ...@@ -222,9 +222,9 @@ static int ieee802154_queue_frame(FAR struct ieee802154_conn_s *conn,
* framelist - The head of an incoming list of frames. Normally this * framelist - The head of an incoming list of frames. Normally this
* would be a single frame. A list may be provided if * would be a single frame. A list may be provided if
* appropriate, however. * appropriate, however.
* meta - Meta data characterizing the received frane. * meta - Meta data characterizing the received frame.
* *
* If there are multilple frames in the list, this metadata * If there are multiple frames in the list, this metadata
* must apply to all of the frames in the list. * must apply to all of the frames in the list.
* *
* Returned Value: * Returned Value:
......
/**************************************************************************** /****************************************************************************
* net/ieee802154/ieee802154_sendto.c * net/ieee802154/ieee802154_sendto.c
* *
* Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. * Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -57,7 +56,6 @@ ...@@ -57,7 +56,6 @@
#include <nuttx/mm/iob.h> #include <nuttx/mm/iob.h>
#include <nuttx/net/radiodev.h> #include <nuttx/net/radiodev.h>
#include <nuttx/net/net.h> #include <nuttx/net/net.h>
#include <nuttx/net/ip.h>
#include "netdev/netdev.h" #include "netdev/netdev.h"
#include "devif/devif.h" #include "devif/devif.h"
...@@ -78,7 +76,7 @@ struct ieee802154_sendto_s ...@@ -78,7 +76,7 @@ struct ieee802154_sendto_s
{ {
FAR struct socket *is_sock; /* Points to the parent socket structure */ FAR struct socket *is_sock; /* Points to the parent socket structure */
FAR struct devif_callback_s *is_cb; /* Reference to callback instance */ FAR struct devif_callback_s *is_cb; /* Reference to callback instance */
struct ieee802154_saddr_s is_destaddr; /* Frame destinatin address */ struct ieee802154_saddr_s is_destaddr; /* Frame destination address */
sem_t is_sem; /* Used to wake up the waiting thread */ sem_t is_sem; /* Used to wake up the waiting thread */
FAR const uint8_t *is_buffer; /* User buffer of data to send */ FAR const uint8_t *is_buffer; /* User buffer of data to send */
size_t is_buflen; /* Number of bytes in the is_buffer */ size_t is_buflen; /* Number of bytes in the is_buffer */
...@@ -179,7 +177,7 @@ static inline bool ieee802154_eaddrnull(FAR const uint8_t *eaddr) ...@@ -179,7 +177,7 @@ static inline bool ieee802154_eaddrnull(FAR const uint8_t *eaddr)
* *
****************************************************************************/ ****************************************************************************/
void ieee802154_meta_data(FAR struct radio_driver_s *radio, static void ieee802154_meta_data(FAR struct radio_driver_s *radio,
FAR struct ieee802154_sendto_s *pstate, FAR struct ieee802154_sendto_s *pstate,
FAR struct ieee802154_frame_meta_s *meta) FAR struct ieee802154_frame_meta_s *meta)
{ {
...@@ -538,7 +536,7 @@ ssize_t psock_ieee802154_sendto(FAR struct socket *psock, FAR const void *buf, ...@@ -538,7 +536,7 @@ ssize_t psock_ieee802154_sendto(FAR struct socket *psock, FAR const void *buf,
psock->s_flags = _SS_SETSTATE(psock->s_flags, _SF_IDLE); psock->s_flags = _SS_SETSTATE(psock->s_flags, _SF_IDLE);
/* Check for a errors, Errors are signalled by negative errno values /* Check for a errors, Errors are signaled by negative errno values
* for the send length * for the send length
*/ */
......
...@@ -47,10 +47,11 @@ ...@@ -47,10 +47,11 @@
#include <errno.h> #include <errno.h>
#include <debug.h> #include <debug.h>
#include <socket/socket.h>
#include <netpacket/ieee802154.h>
#include <nuttx/net/net.h> #include <nuttx/net/net.h>
#include <nuttx/net/radiodev.h> #include <nuttx/net/radiodev.h>
#include <netpacket/packet.h>
#include <socket/socket.h>
#include "ieee802154/ieee802154.h" #include "ieee802154/ieee802154.h"
...@@ -270,9 +271,42 @@ static void ieee802154_addref(FAR struct socket *psock) ...@@ -270,9 +271,42 @@ static void ieee802154_addref(FAR struct socket *psock)
****************************************************************************/ ****************************************************************************/
static int ieee802154_connect(FAR struct socket *psock, static int ieee802154_connect(FAR struct socket *psock,
FAR const struct sockaddr *addr, socklen_t addrlen) FAR const struct sockaddr *addr,
socklen_t addrlen)
{ {
return -EAFNOSUPPORT; FAR struct ieee802154_conn_s *conn;
FAR struct sockaddr_ieee802154_s *ieeeaddr;
int ret;
DEBUGASSERT(psock != NULL || addr != NULL);
conn = (FAR struct ieee802154_conn_s *)psock->s_conn;
DEBUGASSERT(conn != NULL);
/* Verify the address family */
if (addr->sa_family == AF_IEEE802154)
{
/* Save the "connection" address */
ieeeaddr = (FAR struct sockaddr_ieee802154_s *)addr;
memcpy(&conn->raddr, &ieeeaddr->sa_addr,
sizeof(struct ieee802154_saddr_s));
/* Mark the socket as connected. */
psock->s_flags |= _SF_CONNECTED;
ret = OK;
}
else
{
/* The specified address is not a valid address for the address family
* of the specified socket.
*/
ret = -EAFNOSUPPORT;
}
return ret;
} }
/**************************************************************************** /****************************************************************************
...@@ -362,7 +396,7 @@ static int ieee802154_bind(FAR struct socket *psock, ...@@ -362,7 +396,7 @@ static int ieee802154_bind(FAR struct socket *psock,
addrlen < sizeof(struct sockaddr_ieee802154_s)) addrlen < sizeof(struct sockaddr_ieee802154_s))
{ {
nerr("ERROR: Invalid family: %u or address length: %d < %d\n", nerr("ERROR: Invalid family: %u or address length: %d < %d\n",
addr->sa_family, addrlen, sizeof(struct sockaddr_ll)); addr->sa_family, addrlen, sizeof(struct sockaddr_ieee802154_s));
return -EBADF; return -EBADF;
} }
...@@ -459,7 +493,7 @@ static int ieee802154_getsockname(FAR struct socket *psock, ...@@ -459,7 +493,7 @@ static int ieee802154_getsockname(FAR struct socket *psock,
/* Create a copy of the full address on the stack */ /* Create a copy of the full address on the stack */
tmp.sa_family = PF_IEEE802154; tmp.sa_family = AF_IEEE802154;
memcpy(&tmp.sa_addr, &conn->laddr, sizeof(struct ieee802154_saddr_s)); memcpy(&tmp.sa_addr, &conn->laddr, sizeof(struct ieee802154_saddr_s));
/* Copy to the user buffer, truncating if necessary */ /* Copy to the user buffer, truncating if necessary */
...@@ -573,7 +607,7 @@ static ssize_t ieee802154_send(FAR struct socket *psock, FAR const void *buf, ...@@ -573,7 +607,7 @@ static ssize_t ieee802154_send(FAR struct socket *psock, FAR const void *buf,
if (psock->s_type == SOCK_DGRAM) if (psock->s_type == SOCK_DGRAM)
{ {
/* send() may be used only if the socket is has been connected. */ /* send() may be used only if the socket has been connected. */
if (!_SS_ISCONNECTED( psock->s_flags) || if (!_SS_ISCONNECTED( psock->s_flags) ||
conn->raddr.s_mode == IEEE802154_ADDRMODE_NONE) conn->raddr.s_mode == IEEE802154_ADDRMODE_NONE)
...@@ -582,7 +616,7 @@ static ssize_t ieee802154_send(FAR struct socket *psock, FAR const void *buf, ...@@ -582,7 +616,7 @@ static ssize_t ieee802154_send(FAR struct socket *psock, FAR const void *buf,
} }
else else
{ {
to.sa_family = PF_IEEE802154; to.sa_family = AF_IEEE802154;
memcpy(&to.sa_addr, &conn->raddr, memcpy(&to.sa_addr, &conn->raddr,
sizeof(struct ieee802154_saddr_s)); sizeof(struct ieee802154_saddr_s));
......
/**************************************************************************** /****************************************************************************
* net/net_initialize.c * net/net_initialize.c
* *
* Copyright (C) 2007-2009, 2011-2015, 2017 Gregory Nutt. All rights reserved. * Copyright (C) 2007-2009, 2011-2015, 2017-2018 Gregory Nutt. All rights
* reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -56,6 +57,7 @@ ...@@ -56,6 +57,7 @@
#include "tcp/tcp.h" #include "tcp/tcp.h"
#include "udp/udp.h" #include "udp/udp.h"
#include "pkt/pkt.h" #include "pkt/pkt.h"
#include "bluetooth/bluetooth.h"
#include "ieee802154/ieee802154.h" #include "ieee802154/ieee802154.h"
#include "local/local.h" #include "local/local.h"
#include "igmp/igmp.h" #include "igmp/igmp.h"
...@@ -140,6 +142,12 @@ void net_setup(void) ...@@ -140,6 +142,12 @@ void net_setup(void)
icmpv6_sock_initialize(); icmpv6_sock_initialize();
#endif #endif
#ifdef CONFIG_NET_BLUETOOTH
/* Initialize Bluetooth socket support */
bluetooth_initialize();
#endif
#ifdef CONFIG_NET_IEEE802154 #ifdef CONFIG_NET_IEEE802154
/* Initialize IEEE 802.15.4 socket support */ /* Initialize IEEE 802.15.4 socket support */
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -115,7 +115,7 @@ struct udp_conn_s ...@@ -115,7 +115,7 @@ struct udp_conn_s
struct iob_queue_s readahead; /* Read-ahead buffering */ struct iob_queue_s readahead; /* Read-ahead buffering */
#endif #endif
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS #ifdef CONFIG_NET_UDP_WRITE_BUFFERS
/* Write buffering /* Write buffering
* *
* write_q - The queue of unsent I/O buffers. The head of this * write_q - The queue of unsent I/O buffers. The head of this
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.