blob: 83b1046b526c8891b3a004ad2ef4e4c241137884 [file] [log] [blame]
Neale Ranns59ff9182019-12-29 23:55:18 +00001/*
2 * tunnel.h: shared definitions for tunnels.
3 *
4 * Copyright (c) 2019 Cisco and/or its affiliates.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#include <vnet/tunnel/tunnel.h>
19
20u8 *
21format_tunnel_mode (u8 * s, va_list * args)
22{
23 tunnel_mode_t mode = va_arg (*args, int);
24
25 switch (mode)
26 {
27#define _(n, v) case TUNNEL_MODE_##n: \
28 s = format (s, "%s", v); \
29 break;
30 foreach_tunnel_mode
31#undef _
32 }
33
34 return (s);
35}
36
37u8 *
38format_tunnel_encap_decap_flags (u8 * s, va_list * args)
39{
40 tunnel_encap_decap_flags_t f = va_arg (*args, int);
41
42 if (f == TUNNEL_ENCAP_DECAP_FLAG_NONE)
43 return (format (s, "none"));
44
45#define _(a,b,c) if (f & TUNNEL_ENCAP_DECAP_FLAG_##a) s = format(s, "%s ", b);
46 forech_tunnel_encap_decap_flag
47#undef _
48 return (s);
49}
50
51
52/*
53 * fd.io coding-style-patch-verification: ON
54 *
55 * Local Variables:
56 * eval: (c-set-style "gnu")
57 * End:
58 */