summaryrefslogtreecommitdiff
path: root/src/net/ethernet.h
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2017-08-02 18:26:23 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2017-08-02 18:26:23 +0200
commitdb1f6609d13a888dd7212c9ed2840846e70a284e (patch)
treee8a4c777bb5feafda1a50feb9c6280a36d0a0dfb /src/net/ethernet.h
parent7d40548496f4d3cdfce828fc8e4f0fd4286e873a (diff)
downloadabaos-db1f6609d13a888dd7212c9ed2840846e70a284e.tar.gz
abaos-db1f6609d13a888dd7212c9ed2840846e70a284e.tar.bz2
added an IPv4 module, currently containg an address to string function
started to add ARP packet definition, reading and printing ARP request now some renames in networking layer
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