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)
82 #define ICMPV6_ERROR_DST_UNR_NO_ROUTE (0)
83 #define ICMPV6_ERROR_DST_UNR_PROHIB (1)
86 #define ICMPV6_ERROR_DST_UNR_SCOPE (2)
87 #define ICMPV6_ERROR_DST_UNR_ADDR (3)
88 #define ICMPV6_ERROR_DST_UNR_PORT (4)
89 #define ICMPV6_ERROR_DST_UNR_POLICY (5)
91 #define ICMPV6_ERROR_DST_UNR_REJECT (6)
104 #define ICMPV6_ERROR_TIME_EXC_HL (0)
105 #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;
138  network_uint16_t csum;
139 } icmpv6_hdr_t;
140 
149 typedef struct __attribute__((packed)) {
150  uint8_t type;
151  uint8_t code;
152  network_uint16_t csum;
153  network_uint32_t unused;
164 typedef struct __attribute__((packed)) {
165  uint8_t type;
166  uint8_t code;
167  network_uint16_t csum;
168  network_uint32_t mtu;
179 typedef struct __attribute__((packed)) {
180  uint8_t type;
181  uint8_t code;
182  network_uint16_t csum;
183  network_uint32_t unused;
194 typedef struct __attribute__((packed)) {
195  uint8_t type;
196  uint8_t code;
197  network_uint16_t csum;
198  network_uint32_t ptr;
212 typedef struct __attribute__((packed)) {
213  uint8_t type;
214  uint8_t code;
215  network_uint16_t csum;
216  network_uint16_t id;
217  network_uint16_t seq;
225 void icmpv6_hdr_print(icmpv6_hdr_t *hdr);
226 
227 #ifdef __cplusplus
228 }
229 #endif
230 
231 #endif /* NET_ICMPV6_H */
232 
A 32 bit integer in big endian aka network byte order.
Definition: byteorder.h:86
A 16 bit integer in big endian aka network byte order.
Definition: byteorder.h:76
void icmpv6_hdr_print(icmpv6_hdr_t *hdr)
Print the given ICMPv6 header to STDOUT.
Echo request and response message format.
Definition: icmpv6.h:218
Time exceeded message format.
Definition: icmpv6.h:185
Functions to work with different byte orders.
Parameter problem message format.
Definition: icmpv6.h:200
General ICMPv6 message format.
Definition: icmpv6.h:141
Destination unreachable message format.
Definition: icmpv6.h:155
Packet too big message format.
Definition: icmpv6.h:170