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;
141  network_uint16_t csum;
142 } icmpv6_hdr_t;
143 
152 typedef struct __attribute__((packed)) {
153  uint8_t type;
154  uint8_t code;
155  network_uint16_t csum;
156  network_uint32_t unused;
167 typedef struct __attribute__((packed)) {
168  uint8_t type;
169  uint8_t code;
170  network_uint16_t csum;
171  network_uint32_t mtu;
182 typedef struct __attribute__((packed)) {
183  uint8_t type;
184  uint8_t code;
185  network_uint16_t csum;
186  network_uint32_t unused;
197 typedef struct __attribute__((packed)) {
198  uint8_t type;
199  uint8_t code;
200  network_uint16_t csum;
201  network_uint32_t ptr;
215 typedef struct __attribute__((packed)) {
216  uint8_t type;
217  uint8_t code;
218  network_uint16_t csum;
219  network_uint16_t id;
220  network_uint16_t seq;
228 void icmpv6_hdr_print(icmpv6_hdr_t *hdr);
229 
230 #ifdef __cplusplus
231 }
232 #endif
233 
234 #endif /* NET_ICMPV6_H */
235 
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:221
Time exceeded message format.
Definition: icmpv6.h:188
Functions to work with different byte orders.
Parameter problem message format.
Definition: icmpv6.h:203
General ICMPv6 message format.
Definition: icmpv6.h:144
Destination unreachable message format.
Definition: icmpv6.h:158
Packet too big message format.
Definition: icmpv6.h:173