summaryrefslogtreecommitdiff
path: root/libhw_generic
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-12-08 08:28:16 -0700
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-12-08 08:28:16 -0700
commit96a751d8a5d20b2acea5ae8d10ac3d051466c2c3 (patch)
tree1ce291df34d78acd6f1619a779abbd4f06134e26 /libhw_generic
parentafe6542b30def82573e070371281c05dc593a739 (diff)
parentb9ebe41358244caa9334e72ca4e3c8c7a14c86e7 (diff)
Merge commit 'b9ebe41358244caa9334e72ca4e3c8c7a14c86e7'
Diffstat (limited to 'libhw_generic')
-rw-r--r--libhw_generic/include/libhw/generic/net.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/libhw_generic/include/libhw/generic/net.h b/libhw_generic/include/libhw/generic/net.h
index 150d199..a016d51 100644
--- a/libhw_generic/include/libhw/generic/net.h
+++ b/libhw_generic/include/libhw/generic/net.h
@@ -7,6 +7,7 @@
#ifndef _LIBHW_GENERIC_NET_H_
#define _LIBHW_GENERIC_NET_H_
+#include <inttypes.h> /* for PRI{u,x}{n} */
#include <stdbool.h> /* for bool */
#include <stddef.h> /* for size_t */
#include <stdint.h> /* for uint{n}_t} */
@@ -31,10 +32,24 @@ struct net_ip4_addr {
static const struct net_ip4_addr net_ip4_addr_broadcast = {{255, 255, 255, 255}};
static const struct net_ip4_addr net_ip4_addr_zero = {{0, 0, 0, 0}};
+#define PRI_net_ip4_addr "%"PRIu8".%"PRIu8".%"PRIu8".%"PRIu8
+#define ARG_net_ip4_addr(addr) (addr).octets[0], \
+ (addr).octets[1], \
+ (addr).octets[2], \
+ (addr).octets[3]
+
struct net_eth_addr {
unsigned char octets[6];
};
+#define PRI_net_eth_addr "%02"PRIx8":%02"PRIx8":%02"PRIx8":%02"PRIx8":%02"PRIx8":%02"PRIx8
+#define ARG_net_eth_addr(addr) (addr).octets[0], \
+ (addr).octets[1], \
+ (addr).octets[2], \
+ (addr).octets[3], \
+ (addr).octets[4], \
+ (addr).octets[5]
+
/* Streams (e.g. TCP) *********************************************************/
struct net_stream_listener_vtable;