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 
229 
230 #ifdef __cplusplus
231 }
232 #endif
233 
234 #endif /* NET_ICMPV6_H */
Functions to work with different byte orders.
void icmpv6_hdr_print(icmpv6_hdr_t *hdr)
Print the given ICMPv6 header to STDOUT.
Echo request and response message format.
Definition: icmpv6.h:215
uint8_t type
message type
Definition: icmpv6.h:216
uint8_t code
message code
Definition: icmpv6.h:217
network_uint16_t id
identifier
Definition: icmpv6.h:219
network_uint16_t csum
checksum
Definition: icmpv6.h:218
network_uint16_t seq
Sequence number.
Definition: icmpv6.h:220
Destination unreachable message format.
Definition: icmpv6.h:152
network_uint16_t csum
checksum
Definition: icmpv6.h:155
uint8_t code
message code
Definition: icmpv6.h:154
uint8_t type
message type
Definition: icmpv6.h:153
network_uint32_t unused
unused field
Definition: icmpv6.h:156
Parameter problem message format.
Definition: icmpv6.h:197
uint8_t type
message type
Definition: icmpv6.h:198
uint8_t code
message code
Definition: icmpv6.h:199
network_uint32_t ptr
pointer
Definition: icmpv6.h:201
network_uint16_t csum
checksum
Definition: icmpv6.h:200
Packet too big message format.
Definition: icmpv6.h:167
uint8_t code
message code
Definition: icmpv6.h:169
uint8_t type
message type
Definition: icmpv6.h:168
network_uint16_t csum
checksum
Definition: icmpv6.h:170
network_uint32_t mtu
MTU.
Definition: icmpv6.h:171
Time exceeded message format.
Definition: icmpv6.h:182
network_uint32_t unused
unused field
Definition: icmpv6.h:186
uint8_t type
message type
Definition: icmpv6.h:183
uint8_t code
message code
Definition: icmpv6.h:184
network_uint16_t csum
checksum
Definition: icmpv6.h:185
General ICMPv6 message format.
Definition: icmpv6.h:138
network_uint16_t csum
checksum
Definition: icmpv6.h:141
uint8_t type
message type
Definition: icmpv6.h:139
uint8_t code
message code
Definition: icmpv6.h:140
A 16 bit integer in big endian aka network byte order.
Definition: byteorder.h:77
A 32 bit integer in big endian aka network byte order.
Definition: byteorder.h:87