Hybrid ICN (hICN) plugin  v21.06-rc0-4-g18fa668
icmp.h
1 /*
2  * Copyright (c) 2017-2019 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
20 #ifndef HICN_PROTOCOL_ICMP_H
21 #define HICN_PROTOCOL_ICMP_H
22 
23 #include "../common.h"
24 
25 /*
26  * The length of the ICMP header struct must be 4 bytes.
27  */
28 #define EXPECTED_ICMP_HDRLEN 4
29 
30 typedef struct
31 {
32  u8 type;
33  u8 code;
34  u16 csum;
36 
37 #define ICMP_HDRLEN sizeof(_icmp_header_t)
38 static_assert (EXPECTED_ICMP_HDRLEN == ICMP_HDRLEN,
39  "Size of ICMP struct does not match its expected size.");
40 
41 /*
42  * The length of the ICMPWLDR header struct must be 4 bytes.
43  */
44 #define EXPECTED_ICMPWLDR_HDRLEN 8
45 
46 typedef struct
47 {
48  u8 type;
49  u8 code;
50  u16 csum;
51  union
52  {
53  struct
54  {
55  u16 id;
56  u16 sequence;
57  } echo; /* echo datagram */
58  u32 gateway; /* gateway address */
59  struct
60  {
61  u16 _unused;
62  u16 mtu;
63  } frag; /* path mtu discovery */
64  struct
65  {
66  u16 expected_lbl;
67  u16 received_lbl;
68  } wldr_notification_lbl;
69  };
71 
72 #define ICMPWLDR_HDRLEN sizeof(_icmp_wldr_header_t)
73 static_assert (EXPECTED_ICMPWLDR_HDRLEN == ICMPWLDR_HDRLEN,
74  "Size of ICMPWLDR struct does not match its expected size.");
75 
76 #endif /* HICN_PROTOCOL_ICMP_H */
77 
78 /*
79  * fd.io coding-style-patch-verification: ON
80  *
81  * Local Variables:
82  * eval: (c-set-style "gnu")
83  * End:
84  */
_icmp_header_t
Definition: icmp.h:30
_icmp_wldr_header_t
Definition: icmp.h:46