FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
ping.h
Go to the documentation of this file.
1 /*
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:
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 #ifndef included_ping_ping_h
16 #define included_ping_ping_h
17 
18 
19 #include <vnet/ip/ip.h>
20 
21 #include <vnet/ip/lookup.h>
22 
23 typedef enum
24 {
28 
29 #define foreach_ip46_ping_result \
30  _ (OK, "OK") \
31  _ (ALLOC_FAIL, "packet allocation failed") \
32  _ (NO_INTERFACE, "no egress interface") \
33  _ (NO_TABLE, "no FIB table for lookup") \
34  _ (NO_SRC_ADDRESS, "no source address for egress interface") \
35  _ (NO_BUFFERS, "could not allocate a new buffer") \
36 
37 typedef enum
38 {
39 #define _(v, s) SEND_PING_##v,
41 #undef _
43 
44 /*
45  * Currently running ping command.
46  */
47 typedef struct ping_run_t
48 {
51 } ping_run_t;
52 
53 typedef struct ping_main_t
54 {
57  /* a vector of current ping runs. */
59  /* a lock held while add/remove/search on active_ping_runs */
61 } ping_main_t;
62 
63 extern ping_main_t ping_main;
64 
65 #define PING_DEFAULT_DATA_LEN 60
66 #define PING_DEFAULT_INTERVAL 1.0
67 
68 #define PING_MAXIMUM_DATA_SIZE 32768
69 
70 #define PING_CLI_UNKNOWN_NODE (~0)
71 
72 /* *INDENT-OFF* */
73 
74 typedef CLIB_PACKED (struct {
75  u16 id;
76  u16 seq;
77  u64 time_sent;
78  u8 data[0];
79 }) icmp46_echo_request_t;
80 
81 /* *INDENT-ON* */
82 
83 
84 typedef enum
85 {
90 
91 #endif /* included_ping_ping_h */
ICMP46_ECHO_REPLY_NEXT_DROP
@ ICMP46_ECHO_REPLY_NEXT_DROP
Definition: ping.h:86
ping_main_t::active_ping_runs
ping_run_t * active_ping_runs
Definition: ping.h:58
ICMP46_ECHO_REPLY_NEXT_PUNT
@ ICMP46_ECHO_REPLY_NEXT_PUNT
Definition: ping.h:87
ping_main
ping_main_t ping_main
Definition: ping.c:30
ping_main_t
struct ping_main_t ping_main_t
u16
unsigned short u16
Definition: types.h:57
ping_run_t
struct ping_run_t ping_run_t
ping_run_t::cli_process_id
uword cli_process_id
Definition: ping.h:50
CLIB_PACKED
typedef CLIB_PACKED(struct { u16 id;u16 seq;u64 time_sent;u8 data[0];}) icmp46_echo_request_t
PING_RESPONSE_IP6
@ PING_RESPONSE_IP6
Definition: ping.h:25
clib_spinlock_s
Definition: lock.h:51
uword
u64 uword
Definition: types.h:112
PING_RESPONSE_IP4
@ PING_RESPONSE_IP4
Definition: ping.h:26
ping_main_t::ping_run_check_lock
clib_spinlock_t ping_run_check_lock
Definition: ping.h:60
send_ip46_ping_result_t
send_ip46_ping_result_t
Definition: ping.h:37
ICMP46_ECHO_REPLY_N_NEXT
@ ICMP46_ECHO_REPLY_N_NEXT
Definition: ping.h:88
ping_run_t
Definition: ping.h:47
ping_response_type_t
ping_response_type_t
Definition: ping.h:23
data
u8 data[128]
Definition: ipsec_types.api:92
id
u8 id[64]
Definition: dhcp.api:160
u64
unsigned long u64
Definition: types.h:89
ip.h
ping_main_t::ip4_main
ip4_main_t * ip4_main
Definition: ping.h:56
icmp46_echo_reply_next_t
icmp46_echo_reply_next_t
Definition: ping.h:84
ip6_main_t
Definition: ip6.h:110
u8
unsigned char u8
Definition: types.h:56
lookup.h
ping_main_t::ip6_main
ip6_main_t * ip6_main
Definition: ping.h:55
ping_run_t::icmp_id
u16 icmp_id
Definition: ping.h:49
ip4_main_t
IPv4 main type.
Definition: ip4.h:107
foreach_ip46_ping_result
#define foreach_ip46_ping_result
Definition: ping.h:29
ping_main_t
Definition: ping.h:53