aboutsummaryrefslogtreecommitdiff
path: root/src/mm-util.h
diff options
context:
space:
mode:
authorTambet Ingo <tambet@gmail.com>2008-10-24 16:20:22 +0300
committerTambet Ingo <tambet@gmail.com>2008-10-24 16:20:22 +0300
commitf82b187c2bb3efb117f96e5b6062128f20ab2f39 (patch)
treeb9dad67b61990b30a9c7add57b7b839a5dfee429 /src/mm-util.h
parent0bd4f4a6049838dd7b09320c18c1991196ae80ee (diff)
Move the string parser with regexp from huawei plugin to generic utility function.
It's useful for other modems too that need to strip unsolicited messages from responses.
Diffstat (limited to 'src/mm-util.h')
-rw-r--r--src/mm-util.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mm-util.h b/src/mm-util.h
new file mode 100644
index 00000000..049b5f94
--- /dev/null
+++ b/src/mm-util.h
@@ -0,0 +1,20 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+
+#ifndef MM_UTIL_H
+#define MM_UTIL_H
+
+#include <glib.h>
+
+typedef void (*MMUtilStripFn) (const char *str,
+ gpointer user_data);
+
+/* Applies the regexp on string and calls the callback (if provided)
+ with each match and user_data. After that, the matches are removed
+ from the string.
+*/
+void mm_util_strip_string (GString *string,
+ GRegex *regex,
+ MMUtilStripFn callback,
+ gpointer user_data);
+
+#endif /* MM_UTIL_H */