Hybrid ICN (hICN) plugin  v21.06-rc0-4-g18fa668
utils.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017-2019 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 __HICN_UTILS_H__
17 #define __HICN_UTILS_H__
18 
19 #include "hicn.h"
20 
32 always_inline void
34 {
35  u8 *s0;
36  s0 = format (0, "Source addr %U, seq_number %u", format_ip6_address,
37  (ip6_address_t *) name->ip6.prefix,
38  clib_net_to_host_u32 (name->ip6.suffix));
39 
40  printf ("%s\n", s0);
41 }
42 
48 always_inline void
50 {
51  vlib_main_t *vm = vlib_get_main ();
52  u8 *s0;
53  s0 = format (0, "Source addr %U:%u, dest addr %U:%u", format_ip6_address,
54  &(hicn0->v6.ip.saddr), clib_net_to_host_u32 (hicn0->v6.tcp.seq),
55  format_ip6_address, &(hicn0->v6.ip.daddr),
56  clib_net_to_host_u32 (hicn0->v6.tcp.seq));
57 
58  vlib_cli_output (vm, "%s\n", s0);
59 }
60 
66 always_inline void
68 {
69  u8 *s0;
70  s0 = format (0, "Source addr %U:%u, dest addr %U:%u", format_ip4_address,
71  &(hicn0->v4.ip.saddr), clib_net_to_host_u32 (hicn0->v4.tcp.seq),
72  format_ip4_address, &(hicn0->v4.ip.daddr),
73  clib_net_to_host_u32 (hicn0->v4.tcp.seq));
74 
75  printf ("%s\n", s0);
76 }
77 
78 #endif /* // __HICN_UTILS_H__ */
79 
80 /*
81  * fd.io coding-style-patch-verification: ON
82  *
83  * Local Variables: eval: (c-set-style "gnu") End:
84  */
ip6_address_t
Definition: common.h:173
hicn_header_t
Definition: header.h:91
hicn.h
hicn_print6
always_inline void hicn_print6(hicn_header_t *hicn0)
Definition: utils.h:49
hicn_print4
always_inline void hicn_print4(hicn_header_t *hicn0)
Definition: utils.h:67
hicn_name_t
Definition: name.h:115
hicn_print_name6
always_inline void hicn_print_name6(hicn_name_t *name)
Definition: utils.h:33