FD.io VPP  v17.07-30-g839fa73
Vector Packet Processing
udp_ping_util.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 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 
16 #ifndef PLUGINS_IOAM_PLUGIN_IOAM_UDP_PING_UDP_PING_UTIL_H_
17 #define PLUGINS_IOAM_PLUGIN_IOAM_UDP_PING_UDP_PING_UTIL_H_
18 
19 int udp_ping_create_ip6_pak (u8 * buf, /*u16 len, */
21  u16 src_port, u16 dst_port,
22  u8 msg_type, u16 ctx);
23 
24 int
25 udp_ping_compare_flow (ip46_address_t src, ip46_address_t dst,
26  u16 start_src_port, u16 end_src_port,
27  u16 start_dst_port, u16 end_dst_port,
28  ip46_udp_ping_flow * flow);
29 
30 void
31 udp_ping_populate_flow (ip46_address_t src, ip46_address_t dst,
32  u16 start_src_port, u16 end_src_port,
33  u16 start_dst_port, u16 end_dst_port,
34  u16 interval, u8 fault_det,
35  ip46_udp_ping_flow * flow);
36 
38 
40 
42 
43 /**
44  * @brief Create and send ipv6 udp-ping response packet.
45  *
46  */
47 always_inline void
50  udp_ping_t * udp)
51 {
52  ip6_address_t src;
53  u16 src_port;
54  ioam_trace_option_t *trace;
55 
56  src = ip->src_address;
57 
58  ip->src_address = ip->dst_address;
59  ip->dst_address = src;
60 
61  trace = (ioam_trace_option_t *)
64 
65  /* No need of endian transform */
66  src_port = udp->udp.src_port;
67 
68  udp->udp.src_port = udp->udp.dst_port;
69  udp->udp.dst_port = src_port;
70  udp->udp.checksum = 0; //FIXME
71 
73 }
74 
75 #endif /* PLUGINS_IOAM_PLUGIN_IOAM_UDP_PING_UDP_PING_UTIL_H_ */
76 
77 /*
78  * fd.io coding-style-patch-verification: ON
79  *
80  * Local Variables:
81  * eval: (c-set-style "gnu")
82  * End:
83  */
udp_ping_data ping_data
int udp_ping_create_ip6_pak(u8 *buf, ip6_address_t src, ip6_address_t dst, u16 src_port, u16 dst_port, u8 msg_type, u16 ctx)
Frame IPv6 udp-ping probe packet.
Definition: udp_ping_util.c:61
static vlib_cli_command_t trace
(constructor) VLIB_CLI_COMMAND (trace)
Definition: memory_vlib.c:1173
int udp_ping_compare_flow(ip46_address_t src, ip46_address_t dst, u16 start_src_port, u16 end_src_port, u16 start_dst_port, u16 end_dst_port, ip46_udp_ping_flow *flow)
void udp_ping_create_rewrite(ip46_udp_ping_flow *flow, u16 ctx)
void udp_ping_free_flow_data(ip46_udp_ping_flow *flow)
ip6_address_t src_address
Definition: ip6_packet.h:341
#define always_inline
Definition: clib.h:84
udp-ping data.
Definition: udp_ping.h:85
udp_header_t udp
void udp_ping_populate_flow(ip46_address_t src, ip46_address_t dst, u16 start_src_port, u16 end_src_port, u16 start_dst_port, u16 end_dst_port, u16 interval, u8 fault_det, ip46_udp_ping_flow *flow)
void udp_ping_send_ip6_pak(vlib_main_t *vm, ip46_udp_ping_flow *flow)
Create and send ipv6 udp-ping probe packet.
#define BIT_LOOPBACK
Definition: trace_util.h:94
static void udp_ping_create_reply_from_probe_ip6(ip6_header_t *ip, ip6_hop_by_hop_header_t *hbh, udp_ping_t *udp)
Create and send ipv6 udp-ping response packet.
Definition: udp_ping_util.h:48
#define HBH_OPTION_TYPE_IOAM_TRACE_DATA_LIST
unsigned short u16
Definition: types.h:57
unsigned char u8
Definition: types.h:56
static ip6_hop_by_hop_option_t * ip6_hbh_get_option(ip6_hop_by_hop_header_t *hbh0, u8 option_to_search)
static void ip6_hbh_ioam_trace_reset_bit(ioam_trace_option_t *trace, u8 trace_bit)
#define UDP_PING_REPLY
ip6_address_t dst_address
Definition: ip6_packet.h:341