icmpv6.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Martine Lenders <mlenders@inf.fu-berlin.de>
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
23 #ifndef NET_ICMPV6_H
24 #define NET_ICMPV6_H
25 
26 #include <stdint.h>
27 
28 #include "byteorder.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
41 #define ICMPV6_DST_UNR (1)
42 #define ICMPV6_PKT_TOO_BIG (2)
43 #define ICMPV6_TIME_EXC (3)
44 #define ICMPV6_PARAM_PROB (4)
45 #define ICMPV6_ERR_EXP1 (100)
46 #define ICMPV6_ERR_EXP2 (101)
58 #define ICMPV6_ECHO_REQ (128)
59 #define ICMPV6_ECHO_REP (129)
60 #define ICMPV6_RTR_SOL (133)
61 #define ICMPV6_RTR_ADV (134)
62 #define ICMPV6_NBR_SOL (135)
63 #define ICMPV6_NBR_ADV (136)
64 #define ICMPV6_REDIRECT (137)
65 #define ICMPV6_RPL_CTRL (155)
66 #define ICMPV6_DAR (157)
67 #define ICMPV6_DAC (158)
68 #define ICMPV6_INF_EXP1 (200)
69 #define ICMPV6_INF_EXP2 (201)
83 #define ICMPV6_ERROR_DST_UNR_NO_ROUTE (0)
84 #define ICMPV6_ERROR_DST_UNR_PROHIB (1)
87 #define ICMPV6_ERROR_DST_UNR_SCOPE (2)
88 #define ICMPV6_ERROR_DST_UNR_ADDR (3)
89 #define ICMPV6_ERROR_DST_UNR_PORT (4)
90 #define ICMPV6_ERROR_DST_UNR_POLICY (5)
92 #define ICMPV6_ERROR_DST_UNR_REJECT (6)
106 #define ICMPV6_ERROR_TIME_EXC_HL (0)
107 #define ICMPV6_ERROR_TIME_EXC_FRAG (1)
121 #define ICMPV6_ERROR_PARAM_PROB_HDR_FIELD (0)
123 #define ICMPV6_ERROR_PARAM_PROB_NH (1)
125 #define ICMPV6_ERROR_PARAM_PROB_OPT (2)
138 typedef struct __attribute__((packed)) {
139  uint8_t type;
140  uint8_t code;
142 } icmpv6_hdr_t;
143 
152 typedef struct __attribute__((packed)) {
153  uint8_t type;
154  uint8_t code;
158 
167 typedef struct __attribute__((packed)) {
168  uint8_t type;
169  uint8_t code;
173 
182 typedef struct __attribute__((packed)) {
183  uint8_t type;
184  uint8_t code;
188 
197 typedef struct __attribute__((packed)) {
198  uint8_t type;
199  uint8_t code;
203 
215 typedef struct __attribute__((packed)) {
216  uint8_t type;
217  uint8_t code;
221 } icmpv6_echo_t;
222 
228 void icmpv6_hdr_print(icmpv6_hdr_t *hdr);
229 
230 #ifdef __cplusplus
231 }
232 #endif
233 
234 #endif /* NET_ICMPV6_H */
235 
icmpv6_echo_t::seq
network_uint16_t seq
Sequence number.
Definition: icmpv6.h:220
icmpv6_error_time_exc_t::unused
network_uint32_t unused
unused field
Definition: icmpv6.h:186
icmpv6_error_dst_unr_t
Destination unreachable message format.
Definition: icmpv6.h:152
be_uint32_t
A 32 bit integer in big endian aka network byte order.
Definition: byteorder.h:87
icmpv6_error_pkt_too_big_t::csum
network_uint16_t csum
checksum
Definition: icmpv6.h:170
byteorder.h
Functions to work with different byte orders.
be_uint16_t
A 16 bit integer in big endian aka network byte order.
Definition: byteorder.h:77
icmpv6_error_pkt_too_big_t::code
uint8_t code
message code
Definition: icmpv6.h:169
icmpv6_hdr_t::csum
network_uint16_t csum
checksum
Definition: icmpv6.h:141
icmpv6_error_dst_unr_t::type
uint8_t type
message type
Definition: icmpv6.h:153
icmpv6_echo_t::csum
network_uint16_t csum
checksum
Definition: icmpv6.h:218
icmpv6_hdr_t::type
uint8_t type
message type
Definition: icmpv6.h:139
icmpv6_error_dst_unr_t::csum
network_uint16_t csum
checksum
Definition: icmpv6.h:155
icmpv6_error_pkt_too_big_t::type
uint8_t type
message type
Definition: icmpv6.h:168
icmpv6_echo_t::type
uint8_t type
message type
Definition: icmpv6.h:216
icmpv6_error_pkt_too_big_t::mtu
network_uint32_t mtu
MTU.
Definition: icmpv6.h:171
icmpv6_error_time_exc_t::csum
network_uint16_t csum
checksum
Definition: icmpv6.h:185
icmpv6_error_time_exc_t::code
uint8_t code
message code
Definition: icmpv6.h:184
icmpv6_hdr_t
General ICMPv6 message format.
Definition: icmpv6.h:138
icmpv6_error_pkt_too_big_t
Packet too big message format.
Definition: icmpv6.h:167
icmpv6_error_param_prob_t::csum
network_uint16_t csum
checksum
Definition: icmpv6.h:200
icmpv6_error_dst_unr_t::unused
network_uint32_t unused
unused field
Definition: icmpv6.h:156
icmpv6_hdr_t::code
uint8_t code
message code
Definition: icmpv6.h:140
icmpv6_error_param_prob_t::type
uint8_t type
message type
Definition: icmpv6.h:198
icmpv6_error_time_exc_t::type
uint8_t type
message type
Definition: icmpv6.h:183
icmpv6_error_time_exc_t
Time exceeded message format.
Definition: icmpv6.h:182
icmpv6_error_dst_unr_t::code
uint8_t code
message code
Definition: icmpv6.h:154
icmpv6_error_param_prob_t
Parameter problem message format.
Definition: icmpv6.h:197
icmpv6_error_param_prob_t::ptr
network_uint32_t ptr
pointer
Definition: icmpv6.h:201
icmpv6_hdr_print
void icmpv6_hdr_print(icmpv6_hdr_t *hdr)
Print the given ICMPv6 header to STDOUT.
icmpv6_echo_t::id
network_uint16_t id
identifier
Definition: icmpv6.h:219
icmpv6_error_param_prob_t::code
uint8_t code
message code
Definition: icmpv6.h:199
icmpv6_echo_t::code
uint8_t code
message code
Definition: icmpv6.h:217
icmpv6_echo_t
Echo request and response message format.
Definition: icmpv6.h:215