Add rtems_bsd_get_ethernet_addr()

This commit is contained in:
Sebastian Huber
2014-01-20 13:09:13 +01:00
parent c1bdbab18c
commit c50f1b42fe
4 changed files with 97 additions and 0 deletions

View File

@@ -32,10 +32,31 @@
#ifndef _RTEMS_BSD_UTIL_H_
#define _RTEMS_BSD_UTIL_H_
#include <sys/types.h>
#include <net/ethernet.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* @brief Gets the Ethernet address of an interface identified by its name.
*
* This function uses getifaddrs(). The interface type is not checked, so it
* is only safe to use this function for Ethernet type interfaces.
*
* @param[in] ifname The name of the interface.
* @parma[out] eaddr The Ethernet address of this interface.
*
* @retval 0 Successful operation.
* @retval -1 An error occurred. The errno is set to indicate the error.
*/
int
rtems_bsd_get_ethernet_addr(const char *ifname, uint8_t eaddr[ETHER_ADDR_LEN]);
#ifdef __cplusplus
}
#endif /* __cplusplus */