Rev 4719 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 4719 | Rev 4728 | ||
|---|---|---|---|
| Line 30... | Line 30... | ||
| 30 | * @{ |
30 | * @{ |
| 31 | */ |
31 | */ |
| 32 | 32 | ||
| 33 | /** @file |
33 | /** @file |
| 34 | * ICMP header definition. |
34 | * ICMP header definition. |
| 35 | * Names according to the linux src/include/linux/icmp.h header file. |
35 | * Based on the RFC~792. |
| 36 | */ |
36 | */ |
| 37 | 37 | ||
| 38 | #ifndef __NET_ICMP_HEADER_H__ |
38 | #ifndef __NET_ICMP_HEADER_H__ |
| 39 | #define __NET_ICMP_HEADER_H__ |
39 | #define __NET_ICMP_HEADER_H__ |
| 40 | 40 | ||
| Line 56... | Line 56... | ||
| 56 | /** Echo specific data. |
56 | /** Echo specific data. |
| 57 | */ |
57 | */ |
| 58 | struct icmp_echo{ |
58 | struct icmp_echo{ |
| 59 | /** Message idintifier. |
59 | /** Message idintifier. |
| 60 | */ |
60 | */ |
| 61 | icmp_param_t id; |
61 | icmp_param_t identifier; |
| 62 | /** Message sequence number. |
62 | /** Message sequence number. |
| 63 | */ |
63 | */ |
| 64 | icmp_param_t sequence; |
64 | icmp_param_t sequence_number; |
| 65 | } __attribute__ ((packed)); |
65 | } __attribute__ ((packed)); |
| 66 | 66 | ||
| 67 | /** Type definition of the internet control message header. |
67 | /** Type definition of the internet control message header. |
| 68 | * @see icmp_header |
68 | * @see icmp_header |
| 69 | */ |
69 | */ |
| Line 75... | Line 75... | ||
| 75 | typedef icmp_header_t * icmp_header_ref; |
75 | typedef icmp_header_t * icmp_header_ref; |
| 76 | 76 | ||
| 77 | /** Internet control message header. |
77 | /** Internet control message header. |
| 78 | */ |
78 | */ |
| 79 | struct icmp_header{ |
79 | struct icmp_header{ |
| 80 | /** Specifies the type of the message. |
80 | /** The type of the message. |
| 81 | */ |
81 | */ |
| 82 | uint8_t type; |
82 | uint8_t type; |
| 83 | /** Contains the error code for the datagram reported by this ICMP message. |
83 | /** The error code for the datagram reported by the ICMP message. |
| 84 | * The interpretation is dependent on the message type. |
84 | * The interpretation is dependent on the message type. |
| 85 | */ |
85 | */ |
| 86 | uint8_t code; |
86 | uint8_t code; |
| 87 | /** Contains the checksum for the ICMP message starting with the ICMP Type field. |
87 | /** The checksum is the 16-bit ones's complement of the one's complement sum of the ICMP message starting with the ICMP Type. |
| - | 88 | * For computing the checksum, the checksum field should be zero. |
|
| 88 | * If the checksum does not match the contents, the datagram is discarded. |
89 | * If the checksum does not match the contents, the datagram is discarded. |
| 89 | */ |
90 | */ |
| 90 | uint16_t checksum; |
91 | uint16_t checksum; |
| 91 | /** Message specific data. |
92 | /** Message specific data. |
| 92 | */ |
93 | */ |
| Line 98... | Line 99... | ||
| 98 | */ |
99 | */ |
| 99 | in_addr_t gateway; |
100 | in_addr_t gateway; |
| 100 | /** Fragmentation needed specific data. |
101 | /** Fragmentation needed specific data. |
| 101 | */ |
102 | */ |
| 102 | struct{ |
103 | struct{ |
| 103 | /** Unused field. |
104 | /** Reserved field. |
| - | 105 | * Must be zero. |
|
| 104 | */ |
106 | */ |
| 105 | icmp_param_t _unused; |
107 | icmp_param_t reserved; |
| 106 | /** Proposed MTU. |
108 | /** Proposed MTU. |
| 107 | */ |
109 | */ |
| 108 | icmp_param_t mtu; |
110 | icmp_param_t mtu; |
| 109 | } frag; |
111 | } frag; |
| 110 | /** Parameter problem specific data. |
112 | /** Parameter problem specific data. |
| 111 | */ |
113 | */ |
| 112 | struct{ |
114 | struct{ |
| 113 | /** Problem pointer. |
115 | /** Problem pointer. |
| 114 | */ |
116 | */ |
| 115 | icmp_param_t pointer; |
117 | icmp_param_t pointer; |
| 116 | /** Unused field. |
118 | /** Reserved field. |
| - | 119 | * Must be zero. |
|
| 117 | */ |
120 | */ |
| 118 | icmp_param_t _unused; |
121 | icmp_param_t reserved; |
| 119 | } param; |
122 | } param; |
| 120 | } un; |
123 | } un; |
| 121 | } __attribute__ ((packed)); |
124 | } __attribute__ ((packed)); |
| 122 | 125 | ||
| 123 | #endif |
126 | #endif |