[riot-devel] Network API task force

Martine Lenders authmillenon at gmail.com
Fri May 8 11:45:56 CEST 2015


Hi Kaspar,

2015-05-08 11:32 GMT+02:00 Kaspar Schleiser <kaspar at schleiser.de>:

> Hey,
>
> On 05/08/15 11:29, Martine Lenders wrote:
> >> On 05/08/15 11:14, Martine Lenders wrote:
> >>> Actually, yes. But I'm still trying to get my head around why netapi
> (or
> >>> it's wrapper functions [1], slightly renamed) could not be that API.
> >>
> >> Because it requires the use of messages, which implicitly requires using
> >> seperate threads. This is not feasable for low-memory systems.
> >
> > That's why I've put the emphasis on the wrapper functions of netapi.
> Where can I find them? They're not in the header you cited?
>

Of course they are:

/**
 * @brief Shortcut function for sending @ref NG_NETAPI_MSG_TYPE_SND messages
 *
 * @param[in] pid PID of the targeted network module
 * @param[in] pkt pointer into the packet buffer holding the data to send
 *
 * @return 1 if packet was successfully delivered
 * @return -1 on error (invalid PID or no space in queue)
 */
int ng_netapi_send(kernel_pid_t pid, ng_pktsnip_t *pkt);

/**
 * @brief Shortcut function for sending @ref NG_NETAPI_MSG_TYPE_RCV messages
 *
 * @param[in] pid PID of the targeted network module
 * @param[in] pkt pointer into the packet buffer holding the received data
 *
 * @return 1 if packet was successfully delivered
 * @return -1 on error (invalid PID or no space in queue)
 */
int ng_netapi_receive(kernel_pid_t pid, ng_pktsnip_t *pkt);

/**
 * @brief Shortcut function for sending @ref NG_NETAPI_MSG_TYPE_GET
messages and
 * parsing the returned @ref NG_NETAPI_MSG_TYPE_ACK message
 *
 * @param[in] pid PID of the targeted network module
 * @param[in] opt option to get
 * @param[in] context (optional) context to the given option
 * @param[in] data pointer to buffer for reading the option's value
 * @param[in] max_len maximum number of bytes that fit into @p data
 *
 * @return value returned by the @ref NG_NETAPI_MSG_TYPE_ACK message
 */
int ng_netapi_get(kernel_pid_t pid, ng_netconf_opt_t opt, uint16_t context,
                  void *data, size_t max_len);

/**
 * @brief Shortcut function for sending @ref NG_NETAPI_MSG_TYPE_SET
messages and
 * parsing the returned @ref NG_NETAPI_MSG_TYPE_ACK message
 *
 * @param[in] pid PID of the targeted network module
 * @param[in] opt option to set
 * @param[in] context (optional) context to the given option
 * @param[in] data data to set the given option to
 * @param[in] data_len size of @p data
 *
 * @return value returned by the @ref NG_NETAPI_MSG_TYPE_ACK message
 */
int ng_netapi_set(kernel_pid_t pid, ng_netconf_opt_t opt, uint16_t context,
                  void *data, size_t data_len);

Cheers,
Martine
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/devel/attachments/20150508/f750ad2a/attachment-0001.html>


More information about the devel mailing list