Structure to store MAC address and associated functions.
More...
#include <stdint.h>
#include <stdio.h>
#include <inttypes.h>
#include <string.h>
#include "inline.h"
Go to the source code of this file.
Structure to store MAC address and associated functions.
- Author
- Jiri Havranek havra.nosp@m.ji6@.nosp@m.fit.c.nosp@m.vut..nosp@m.cz
- Date
- 2017
Definition in file macaddr.h.
◆ MAC_ADD_FORMAT_PRI
◆ MAC_ADD_FORMAT_SCN
◆ MAC_STR_LEN
◆ PRIx8
◆ SCNx8
◆ __attribute__()
struct __attribute__ |
( |
(packed) |
| ) |
|
Structure containing MAC address bytes.
Definition at line 73 of file macaddr.h.
◆ mac_cmp()
Compare two MAC addresses.
- Parameters
-
[in] | addr1 | MAC address as mac_addr_t |
[in] | addr2 | MAC address as mac_addr_t |
- Returns
- Positive number (>0) if addr1 > addr2, negative number (<0) if addr1 < addr2, and zero (=0) if addr1 == addr2.
Definition at line 118 of file macaddr.h.
◆ mac_from_bytes()
Convert 6B array into mac_addr_t.
- Parameters
-
[in] | array | 6B array containing MAC address bytes. |
- Returns
- MAC address stored as mac_addr_t.
Definition at line 83 of file macaddr.h.
◆ mac_from_str()
Convert string into mac_addr_t.
- Parameters
-
[in] | str | String for conversion. |
[out] | addr | Pointer to memory where to store MAC address. |
- Returns
- 1 on success, 0 on error i.e. string is not a valid MAC address.
Definition at line 99 of file macaddr.h.
◆ mac_to_bytes()
Convert mac_addr_t into bytes array.
- Parameters
-
[in] | addr | Pointer to MAC address. |
[out] | array | Pointer to memory where to store MAC address bytes. It must be of at least 6B size. |
Definition at line 144 of file macaddr.h.
◆ mac_to_str()
Convert mac_addr_t into string.
- Parameters
-
[in] | addr | Pointer to MAC address. |
[out] | str | Pointer to memory where to store converted MAC address. It must be of at least MAC_STR_LEN size. |
Definition at line 129 of file macaddr.h.
◆ mac_addr_t