Click
Loading...
Searching...
No Matches
icmp6.h
1/* -*- c-basic-offset: 4 -*- */
2#ifndef CLICKNET_ICMP6_H
3#define CLICKNET_ICMP6_H
4#include <clicknet/ip6.h>
5
6/*
7 * <clicknet/icmp6.h> -- our own definitions for ICMP6 packets
8 * Based on RFC 1885
9 */
10
11/* types for ICMP6 packets */
12#define ICMP6_UNREACH 1
13#define ICMP6_PKTTOOBIG 2
14#define ICMP6_TIMXCEED 3
15#define ICMP6_PARAMPROB 4
16
17#define ICMP6_ECHO 128
18#define ICMP6_ECHOREPLY 129
19#define ICMP6_MEMBERSHIPQUERY 130
20#define ICMP6_MEMBERSHIPREPORT 131
21#define ICMP6_MEMBERSHIPREDUCTION 132
22
23#define ICMP6_REDIRECT 137
24
25/* codes for spefic types of ICMP6 packets */
26/* ICMP6 Error Message - Type: 1 */
27#define ICMP6_UNREACH_NOROUTE 0
28#define ICMP6_UNREACH_ADMIN 1
29#define ICMP6_UNREACH_NOTNEIGHBOR 2
30#define ICMP6_UNREACH_ADDR 3
31#define ICMP6_UNREACH_NOPORT 4
32
33/* ICMP6 Time Exceeded Message - Type: 3 */
34#define ICMP6_TIMXCEED_TRANSIT 0
35#define ICMP6_TIMXCEED_REASSEMBLY 1
36
37/* ICMP6 Parameter Problem Message - Type: 4 */
38#define ICMP6_PARAMPROB_HEADER 0
39#define ICMP6_PARAMPROB_NEXTHEADER 1
40#define ICMP6_PARAMPROB_OPTION 2
41
42/* remove possible definitions for symbols */
43#undef icmp6_identifier
44#undef icmp6_sequence
45#undef icmp6_pointer
46#undef icmp6_maxdelay
47
48
49/* most ICMP6 request types */
50struct click_icmp6 {
51 uint8_t icmp6_type; /* one of the ICMP6_TYPE_*'s above */
52 uint8_t icmp6_code; /* one of the ICMP6_CODE_*'s above */
53 uint16_t icmp6_cksum; /* 16 1's comp csum */
54 uint32_t padding; /* should be zero */
55 /* followed by as much of invoking packet as will fit without the ICMPv6 packet exceeding 576 octets*/
56};
57
58/* packet too big header */
59struct click_icmp6_pkttoobig {
60 uint8_t icmp6_type; /* one of the ICMP6_TYPE_*'s above */
61 uint8_t icmp6_code; /* one of the ICMP6_CODE_*'s above */
62 uint16_t icmp6_cksum; /* 16 1's comp csum */
63 uint32_t icmp6_mtusize; /* maximum packet size */
64 /* followed by as much of invoking packet as will fit without the ICMPv6 packet exceeding 576 octets*/
65};
66
67/* parameter problem header */
68struct click_icmp6_paramprob {
69 uint8_t icmp6_type; /* one of the ICMP_TYPE_*'s above */
70 uint8_t icmp6_code; /* one of the ICMP6_CODE_*'s above */
71 uint16_t icmp6_cksum; /* 16 1's comp csum */
72 uint32_t icmp6_pointer; /* which octect in orig. IP6 pkt was a problem */
73 /* followed by as much of invoking packet as will fit without the ICMPv6 packet exceeding 576 octets*/
74};
75
76
77/* struct for things with sequence numbers - echo request & echo reply msgs*/
78struct click_icmp6_sequenced {
79 uint8_t icmp6_type; /* one of the ICMP6_TYPE_*'s above */
80 uint8_t icmp6_code; /* one of the ICMP6_CODE_*'s above */
81 uint16_t icmp6_cksum; /* 16 1's comp csum */
82 uint16_t icmp6_identifier;
83 uint16_t icmp6_sequence;
84 /* Followed by: */
85 /* Echo Request: zero or more octets of arbitary data */
86 /* Echo Reply: the data fromm the invoking Echo Request msg */
87};
88
89/* struct for group membership messages */
90struct click_icmp6_membership {
91 uint8_t icmp6_type; /* one of the ICMP6_TYPE_*'s above */
92 uint8_t icmp6_code; /* one of the ICMP6_CODE_*'s above */
93 uint16_t icmp6_cksum; /* 16 1's comp csum */
94 uint16_t icmp6_maxdelay; /* maximum response delay, in milliseconds */
95 uint16_t padding;
96 /* followed by multicast address */
97};
98
99/* struct for redirect messages */
100struct click_icmp6_redirect {
101 uint8_t icmp6_type;
102 uint8_t icmp6_code;
103 uint16_t icmp6_cksum;
104 uint32_t padding;
105 struct in6_addr icmp6_target;
106 struct in6_addr icmp6_dst;
107};
108
109/* different struct names for each type of packet */
110#define click_icmp6_unreach click_icmp6
111#define click_icmp6_timxceed click_icmp6
112#define click_icmp6_echo click_icmp6_sequenced
113
114#endif