summaryrefslogtreecommitdiff
path: root/src/names.h
blob: ed759edc164143dd0ee501363495b1033249754c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
 * Copyright (C) 2021 Canonical, Ltd.
 * Author: Simon Chopin <simon.chopin@canonical.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 3.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#pragma once

#include "netplan.h"
#include "types.h"

NETPLAN_INTERNAL const char*
netplan_backend_name(NetplanBackend val);

NETPLAN_INTERNAL const char*
netplan_def_type_name(NetplanDefType val);

const char*
netplan_auth_key_management_type_name(NetplanAuthKeyManagementType val);

const char*
netplan_auth_eap_method_name(NetplanAuthEAPMethod val);

const char*
netplan_tunnel_mode_name(NetplanTunnelMode val);

const char*
netplan_addr_gen_mode_name(NetplanAddrGenMode val);

const char*
netplan_wifi_mode_name(NetplanWifiMode val);

const char*
netplan_infiniband_mode_name(NetplanInfinibandMode val);

const char*
netplan_vxlan_notification_name(int val);

const char*
netplan_vxlan_checksum_name(int val);

const char*
netplan_vxlan_extension_name(int val);

NetplanDefType
netplan_def_type_from_name(const char* val);

/* Netplan flag names */
static const char* const
netplan_vxlan_notification_to_str[] = {
    [__builtin_ffs(NETPLAN_VXLAN_NOTIFICATION_L2_MISS)] = "l2-miss",
    [__builtin_ffs(NETPLAN_VXLAN_NOTIFICATION_L3_MISS)] = "l3-miss",
};

static const char* const
netplan_vxlan_checksum_to_str[] = {
    [__builtin_ffs(NETPLAN_VXLAN_CHECKSUM_UDP)] = "udp",
    [__builtin_ffs(NETPLAN_VXLAN_CHECKSUM_ZERO_UDP6_TX)] = "zero-udp6-tx",
    [__builtin_ffs(NETPLAN_VXLAN_CHECKSUM_ZERO_UDP6_RX)] = "zero-udp6-rx",
    [__builtin_ffs(NETPLAN_VXLAN_CHECKSUM_REMOTE_TX)] = "remote-tx",
    [__builtin_ffs(NETPLAN_VXLAN_CHECKSUM_REMOTE_RX)] = "remote-rx",
};

static const char* const
netplan_vxlan_extension_to_str[] = {
    [__builtin_ffs(NETPLAN_VXLAN_EXTENSION_GROUP_POLICY)] = "group-policy",
    [__builtin_ffs(NETPLAN_VXLAN_EXTENSION_GENERIC_PROTOCOL)] = "generic-protocol",
};