summaryrefslogtreecommitdiff
path: root/clients/common/nm-client-utils.h
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-03-28 12:16:31 +0200
committerThomas Haller <thaller@redhat.com>2017-03-30 13:09:58 +0200
commit23298bfc88bc0216f2dab0c930724516f8ecbfc2 (patch)
tree514f7244105f7c2f573b959ae412bad78f6cec95 /clients/common/nm-client-utils.h
parentb5c8622ad3e8eb34143e5023cdf784da741f338c (diff)
downloadNetworkManager-23298bfc88bc0216f2dab0c930724516f8ecbfc2.tar.gz
cli: move utils function from common.h to nm-meta-setting-desc.c
These functions are only used by nm-meta-setting-desc.c. Make them internal. Unfortunately, they are part of "common.h" which cannot be used without the rest of nmcli. Still todo.
Diffstat (limited to 'clients/common/nm-client-utils.h')
-rw-r--r--clients/common/nm-client-utils.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/clients/common/nm-client-utils.h b/clients/common/nm-client-utils.h
new file mode 100644
index 0000000000..7f700f930f
--- /dev/null
+++ b/clients/common/nm-client-utils.h
@@ -0,0 +1,63 @@
+/* nmcli - command-line tool to control NetworkManager
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright 2010 - 2017 Red Hat, Inc.
+ */
+
+#ifndef __NM_CLIENT_UTILS_H__
+#define __NM_CLIENT_UTILS_H__
+
+#include "nm-meta-setting.h"
+
+
+typedef enum {
+ NMC_TRI_STATE_NO,
+ NMC_TRI_STATE_YES,
+ NMC_TRI_STATE_UNKNOWN,
+} NMCTriStateValue;
+
+const char *nmc_string_is_valid (const char *input, const char **allowed, GError **error);
+
+char **nmc_strsplit_set (const char *str, const char *delimiter, int max_tokens);
+
+gboolean nmc_string_to_int_base (const char *str,
+ int base,
+ gboolean range_check,
+ long int min,
+ long int max,
+ long int *value);
+gboolean nmc_string_to_uint_base (const char *str,
+ int base,
+ gboolean range_check,
+ unsigned long int min,
+ unsigned long int max,
+ unsigned long int *value);
+gboolean nmc_string_to_int (const char *str,
+ gboolean range_check,
+ long int min,
+ long int max,
+ long int *value);
+gboolean nmc_string_to_uint (const char *str,
+ gboolean range_check,
+ unsigned long int min,
+ unsigned long int max,
+ unsigned long int *value);
+gboolean nmc_string_to_bool (const char *str, gboolean *val_bool, GError **error);
+gboolean nmc_string_to_tristate (const char *str, NMCTriStateValue *val, GError **error);
+
+gboolean matches (const char *cmd, const char *pattern);
+
+#endif /* __NM_CLIENT_UTILS_H__ */