api: missing support for dumping of neighbours (VPP-333)
[vpp.git] / vnet / vnet / ip / ping.h
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_vnet_ping_h
16 #define included_vnet_ping_h
17
18
19 #include <vnet/ip/ip.h>
20
21 #include <vnet/ip/lookup.h>
22
23 typedef enum {
24   PING_RESPONSE_IP6 = 42,
25   PING_RESPONSE_IP4,
26 } ping_response_type_t;
27
28 typedef enum {
29   SEND_PING_OK = 0,
30   SEND_PING_ALLOC_FAIL,
31   SEND_PING_NO_INTERFACE,
32   SEND_PING_NO_TABLE,
33 } send_ip46_ping_result_t;
34
35 /*
36  * Currently running ping command.
37  */
38 typedef struct ping_run_t {
39   u16 icmp_id;
40   u16 curr_seq;
41   uword cli_process_id;
42 } ping_run_t;
43
44 typedef struct ping_main_t {
45   ip6_main_t *ip6_main;
46   ip4_main_t *ip4_main;
47   ping_run_t *ping_runs;
48   /* hash table to find back the CLI process for a reply */
49   // uword *cli_proc_by_icmp_id;
50   ping_run_t *ping_run_by_icmp_id;
51 } ping_main_t;
52
53 ping_main_t ping_main;
54
55 #define PING_DEFAULT_DATA_LEN 60
56 #define PING_DEFAULT_INTERVAL 1.0
57
58 #define PING_MAXIMUM_DATA_SIZE 2000
59
60 typedef CLIB_PACKED (struct {
61   u16 id;
62   u16 seq;
63   f64 time_sent;
64   u8 data[PING_MAXIMUM_DATA_SIZE];
65 }) icmp46_echo_request_t;
66
67
68 typedef CLIB_PACKED (struct {
69   ip6_header_t ip6;
70   icmp46_header_t icmp;
71   icmp46_echo_request_t icmp_echo;
72 }) icmp6_echo_request_header_t;
73
74 typedef CLIB_PACKED(struct {
75     ip4_header_t ip4;
76     icmp46_header_t icmp;
77     icmp46_echo_request_t icmp_echo;
78 }) icmp4_echo_request_header_t;
79
80
81 typedef struct {
82   u16 id;
83   u16 seq;
84   u8 bound;
85 } icmp_echo_trace_t;
86
87
88
89
90 typedef enum {
91   ICMP6_ECHO_REPLY_NEXT_DROP,
92   ICMP6_ECHO_REPLY_NEXT_PUNT,
93   ICMP6_ECHO_REPLY_N_NEXT,
94 } icmp6_echo_reply_next_t;
95
96 typedef enum {
97   ICMP4_ECHO_REPLY_NEXT_DROP,
98   ICMP4_ECHO_REPLY_NEXT_PUNT,
99   ICMP4_ECHO_REPLY_N_NEXT,
100 } icmp4_echo_reply_next_t;
101
102 #endif /* included_vnet_ping_h */