diff --git a/sys/include/net/ng_netapi.h b/sys/include/net/ng_netapi.h index 12d4c7de9a3ffa910bad5e039aad4ba2c0ee99ae..2bd01938e2d7b3b838cdb321dcffa1ee0f727185 100644 --- a/sys/include/net/ng_netapi.h +++ b/sys/include/net/ng_netapi.h @@ -91,12 +91,12 @@ int ng_netapi_send(kernel_pid_t pid, ng_pktsnip_t *pkt); * @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] data_len size of the given buffer + * @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 data_len); + void *data, size_t max_len); /** * @brief Shortcut function for sending @ref NG_NETAPI_MSG_TYPE_SET messages and diff --git a/sys/include/net/ng_netdev.h b/sys/include/net/ng_netdev.h index 24147e87e5c431540347ff31c9c3cca520070283..563b485fe6e53eaaf1703f1c4b35bacccd391ee8 100644 --- a/sys/include/net/ng_netdev.h +++ b/sys/include/net/ng_netdev.h @@ -115,17 +115,17 @@ typedef struct { * @param[in] dev network device descriptor * @param[in] opt option type * @param[out] value pointer to store the option's value in - * @param[in,out] value_len the length of @p value. Must be initialized to - * the available space in @p value on call. + * @param[in] max_len maximal amount of byte that fit into @p value * - * @return 0 on success + * @return number of bytes written to @p value * @return -ENODEV if @p dev is invalid * @return -ENOTSUP if @p opt is not supported * @return -EOVERFLOW if available space in @p value given in - * @p value_len is too small to store the option value + * @p max_len is too small to store the option value + * @return -ECANCELED if internal driver error occurred */ int (*get)(ng_netdev_t *dev, ng_netconf_opt_t opt, - void *value, size_t *value_len); + void *value, size_t max_len); /** * @brief Set an option value for a given network device @@ -135,10 +135,11 @@ typedef struct { * @param[in] value value to set * @param[in] value_len the length of @p value * - * @return 0 on success + * @return number of bytes used from @p value * @return -ENODEV if @p dev is invalid * @return -ENOTSUP if @p opt is not supported * @return -EINVAL if @p value is invalid + * @return -ECANCELED if internal driver error occurred */ int (*set)(ng_netdev_t *dev, ng_netconf_opt_t opt, void *value, size_t value_len); diff --git a/sys/net/link_layer/ng_nomac/ng_nomac.c b/sys/net/link_layer/ng_nomac/ng_nomac.c index e20fa77b26a2dbcacd350fd2e0226ebd0299adb4..e236093c3819c6dfa91e6e65fe684297aa02a0da 100644 --- a/sys/net/link_layer/ng_nomac/ng_nomac.c +++ b/sys/net/link_layer/ng_nomac/ng_nomac.c @@ -110,6 +110,7 @@ static void *_nomac_thread(void *args) opt = (ng_netapi_opt_t *)msg.content.ptr; /* set option for device driver */ res = dev->driver->set(dev, opt->opt, opt->data, opt->data_len); + DEBUG("nomac: response of netdev->set: %i\n", res); /* send reply to calling thread */ reply.type = NG_NETAPI_MSG_TYPE_ACK; reply.content.value = (uint32_t)res; @@ -122,8 +123,8 @@ static void *_nomac_thread(void *args) /* read incoming options */ opt = (ng_netapi_opt_t *)msg.content.ptr; /* get option from device driver */ - res = dev->driver->get(dev, opt->opt, opt->data, - (size_t*)(&(opt->data_len))); + res = dev->driver->get(dev, opt->opt, opt->data, opt->data_len); + DEBUG("nomac: response of netdev->get: %i\n", res); /* send reply to calling thread */ reply.type = NG_NETAPI_MSG_TYPE_ACK; reply.content.value = (uint32_t)res;