2018-03-27 21:51:58 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2018 Freie Universität Berlin
|
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
|
|
* directory for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* Implements @ref net_netif for @ref net_gnrc
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @author Martine Lenders <m.lenders@fu-berlin.de>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "fmt.h"
|
|
|
|
#include "net/gnrc/netapi.h"
|
|
|
|
#include "net/gnrc/netif/internal.h"
|
|
|
|
|
|
|
|
#include "net/netif.h"
|
|
|
|
|
2019-07-22 13:35:52 +02:00
|
|
|
int netif_get_name(netif_t *iface, char *name)
|
2018-03-27 21:51:58 +02:00
|
|
|
{
|
2019-07-22 13:35:52 +02:00
|
|
|
gnrc_netif_t *netif = (gnrc_netif_t*) iface;
|
2018-03-27 21:51:58 +02:00
|
|
|
|
|
|
|
int res = 0;
|
2019-07-22 13:35:52 +02:00
|
|
|
res += fmt_u16_dec(&name[res], netif->pid);
|
|
|
|
name[res] = '\0';
|
2018-03-27 21:51:58 +02:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2019-07-22 13:35:52 +02:00
|
|
|
int netif_get_opt(netif_t *netif, netopt_t opt, uint16_t context,
|
2018-03-27 21:51:58 +02:00
|
|
|
void *value, size_t max_len)
|
|
|
|
{
|
2019-07-22 13:35:52 +02:00
|
|
|
gnrc_netif_t *iface = (gnrc_netif_t*) netif;
|
|
|
|
return gnrc_netapi_get(iface->pid, opt, context, value, max_len);
|
2018-03-27 21:51:58 +02:00
|
|
|
}
|
|
|
|
|
2019-07-22 13:35:52 +02:00
|
|
|
int netif_set_opt(netif_t *netif, netopt_t opt, uint16_t context,
|
2018-03-27 21:51:58 +02:00
|
|
|
void *value, size_t value_len)
|
|
|
|
{
|
2019-07-22 13:35:52 +02:00
|
|
|
gnrc_netif_t *iface = (gnrc_netif_t*) netif;
|
|
|
|
return gnrc_netapi_set(iface->pid, opt, context, value, value_len);
|
2018-03-27 21:51:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/** @} */
|