summaryrefslogtreecommitdiff
path: root/src/net/ethernet.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/ethernet.h')
-rw-r--r--src/net/ethernet.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/net/ethernet.h b/src/net/ethernet.h
index a2726e7..faeddf5 100644
--- a/src/net/ethernet.h
+++ b/src/net/ethernet.h
@@ -5,14 +5,18 @@
#define NETWORK_ETHERNET_MAC_ADDR_STRING 6 * 3 + 1
+// hardware_address_len
+#define NETWORK_HARDWARE_ETHERNET_ADDRESS_LENGTH 6
+
typedef struct {
- uint8_t byte[6];
+ uint8_t byte[NETWORK_HARDWARE_ETHERNET_ADDRESS_LENGTH];
} network_mac_address_t;
-typedef uint16_t ether_type_t;
+typedef uint16_t network_ether_type_t;
// TODO: network order not host oder, so for now swap it
-#define NETWORK_ETHER_TYPE_ARP 0x0608
+#define NETWORK_ETHER_PROTOCOL_TYPE_ARP (network_ether_type_t)0x0608
+#define NETWORK_ETHER_PROTOCOL_TYPE_IPV4 (network_ether_type_t)0x0008
#if defined( __TINYC__ )
#pragma pack(1)
@@ -21,7 +25,7 @@ typedef uint16_t ether_type_t;
typedef struct {
network_mac_address_t dst_addr;
network_mac_address_t src_addr;
- ether_type_t type;
+ network_ether_type_t type;
} __attribute__( ( packed ) ) network_ethernet_packet_header_t;
typedef struct {
@@ -33,6 +37,6 @@ typedef struct {
#pragma pack()
#endif
-char *network_mac_to_string( network_mac_address_t mac, char *buf, size_t buflen );
+char *network_mac_address_to_string( network_mac_address_t mac, char *buf, size_t buflen );
#endif // ETHERNET_H