summaryrefslogtreecommitdiff
path: root/src/user/app/ethdump/proto.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/user/app/ethdump/proto.h')
-rw-r--r--src/user/app/ethdump/proto.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/user/app/ethdump/proto.h b/src/user/app/ethdump/proto.h
index f47ca53..df2000e 100644
--- a/src/user/app/ethdump/proto.h
+++ b/src/user/app/ethdump/proto.h
@@ -3,6 +3,7 @@
#include <stdint.h>
typedef uint8_t mac_t[6];
+static const mac_t MAC_BROADCAST = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
extern struct net_state {
mac_t mac;
@@ -21,10 +22,27 @@ struct ethernet {
uint16_t type;
};
+struct ipv4 {
+ struct ethernet e;
+ uint32_t src, dst;
+ uint8_t proto;
+};
+
+struct icmp {
+ struct ipv4 ip;
+ uint8_t type, code;
+};
+
void arp_parse(const uint8_t *buf, size_t len);
-void icmp_parse(const uint8_t *buf, size_t len);
-void ipv4_parse(const uint8_t *buf, size_t len);
+
+void icmp_parse(const uint8_t *buf, size_t len, struct ipv4 ip);
+uint8_t *icmp_start(size_t len, struct icmp i);
+void icmp_finish(uint8_t *pkt);
+
+void ipv4_parse(const uint8_t *buf, size_t len, struct ethernet ether);
+uint8_t *ipv4_start(size_t len, struct ipv4 ip);
+void ipv4_finish(uint8_t *pkt);
void ether_parse(const uint8_t *buf, size_t len);
uint8_t *ether_start(size_t len, struct ethernet ether);