2 * Copyright (c) 2015 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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
15 #ifndef included_vnet_ping_h
16 #define included_vnet_ping_h
19 #include <vnet/ip/ip.h>
21 #include <vnet/ip/lookup.h>
25 PING_RESPONSE_IP6 = 42,
27 } ping_response_type_t;
29 #define foreach_ip46_ping_result \
31 _ (ALLOC_FAIL, "packet allocation failed") \
32 _ (NO_INTERFACE, "no egress interface") \
33 _ (NO_TABLE, "no IPv6 Table for lookup") \
34 _ (NO_SRC_ADDRESS, "no source address for egress interface") \
38 #define _(v, s) SEND_PING_##v,
39 foreach_ip46_ping_result
41 } send_ip46_ping_result_t;
44 * Currently running ping command.
46 typedef struct ping_run_t
51 uword cli_thread_index;
54 typedef struct ping_main_t
58 ping_run_t *ping_runs;
59 /* hash table to find back the CLI process for a reply */
60 // uword *cli_proc_by_icmp_id;
61 ping_run_t *ping_run_by_icmp_id;
64 extern ping_main_t ping_main;
66 #define PING_DEFAULT_DATA_LEN 60
67 #define PING_DEFAULT_INTERVAL 1.0
69 #define PING_MAXIMUM_DATA_SIZE (VLIB_BUFFER_DATA_SIZE - sizeof(ip6_header_t) - sizeof(icmp46_header_t) - offsetof(icmp46_echo_request_t, data))
73 typedef CLIB_PACKED (struct {
78 }) icmp46_echo_request_t;
81 typedef CLIB_PACKED (struct {
84 icmp46_echo_request_t icmp_echo;
85 }) icmp6_echo_request_header_t;
87 typedef CLIB_PACKED (struct {
90 icmp46_echo_request_t icmp_echo;
91 }) icmp4_echo_request_header_t;
108 ICMP6_ECHO_REPLY_NEXT_DROP,
109 ICMP6_ECHO_REPLY_NEXT_PUNT,
110 ICMP6_ECHO_REPLY_N_NEXT,
111 } icmp6_echo_reply_next_t;
115 ICMP4_ECHO_REPLY_NEXT_DROP,
116 ICMP4_ECHO_REPLY_NEXT_PUNT,
117 ICMP4_ECHO_REPLY_N_NEXT,
118 } icmp4_echo_reply_next_t;
120 #endif /* included_vnet_ping_h */