2017-08-19 16:48:52 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* net/ieee802154/ieee802154.h
|
|
|
|
*
|
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
|
2017-08-19 16:48:52 +02:00
|
|
|
*
|
2021-02-19 12:45:37 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2017-08-19 16:48:52 +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.
|
2017-08-19 16:48:52 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef _NET_IEEE802154_IEEE802154_H
|
|
|
|
#define _NET_IEEE802154_IEEE802154_H
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <queue.h>
|
|
|
|
#include <netpacket/ieee802154.h>
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_IEEE802154
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/* Allocate a new IEEE 802.15.4 socket data callback */
|
|
|
|
|
|
|
|
#define ieee802154_callback_alloc(dev,conn) \
|
net/devif/devif_callback.c: corrected the connection event list to work as FIFO instead of LIFO.
In case of enabled packet forwarding mode, packets were forwarded in a reverse order
because of LIFO behavior of the connection event list.
The issue exposed only during high network traffic. Thus the event list started to grow
that resulted in changing the order of packets inside of groups of several packets
like the following: 3, 2, 1, 6, 5, 4, 8, 7 etc.
Remarks concerning the connection event list implementation:
* Now the queue (list) is FIFO as it should be.
* The list is singly linked.
* The list has a head pointer (inside of outer net_driver_s structure),
and a tail pointer is added into outer net_driver_s structure.
* The list item is devif_callback_s structure.
It still has two pointers to two different list chains (*nxtconn and *nxtdev).
* As before the first argument (*dev) of the list functions can be NULL,
while the other argument (*list) is effective (not NULL).
* An extra (*tail) argument is added to devif_callback_alloc()
and devif_conn_callback_free() functions.
* devif_callback_alloc() time complexity is O(1) (i.e. O(n) to fill the whole list).
* devif_callback_free() time complexity is O(n) (i.e. O(n^2) to empty the whole list).
* devif_conn_event() time complexity is O(n).
2021-08-29 22:57:26 +02:00
|
|
|
devif_callback_alloc(dev, &conn->list, &conn->list_tail)
|
2017-08-19 16:48:52 +02:00
|
|
|
#define ieee802154_callback_free(dev,conn,cb) \
|
net/devif/devif_callback.c: corrected the connection event list to work as FIFO instead of LIFO.
In case of enabled packet forwarding mode, packets were forwarded in a reverse order
because of LIFO behavior of the connection event list.
The issue exposed only during high network traffic. Thus the event list started to grow
that resulted in changing the order of packets inside of groups of several packets
like the following: 3, 2, 1, 6, 5, 4, 8, 7 etc.
Remarks concerning the connection event list implementation:
* Now the queue (list) is FIFO as it should be.
* The list is singly linked.
* The list has a head pointer (inside of outer net_driver_s structure),
and a tail pointer is added into outer net_driver_s structure.
* The list item is devif_callback_s structure.
It still has two pointers to two different list chains (*nxtconn and *nxtdev).
* As before the first argument (*dev) of the list functions can be NULL,
while the other argument (*list) is effective (not NULL).
* An extra (*tail) argument is added to devif_callback_alloc()
and devif_conn_callback_free() functions.
* devif_callback_alloc() time complexity is O(1) (i.e. O(n) to fill the whole list).
* devif_callback_free() time complexity is O(n) (i.e. O(n^2) to empty the whole list).
* devif_conn_event() time complexity is O(n).
2021-08-29 22:57:26 +02:00
|
|
|
devif_conn_callback_free(dev, cb, &conn->list, &conn->list_tail)
|
2017-08-19 16:48:52 +02:00
|
|
|
|
2017-08-20 02:50:50 +02:00
|
|
|
/* Memory Pools */
|
|
|
|
|
|
|
|
#define IEEE802154_POOL_PREALLOCATED 0
|
|
|
|
#define IEEE802154_POOL_DYNAMIC 1
|
|
|
|
|
2017-08-20 15:10:48 +02:00
|
|
|
/* Frame size */
|
|
|
|
|
2018-03-30 19:33:21 +02:00
|
|
|
/* This maximum size of an IEEE 802.15.4 frame. Certain, non-standard
|
2017-08-20 15:10:48 +02:00
|
|
|
* devices may exceed this value, however.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define IEEE802154_MAC_STDFRAME 127
|
|
|
|
|
|
|
|
/* Space for a two byte FCS must be reserved at the end of the frame */
|
|
|
|
|
|
|
|
#define IEEE802154_MAC_FCSSIZE 2
|
|
|
|
|
2017-09-10 19:40:54 +02:00
|
|
|
/* This, then, is the usable size of the frame... */
|
2017-08-20 19:14:43 +02:00
|
|
|
|
2017-09-10 19:40:54 +02:00
|
|
|
#if defined(CONFIG_NET_IEEE802154_FRAMELEN)
|
2017-08-20 19:14:43 +02:00
|
|
|
# define IEEE802_MAX_FRAMELEN CONFIG_NET_IEEE802154_FRAMELEN
|
|
|
|
#else
|
|
|
|
# define IEEE802_MAX_FRAMELEN IEEE802154_MAC_STDFRAME
|
|
|
|
#endif
|
2017-08-20 15:10:48 +02:00
|
|
|
|
2017-08-20 19:14:43 +02:00
|
|
|
#define IEEE802154_FRAMELEN (IEEE802_MAX_FRAMELEN - IEEE802154_MAC_FCSSIZE)
|
2017-08-20 15:10:48 +02:00
|
|
|
|
2017-08-19 16:48:52 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Type Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
2017-08-20 02:50:50 +02:00
|
|
|
/* Used for containing and queuing IOBs along with information about the
|
|
|
|
* source of the frame.
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct iob_s; /* Forward reference */
|
|
|
|
|
|
|
|
struct ieee802154_container_s
|
|
|
|
{
|
|
|
|
FAR struct ieee802154_container_s *ic_flink; /* Supports a singly linked list */
|
|
|
|
struct ieee802154_saddr_s ic_src; /* Source of the packet */
|
|
|
|
FAR struct iob_s *ic_iob; /* Contained IOB */
|
|
|
|
uint8_t ic_pool; /* See IEEE802154_POOL_* definitions */
|
|
|
|
};
|
|
|
|
|
2017-08-19 16:48:52 +02:00
|
|
|
/* Representation of a IEEE 802.15.4 socket connection */
|
|
|
|
|
2017-08-20 02:50:50 +02:00
|
|
|
struct devif_callback_s; /* Forward reference */
|
2017-08-19 16:48:52 +02:00
|
|
|
|
|
|
|
struct ieee802154_conn_s
|
|
|
|
{
|
2019-09-01 16:47:01 +02:00
|
|
|
/* Common prologue of all connection structures. */
|
|
|
|
|
2017-08-20 02:50:50 +02:00
|
|
|
dq_entry_t node; /* Supports a double linked list */
|
2019-09-01 16:47:01 +02:00
|
|
|
|
|
|
|
/* This is a list of IEEE 802.15.4 callbacks. Each callback represents
|
|
|
|
* a thread that is stalled, waiting for a device-specific event.
|
|
|
|
*/
|
|
|
|
|
|
|
|
FAR struct devif_callback_s *list;
|
net/devif/devif_callback.c: corrected the connection event list to work as FIFO instead of LIFO.
In case of enabled packet forwarding mode, packets were forwarded in a reverse order
because of LIFO behavior of the connection event list.
The issue exposed only during high network traffic. Thus the event list started to grow
that resulted in changing the order of packets inside of groups of several packets
like the following: 3, 2, 1, 6, 5, 4, 8, 7 etc.
Remarks concerning the connection event list implementation:
* Now the queue (list) is FIFO as it should be.
* The list is singly linked.
* The list has a head pointer (inside of outer net_driver_s structure),
and a tail pointer is added into outer net_driver_s structure.
* The list item is devif_callback_s structure.
It still has two pointers to two different list chains (*nxtconn and *nxtdev).
* As before the first argument (*dev) of the list functions can be NULL,
while the other argument (*list) is effective (not NULL).
* An extra (*tail) argument is added to devif_callback_alloc()
and devif_conn_callback_free() functions.
* devif_callback_alloc() time complexity is O(1) (i.e. O(n) to fill the whole list).
* devif_callback_free() time complexity is O(n) (i.e. O(n^2) to empty the whole list).
* devif_conn_event() time complexity is O(n).
2021-08-29 22:57:26 +02:00
|
|
|
FAR struct devif_callback_s *list_tail;
|
2019-09-01 16:47:01 +02:00
|
|
|
|
|
|
|
/* IEEE 802.15.4-specific content follows */
|
|
|
|
|
2017-08-20 02:50:50 +02:00
|
|
|
struct ieee802154_saddr_s laddr; /* Locally bound / source address */
|
|
|
|
struct ieee802154_saddr_s raddr; /* Connected remote address */
|
|
|
|
uint8_t crefs; /* Reference counts on this instance */
|
2017-08-21 15:52:43 +02:00
|
|
|
#if CONFIG_NET_IEEE802154_BACKLOG > 0
|
|
|
|
uint8_t backlog; /* Number of frames in RX queue */
|
|
|
|
#endif
|
2017-08-20 02:50:50 +02:00
|
|
|
|
2017-08-21 15:52:43 +02:00
|
|
|
/* Queue of incoming packets */
|
2017-08-20 02:50:50 +02:00
|
|
|
|
|
|
|
FAR struct ieee802154_container_s *rxhead;
|
|
|
|
FAR struct ieee802154_container_s *rxtail;
|
2017-08-19 16:48:52 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Data
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
# define EXTERN extern "C"
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#else
|
|
|
|
# define EXTERN extern
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* The IEEE 802.15.4 socket interface */
|
|
|
|
|
|
|
|
EXTERN const struct sock_intf_s g_ieee802154_sockif;
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Function Prototypes
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
struct ieee802154_data_ind_s; /* Forward reference */
|
2017-08-20 15:10:48 +02:00
|
|
|
struct radio_driver_s; /* Forward reference */
|
2017-08-19 16:48:52 +02:00
|
|
|
struct net_driver_s; /* Forward reference */
|
|
|
|
struct socket; /* Forward reference */
|
|
|
|
struct sockaddr; /* Forward reference */
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: ieee802154_initialize()
|
|
|
|
*
|
|
|
|
* Description:
|
2017-08-20 02:50:50 +02:00
|
|
|
* Initialize the IEEE 802.15.4 socket support. Called once and only
|
|
|
|
* from the network initialization logic.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* Called early in the initialization sequence
|
2017-08-19 16:48:52 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
void ieee802154_initialize(void);
|
|
|
|
|
|
|
|
/****************************************************************************
|
2017-08-20 02:50:50 +02:00
|
|
|
* Name: ieee802154_conn_initialize
|
|
|
|
*
|
|
|
|
* Description:
|
2018-03-30 19:33:21 +02:00
|
|
|
* Initialize the IEEE 802.15.4 connection structure allocator. Called
|
2017-08-20 02:50:50 +02:00
|
|
|
* once and only from ieee802154_initialize().
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* Called early in the initialization sequence
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
void ieee802154_conn_initialize(void);
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: ieee802154_conn_alloc()
|
2017-08-19 16:48:52 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Allocate a new, uninitialized IEEE 802.15.4 socket connection
|
|
|
|
* structure. This is normally something done by the implementation of
|
|
|
|
* the socket() API
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2017-08-20 02:50:50 +02:00
|
|
|
FAR struct ieee802154_conn_s *ieee802154_conn_alloc(void);
|
2017-08-19 16:48:52 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
2017-08-20 02:50:50 +02:00
|
|
|
* Name: ieee802154_conn_free()
|
2017-08-19 16:48:52 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Free a IEEE 802.15.4 socket connection structure that is no longer in
|
|
|
|
* use. This should be done by the implementation of close().
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2017-08-20 02:50:50 +02:00
|
|
|
void ieee802154_conn_free(FAR struct ieee802154_conn_s *conn);
|
2017-08-19 16:48:52 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
2017-08-20 02:50:50 +02:00
|
|
|
* Name: ieee802154_conn_active()
|
2017-08-19 16:48:52 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Find a connection structure that is the appropriate
|
|
|
|
* connection to be used with the provided Ethernet header
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* This function is called from network logic at with the network locked.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
FAR struct ieee802154_conn_s *
|
2017-08-20 02:50:50 +02:00
|
|
|
ieee802154_conn_active(FAR const struct ieee802154_data_ind_s *meta);
|
2017-08-19 16:48:52 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
2017-08-20 02:50:50 +02:00
|
|
|
* Name: ieee802154_conn_next()
|
2017-08-19 16:48:52 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Traverse the list of allocated IEEE 802.15.4 connections
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* This function is called from network logic at with the network locked.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
FAR struct ieee802154_conn_s *
|
2017-08-20 02:50:50 +02:00
|
|
|
ieee802154_conn_next(FAR struct ieee802154_conn_s *conn);
|
2017-08-19 16:48:52 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: ieee802154_input
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Handle incoming IEEE 802.15.4 input
|
|
|
|
*
|
|
|
|
* This function is called when the radio device driver has received an
|
|
|
|
* frame from the network. The frame from the device driver must be
|
|
|
|
* provided in by the IOB frame argument of the function call:
|
|
|
|
*
|
|
|
|
* - The frame data is in the IOB io_data[] buffer,
|
|
|
|
* - The length of the frame is in the IOB io_len field, and
|
|
|
|
* - The offset past and radio MAC header is provided in the io_offset
|
|
|
|
* field.
|
|
|
|
*
|
|
|
|
* The frame argument may refer to a single frame (a list of length one)
|
|
|
|
* or may it be the head of a list of multiple frames.
|
|
|
|
*
|
|
|
|
* - The io_flink field points to the next frame in the list (if enable)
|
|
|
|
* - The last frame in the list will have io_flink == NULL.
|
|
|
|
*
|
2018-03-13 16:52:27 +01:00
|
|
|
* Input Parameters:
|
2017-08-19 16:48:52 +02:00
|
|
|
* radio The radio network driver interface.
|
|
|
|
* framelist - The head of an incoming list of frames. Normally this
|
|
|
|
* would be a single frame. A list may be provided if
|
|
|
|
* appropriate, however.
|
|
|
|
* meta - Meta data characterizing the received frame.
|
|
|
|
*
|
|
|
|
* If there are multilple frames in the list, this metadata
|
|
|
|
* must apply to all of the frames in the list.
|
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Returned Value:
|
2017-08-19 16:48:52 +02:00
|
|
|
* OK The IEEE 802.15.4 has been processed and can be deleted
|
|
|
|
* ERROR Hold the IEEE 802.15.4 and try again later. There is a listening
|
|
|
|
* socket but no recv in place to catch the IEEE 802.15.4 yet.
|
|
|
|
* Useful when a packet arrives before a recv call is in place.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* Called from the network diver with the network locked.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/* ieee802154_input() is prototyped in include/nuttx/net/ieee802154.h */
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: ieee802154_callback
|
|
|
|
*
|
|
|
|
* Description:
|
2021-02-19 15:01:46 +01:00
|
|
|
* Inform the application holding the IEEE 802.15.4 socket of a change in
|
|
|
|
* state.
|
2017-08-19 16:48:52 +02:00
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* OK if IEEE 802.15.4 has been processed, otherwise ERROR.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* This function is called from network logic at with the network locked.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
uint16_t ieee802154_callback(FAR struct radio_driver_s *radio,
|
|
|
|
FAR struct ieee802154_conn_s *conn,
|
|
|
|
uint16_t flags);
|
|
|
|
|
|
|
|
/****************************************************************************
|
2020-12-01 07:55:16 +01:00
|
|
|
* Name: ieee802154_recvmsg
|
2017-08-19 16:48:52 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Implements the socket recvfrom interface for the case of the AF_INET
|
2020-12-01 07:55:16 +01:00
|
|
|
* and AF_INET6 address families. ieee802154_recvmsg() receives messages
|
2021-02-19 15:01:46 +01:00
|
|
|
* from a socket, and may be used to receive data on a socket whether or
|
|
|
|
* not it is connection-oriented.
|
2017-08-19 16:48:52 +02:00
|
|
|
*
|
2020-12-01 07:55:16 +01:00
|
|
|
* If msg_name is not NULL, and the underlying protocol provides the source
|
|
|
|
* address, this source address is filled in. The argument 'msg_namelen' is
|
|
|
|
* initialized to the size of the buffer associated with msg_name, and
|
2017-08-19 16:48:52 +02:00
|
|
|
* modified on return to indicate the actual size of the address stored
|
|
|
|
* there.
|
|
|
|
*
|
2018-03-13 16:52:27 +01:00
|
|
|
* Input Parameters:
|
2017-08-19 16:48:52 +02:00
|
|
|
* psock A pointer to a NuttX-specific, internal socket structure
|
2020-12-01 07:55:16 +01:00
|
|
|
* msg Buffer to receive the message
|
2017-08-19 16:48:52 +02:00
|
|
|
* flags Receive flags
|
|
|
|
*
|
|
|
|
* Returned Value:
|
2020-12-01 07:55:16 +01:00
|
|
|
* On success, returns the number of characters received. If no data is
|
2017-08-19 16:48:52 +02:00
|
|
|
* available to be received and the peer has performed an orderly shutdown,
|
2020-12-01 07:55:16 +01:00
|
|
|
* recvmsg() will return 0. Otherwise, on errors, a negated errno value is
|
|
|
|
* returned (see recvmsg() for the list of appropriate error values).
|
2017-08-19 16:48:52 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2020-12-01 07:55:16 +01:00
|
|
|
ssize_t ieee802154_recvmsg(FAR struct socket *psock, FAR struct msghdr *msg,
|
|
|
|
int flags);
|
2017-08-19 16:48:52 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: ieee802154_find_device
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Select the network driver to use with the IEEE802154 transaction.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* conn - IEEE802154 connection structure (not currently used).
|
|
|
|
* addr - The address to match the devices assigned address
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* A pointer to the network driver to use. NULL is returned on any
|
|
|
|
* failure.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
FAR struct radio_driver_s *
|
|
|
|
ieee802154_find_device(FAR struct ieee802154_conn_s *conn,
|
|
|
|
FAR const struct ieee802154_saddr_s *addr);
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: ieee802154_poll
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Poll a IEEE 802.15.4 "connection" structure for availability of TX data
|
|
|
|
*
|
2018-03-13 16:52:27 +01:00
|
|
|
* Input Parameters:
|
2017-08-19 16:48:52 +02:00
|
|
|
* dev - The device driver structure to use in the send operation
|
|
|
|
* conn - The IEEE 802.15.4 "connection" to poll for TX data
|
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Returned Value:
|
2017-08-19 16:48:52 +02:00
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* Called from the network device interface (devif) with the network
|
|
|
|
* locked.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
void ieee802154_poll(FAR struct net_driver_s *dev,
|
|
|
|
FAR struct ieee802154_conn_s *conn);
|
|
|
|
|
|
|
|
/****************************************************************************
|
2020-12-01 07:55:16 +01:00
|
|
|
* Name: ieee802154_sendmsg
|
2017-08-19 16:48:52 +02:00
|
|
|
*
|
|
|
|
* Description:
|
2020-12-01 07:55:16 +01:00
|
|
|
* If sendmsg() is used on a connection-mode (SOCK_STREAM, SOCK_SEQPACKET)
|
|
|
|
* socket, the parameters 'msg_name' and 'msg_namelen' are ignored (and the
|
|
|
|
* error EISCONN may be returned when they are not NULL and 0), and the
|
|
|
|
* error ENOTCONN is returned when the socket was not actually connected.
|
2017-08-19 16:48:52 +02:00
|
|
|
*
|
2018-03-13 16:52:27 +01:00
|
|
|
* Input Parameters:
|
2020-12-01 07:55:16 +01:00
|
|
|
* psock An instance of the internal socket structure.
|
|
|
|
* msg Message to send
|
2017-08-19 16:48:52 +02:00
|
|
|
* flags Send flags
|
|
|
|
*
|
|
|
|
* Returned Value:
|
2020-12-01 07:55:16 +01:00
|
|
|
* On success, returns the number of characters sent. On error, a negated
|
|
|
|
* errno value is returned (see sendmsg() for the complete list of return
|
|
|
|
* values.
|
2017-08-19 16:48:52 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2020-12-01 07:55:16 +01:00
|
|
|
ssize_t ieee802154_sendmsg(FAR struct socket *psock, FAR struct msghdr *msg,
|
|
|
|
int flags);
|
2017-08-19 16:48:52 +02:00
|
|
|
|
2017-08-20 02:50:50 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: ieee802154_container_initialize
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* This function initializes the container allocator. This function must
|
|
|
|
* be called early in the initialization sequence before any socket
|
|
|
|
* activity.
|
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Input Parameters:
|
2017-08-20 02:50:50 +02:00
|
|
|
* None
|
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Returned Value:
|
2017-08-20 02:50:50 +02:00
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* Called early in the initialization sequence
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
void ieee802154_container_initialize(void);
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: ieee802154_container_allocate
|
|
|
|
*
|
|
|
|
* Description:
|
2020-02-14 15:50:45 +01:00
|
|
|
* The ieee802154_container_allocate function will get a free container
|
2017-08-20 02:50:50 +02:00
|
|
|
* for use by the recvfrom() logic.
|
|
|
|
*
|
|
|
|
* This function will first attempt to allocate from the g_free_container
|
|
|
|
* list. If that the list is empty, then the meta-data structure will be
|
|
|
|
* allocated from the dynamic memory pool.
|
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Input Parameters:
|
2017-08-20 02:50:50 +02:00
|
|
|
* None
|
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Returned Value:
|
2021-02-19 15:01:46 +01:00
|
|
|
* A reference to the allocated container structure. All user fields in
|
|
|
|
* this structure have been zeroed. On a failure to allocate, NULL is
|
2017-08-20 02:50:50 +02:00
|
|
|
* returned.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* The caller has locked the network.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
FAR struct ieee802154_container_s *ieee802154_container_allocate(void);
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: ieee802154_container_free
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* The ieee802154_container_free function will return a container structure
|
|
|
|
* to the free list of containers if it was a pre-allocated container
|
|
|
|
* structure. If the container structure was allocated dynamically it will
|
|
|
|
* be deallocated.
|
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Input Parameters:
|
2017-08-20 02:50:50 +02:00
|
|
|
* container - container structure to free
|
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Returned Value:
|
2017-08-20 02:50:50 +02:00
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* The caller has locked the network.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
void ieee802154_container_free(FAR struct ieee802154_container_s *container);
|
|
|
|
|
2017-08-19 16:48:52 +02:00
|
|
|
#undef EXTERN
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* CONFIG_NET_IEEE802154 */
|
|
|
|
#endif /* _NET_IEEE802154_IEEE802154_H */
|