icmpv6.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2015 Martine Lenders <mlenders@inf.fu-berlin.de>
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
23 #include <stdint.h>
24 
25 #include "byteorder.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
38 #define ICMPV6_DST_UNR (1)
39 #define ICMPV6_PKT_TOO_BIG (2)
40 #define ICMPV6_TIME_EXC (3)
41 #define ICMPV6_PARAM_PROB (4)
42 #define ICMPV6_ERR_EXP1 (100)
43 #define ICMPV6_ERR_EXP2 (101)
55 #define ICMPV6_ECHO_REQ (128)
56 #define ICMPV6_ECHO_REP (129)
57 #define ICMPV6_RTR_SOL (133)
58 #define ICMPV6_RTR_ADV (134)
59 #define ICMPV6_NBR_SOL (135)
60 #define ICMPV6_NBR_ADV (136)
61 #define ICMPV6_REDIRECT (137)
62 #define ICMPV6_RPL_CTRL (155)
63 #define ICMPV6_DAR (157)
64 #define ICMPV6_DAC (158)
65 #define ICMPV6_INF_EXP1 (200)
66 #define ICMPV6_INF_EXP2 (201)
80 #define ICMPV6_ERROR_DST_UNR_NO_ROUTE (0)
81 #define ICMPV6_ERROR_DST_UNR_PROHIB (1)
84 #define ICMPV6_ERROR_DST_UNR_SCOPE (2)
85 #define ICMPV6_ERROR_DST_UNR_ADDR (3)
86 #define ICMPV6_ERROR_DST_UNR_PORT (4)
87 #define ICMPV6_ERROR_DST_UNR_POLICY (5)
89 #define ICMPV6_ERROR_DST_UNR_REJECT (6)
103 #define ICMPV6_ERROR_TIME_EXC_HL (0)
104 #define ICMPV6_ERROR_TIME_EXC_FRAG (1)
118 #define ICMPV6_ERROR_PARAM_PROB_HDR_FIELD (0)
120 #define ICMPV6_ERROR_PARAM_PROB_NH (1)
122 #define ICMPV6_ERROR_PARAM_PROB_OPT (2)
135 typedef struct __attribute__((packed)) {
136  uint8_t type;
137  uint8_t code;
139 } icmpv6_hdr_t;
140 
149 typedef struct __attribute__((packed)) {
150  uint8_t type;
151  uint8_t code;
155 
164 typedef struct __attribute__((packed)) {
165  uint8_t type;
166  uint8_t code;
170 
179 typedef struct __attribute__((packed)) {
180  uint8_t type;
181  uint8_t code;
185 
194 typedef struct __attribute__((packed)) {
195  uint8_t type;
196  uint8_t code;
200 
212 typedef struct __attribute__((packed)) {
213  uint8_t type;
214  uint8_t code;
218 } icmpv6_echo_t;
219 
226 
227 #ifdef __cplusplus
228 }
229 #endif
230 
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:212
uint8_t type
message type
Definition: icmpv6.h:213
uint8_t code
message code
Definition: icmpv6.h:214
network_uint16_t id
identifier
Definition: icmpv6.h:216
network_uint16_t csum
checksum
Definition: icmpv6.h:215
network_uint16_t seq
Sequence number.
Definition: icmpv6.h:217
Destination unreachable message format.
Definition: icmpv6.h:149
network_uint16_t csum
checksum
Definition: icmpv6.h:152
uint8_t code
message code
Definition: icmpv6.h:151
uint8_t type
message type
Definition: icmpv6.h:150
network_uint32_t unused
unused field
Definition: icmpv6.h:153
Parameter problem message format.
Definition: icmpv6.h:194
uint8_t type
message type
Definition: icmpv6.h:195
uint8_t code
message code
Definition: icmpv6.h:196
network_uint32_t ptr
pointer
Definition: icmpv6.h:198
network_uint16_t csum
checksum
Definition: icmpv6.h:197
Packet too big message format.
Definition: icmpv6.h:164
uint8_t code
message code
Definition: icmpv6.h:166
uint8_t type
message type
Definition: icmpv6.h:165
network_uint16_t csum
checksum
Definition: icmpv6.h:167
network_uint32_t mtu
MTU.
Definition: icmpv6.h:168
Time exceeded message format.
Definition: icmpv6.h:179
network_uint32_t unused
unused field
Definition: icmpv6.h:183
uint8_t type
message type
Definition: icmpv6.h:180
uint8_t code
message code
Definition: icmpv6.h:181
network_uint16_t csum
checksum
Definition: icmpv6.h:182
General ICMPv6 message format.
Definition: icmpv6.h:135
network_uint16_t csum
checksum
Definition: icmpv6.h:138
uint8_t type
message type
Definition: icmpv6.h:136
uint8_t code
message code
Definition: icmpv6.h:137
A 16 bit integer in big endian aka network byte order.
Definition: byteorder.h:70
A 32 bit integer in big endian aka network byte order.
Definition: byteorder.h:80