aboutsummaryrefslogtreecommitdiffstats
path: root/src/bpfswitch/usrc/str_utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/bpfswitch/usrc/str_utils.h')
-rw-r--r--src/bpfswitch/usrc/str_utils.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/bpfswitch/usrc/str_utils.h b/src/bpfswitch/usrc/str_utils.h
new file mode 100644
index 00000000..817eb5f6
--- /dev/null
+++ b/src/bpfswitch/usrc/str_utils.h
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __STR_UTILS_H
+#define __STR_UTILS_H
+
+int str_to_int(const char *str, int min, int max, int *value);
+int str_to_ushort(const char *str, unsigned short *us);
+int str_to_ulong(const char *str, unsigned long *ul);
+int str_to_ulong_base(const char *str, unsigned long *ul, int base);
+int str_to_ullong(const char *str, unsigned long long *ul);
+int str_to_mac(const char *str, unsigned char *mac);
+int get_ifidx(const char *arg);
+
+int parsestr(char *str, char *delims, char *fields[], int nmax);
+void print_mac(const __u8 *mac, bool reverse);
+#endif