| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | |
| 3 | #ifndef NETDATA_CHART_ID_AND_NAME_H |
| 4 | #define NETDATA_CHART_ID_AND_NAME_H |
| 5 | |
| 6 | #include "../libnetdata.h" |
| 7 | |
| 8 | void netdata_fix_chart_id(char *s); |
| 9 | void netdata_fix_chart_name(char *s); |
| 10 | char *rrdset_strncpyz_name(char *dst, const char *src, size_t dst_size_minus_1); |
| 11 | bool rrdvar_fix_name(char *variable); |
| 12 | |
| 13 | extern unsigned char chart_names_allowed_chars[256]; |
| 14 | extern unsigned char rrd_string_allowed_chars[256]; |
| 15 | |
| 16 | static inline bool is_netdata_api_valid_character(char c) { |
| 17 | if(IS_UTF8_BYTE(c)) return true; |
| 18 | unsigned char t = chart_names_allowed_chars[(unsigned char)c]; |
| 19 | // the translation converts space to space |
| 20 | // so we have to check explicitly |
| 21 | return t == (unsigned char)c && t != ' ' && t != '!'; |
| 22 | } |
| 23 | |
| 24 | #endif //NETDATA_CHART_ID_AND_NAME_H |