-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathicmp.h
More file actions
28 lines (24 loc) · 723 Bytes
/
Copy pathicmp.h
File metadata and controls
28 lines (24 loc) · 723 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#ifndef __ICMP_H__
#define __ICMP_H__
#define ICMP_ECHO_REPLY 0x00
#define ICMP_DST_UNREACHABLE 0x03
// #define ICMP_SRC_QUENCH 0x04
// #define ICMP_REDIRECT 0x05
#define ICMP_ECHO_REQUEST 0x08
// #define ICMP_ROUTER_ADV 0x09
// #define ICMP_ROUTER_SOL 0x0a
// #define ICMP_TIMEOUT 0x0b
// #define ICMP_MALFORMED 0x0c
struct icmp_hdr {
uint8_t type;
uint8_t code;
uint16_t csum;
uint16_t id;
uint16_t seq;
};
void icmp_debug(struct ip_hdr *iph);
void icmp_rx(struct ip_hdr *iph);
void icmp_tx_reply(struct ip_hdr *rx_iph);
void icmp_tx_request(uint8_t *daddr, uint16_t seq);
void icmp_listen(void (*callback)(struct ip_hdr *iph, struct icmp_hdr *icmph));
#endif