const char * ni_managed_state_to_string(ni_managed_state_t state) { const char *name; if ((name = ni_format_uint_mapped(state, __managed_state_names)) == NULL) name = "unknown"; return name; }
const char * ni_format_uint_maybe_mapped(unsigned int value, const ni_intmap_t *map) { static char buffer[20]; const char *name; if (!map) return NULL; if (!(name = ni_format_uint_mapped(value, map))) { snprintf(buffer, sizeof(buffer), "%u", value); name = buffer; } return name; }
const char * ni_json_type_name(ni_json_type_t type) { static const ni_intmap_t type_names[] = { { "null", NI_JSON_TYPE_NULL }, { "bool", NI_JSON_TYPE_BOOL }, { "int64", NI_JSON_TYPE_INT64 }, { "double", NI_JSON_TYPE_DOUBLE }, { "string", NI_JSON_TYPE_STRING }, { "object", NI_JSON_TYPE_OBJECT }, { "array", NI_JSON_TYPE_ARRAY }, { NULL, NI_JSON_TYPE_NONE } }; return ni_format_uint_mapped(type, type_names); }
int ni_parse_uint_maybe_mapped(const char *input, const ni_intmap_t *map, unsigned int *result, int base) { if (!map || !input || !result) return -1; if (ni_parse_uint_mapped(input, map, result) == 0) return 0; if (ni_parse_uint(input, result, base) < 0) return -1; if (ni_format_uint_mapped(*result, map) == NULL) return 1; return 0; }
const char * ni_ipv6_devconf_privacy_to_name(int privacy) { static const ni_intmap_t __privacy_names[] = { { "default", NI_IPV6_PRIVACY_DEFAULT }, { "disable", NI_IPV6_PRIVACY_DISABLED }, { "prefer-public", NI_IPV6_PRIVACY_PREFER_PUBLIC }, { "prefer-temporary", NI_IPV6_PRIVACY_PREFER_TEMPORARY}, { NULL, NI_IPV6_PRIVACY_DEFAULT } }; if (privacy < NI_IPV6_PRIVACY_DEFAULT) privacy = NI_IPV6_PRIVACY_DEFAULT; else if (privacy > NI_IPV6_PRIVACY_PREFER_TEMPORARY) privacy = NI_IPV6_PRIVACY_PREFER_TEMPORARY; return ni_format_uint_mapped(privacy, __privacy_names); }
const char * ni_debug_facility_to_name(unsigned int facility) { return ni_format_uint_mapped(facility, __debug_flags_names); }
const char * ni_debug_facility_to_description(unsigned int facility) { return ni_format_uint_mapped(facility, __debug_flags_descriptions); }
const char * ni_ethtool_driver_supports_map_bit(ni_ethtool_driver_supports_bit_t bit) { return ni_format_uint_mapped(bit, ni_ethternet_driver_supports_bits); }
const char * ni_team_runner_type_to_name(ni_team_runner_type_t type) { return ni_format_uint_mapped(type, ni_team_runner_names); }
const char * ni_event_type_to_name(ni_event_t type) { return ni_format_uint_mapped(type, __event_names); }
/* * Get the name of an updater */ static const char * ni_updater_name(unsigned int kind) { return ni_format_uint_mapped(kind, __ni_updater_kind_names); }
const char * ni_addrconf_update_flag_to_name(unsigned int flag) { return ni_format_uint_mapped(flag, __addrconf_update_flags); }
const char * ni_wireless_security_to_name(ni_wireless_security_t mode) { return ni_format_uint_mapped(mode, __ni_wireless_security_names); }
const char * ni_wireless_key_management_to_name(ni_wireless_key_mgmt_t mode) { return ni_format_uint_mapped(mode, __ni_wireless_key_mgmt_names); }
const char * ni_wireless_eap_method_to_name(ni_wireless_eap_method_t mode) { return ni_format_uint_mapped(mode, __ni_wireless_eap_method_names); }
const char * ni_wireless_cipher_to_name(ni_wireless_cipher_t mode) { return ni_format_uint_mapped(mode, __ni_wireless_cipher_names); }
const char * ni_wireless_auth_algo_to_name(ni_wireless_auth_algo_t algo) { return ni_format_uint_mapped(algo, __ni_wireless_auth_algo_names); }
const char * ni_wireless_auth_mode_to_name(ni_wireless_auth_mode_t mode) { return ni_format_uint_mapped(mode, __ni_wireless_auth_mode_names); }
static const char * __ni_objectmodel_port_id_type_to_name(unsigned int type) { return ni_format_uint_mapped(type, __ni_objectmodel_port_id_kind); }
const char * ni_dhcp6_mode_type_to_name(unsigned int type) { return ni_format_uint_mapped(type, __dhcp6_modes); }
const char * ni_addrconf_state_to_name(unsigned int type) { return ni_format_uint_mapped(type, __addrconf_states); }
static const char * ni_updater_format_name(unsigned int format) { return ni_format_uint_mapped(format, __ni_updater_format_names); }
const char * ni_addrfamily_type_to_name(unsigned int type) { return ni_format_uint_mapped(type, __addrfamily_names); }
const char * ni_netbios_node_type_to_name(unsigned int code) { return ni_format_uint_mapped(code, __ni_netbios_node_types); }
const char * ni_tristate_to_name(ni_tristate_t tristate) { return ni_format_uint_mapped(tristate, __tristate_names); }
const char * ni_team_link_watch_type_to_name(ni_team_link_watch_type_t type) { return ni_format_uint_mapped(type, ni_team_link_watch_names); }
const char * ni_oper_state_type_to_name(int type) { return ni_format_uint_mapped(type, __ni_operstate_names); }
const char * ni_team_tx_hash_bit_to_name(ni_team_tx_hash_bit_t bit) { return ni_format_uint_mapped(bit, ni_team_tx_hash_bit_names); }
const char * ni_linktype_type_to_name(unsigned int type) { return ni_format_uint_mapped(type, __linktype_names); }
const char * ni_vlan_protocol_to_name(unsigned int protocol) { return ni_format_uint_mapped(protocol, __map_vlan_protocol); }