diff options
author | Sayed Shah <sayshah@redhat.com> | 2020-08-20 07:43:05 -0400 |
---|---|---|
committer | Sayed Shah <sayshah@redhat.com> | 2020-08-20 13:27:32 -0400 |
commit | f5db085cd30ab34e099e9ab171cb220a0d0c9830 (patch) | |
tree | cab822ef5893ce1999a1daf4148fc79ec75b38fb | |
parent | e1e1241aaebb70870240765579dcf969486c8c2f (diff) | |
download | NetworkManager-f5db085cd30ab34e099e9ab171cb220a0d0c9830.tar.gz |
shared: add a struct and definition for MAC address
This is a shared util which adds an array of 6 bytes and also add define statements
for how to format the MAC address
-rw-r--r-- | shared/nm-glib-aux/nm-shared-utils.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/shared/nm-glib-aux/nm-shared-utils.h b/shared/nm-glib-aux/nm-shared-utils.h index f9c76d880e..7efb8aed52 100644 --- a/shared/nm-glib-aux/nm-shared-utils.h +++ b/shared/nm-glib-aux/nm-shared-utils.h @@ -69,6 +69,14 @@ G_STATIC_ASSERT (sizeof (int) == sizeof (gint32)); /*****************************************************************************/ typedef struct { + guint8 ether_addr_octet[6 /*ETH_ALEN*/]; +} NMEtherAddr; + +#define NM_ETHER_ADDR_FORMAT_STR "%02X:%02X:%02X:%02X:%02X:%02X" +#define NM_ETHER_ADDR_FORMAT_VAL(x) (x).ether_addr_octet[0], (x).ether_addr_octet[1], (x).ether_addr_octet[2], (x).ether_addr_octet[3], (x).ether_addr_octet[4], (x).ether_addr_octet[5] +#define NM_ETHER_ADDR_INIT(...) { .ether_addr_octet = { __VA_ARGS__ }, } + +typedef struct { union { guint8 addr_ptr[1]; in_addr_t addr4; |