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:
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.
16 #ifndef PLUGINS_IOAM_PLUGIN_IOAM_UDP_PING_UDP_PING_UTIL_H_
17 #define PLUGINS_IOAM_PLUGIN_IOAM_UDP_PING_UDP_PING_UTIL_H_
19 int udp_ping_create_ip6_pak (u8 * buf, /*u16 len, */
20 ip6_address_t src, ip6_address_t dst,
21 u16 src_port, u16 dst_port,
22 u8 msg_type, u16 ctx);
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);
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);
37 void udp_ping_free_flow_data (ip46_udp_ping_flow * flow);
39 void udp_ping_create_rewrite (ip46_udp_ping_flow * flow, u16 ctx);
41 void udp_ping_send_ip6_pak (vlib_main_t * vm, ip46_udp_ping_flow * flow);
44 * @brief Create and send ipv6 udp-ping response packet.
48 udp_ping_create_reply_from_probe_ip6 (ip6_header_t * ip,
49 ip6_hop_by_hop_header_t * hbh,
54 ioam_trace_option_t *trace;
56 src = ip->src_address;
58 ip->src_address = ip->dst_address;
59 ip->dst_address = src;
61 trace = (ioam_trace_option_t *)
62 ip6_hbh_get_option (hbh, HBH_OPTION_TYPE_IOAM_TRACE_DATA_LIST);
63 ip6_hbh_ioam_trace_reset_bit (trace, BIT_LOOPBACK);
65 /* No need of endian transform */
66 src_port = udp->udp.src_port;
68 udp->udp.src_port = udp->udp.dst_port;
69 udp->udp.dst_port = src_port;
70 udp->udp.checksum = 0; //FIXME
72 udp->ping_data.msg_type = UDP_PING_REPLY;
75 #endif /* PLUGINS_IOAM_PLUGIN_IOAM_UDP_PING_UDP_PING_UTIL_H_ */
78 * fd.io coding-style-patch-verification: ON
81 * eval: (c-set-style "gnu")