diff options
Diffstat (limited to 'src/macaddr.c')
-rw-r--r-- | src/macaddr.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/macaddr.c b/src/macaddr.c index a6e1304a..f83e0546 100644 --- a/src/macaddr.c +++ b/src/macaddr.c @@ -20,12 +20,24 @@ * */ +/*! \addtogroup utils + * @{ + */ + +/*! \file loggingrb.c */ + #include <stdint.h> #include <string.h> #include <stdlib.h> #include <unistd.h> - +/*! \brief Parse a MAC address from human-readable notation + * This function parses an ethernet MAC address in the commonly-used + * hex/colon notation (00:00:00:00:00:00) and generates the binary + * representation from it. + * \param[out] out pointer to caller-allocated buffer of 6 bytes + * \param[in] in pointer to input data as string with hex/colon notation + */ int osmo_macaddr_parse(uint8_t *out, const char *in) { /* 00:00:00:00:00:00 */ @@ -54,7 +66,11 @@ int osmo_macaddr_parse(uint8_t *out, const char *in) #include <net/if_dl.h> #include <net/if_types.h> - +/*! \brief Obtain the MAC address of a given network device + * \param[out] mac_out pointer to caller-allocated buffer of 6 bytes + * \param[in] dev_name string name of the network device + * \returns 0 in case of success; negative otherwise + */ int osmo_get_macaddr(uint8_t *mac_out, const char *dev_name) { int rc = -1; @@ -92,6 +108,11 @@ int osmo_get_macaddr(uint8_t *mac_out, const char *dev_name) #include <netinet/in.h> #include <netinet/ip.h> +/*! \brief Obtain the MAC address of a given network device + * \param[out] mac_out pointer to caller-allocated buffer of 6 bytes + * \param[in] dev_name string name of the network device + * \returns 0 in case of success; negative otherwise + */ int osmo_get_macaddr(uint8_t *mac_out, const char *dev_name) { int fd, rc; @@ -114,3 +135,5 @@ int osmo_get_macaddr(uint8_t *mac_out, const char *dev_name) return 0; } #endif + +/*! @} */ |