g_slice_free1 (sizeof (*mp), mp);
}
}
+
+const gchar*
+rspamd_multipattern_get_pattern (struct rspamd_multipattern *mp,
+ guint index)
+{
+ g_assert (mp != NULL);
+ g_assert (index < mp->cnt);
+
+#ifdef WITH_HYPERSCAN
+ return g_array_index (mp->hs_pats, gchar *, index);
+#else
+
+ ac_trie_pat_t pat;
+
+ pat = g_array_index (mp->pats, ac_trie_pat_t, index);
+
+ return pat.ptr;
+#endif
+}
+
+guint
+rspamd_multipattern_get_npatterns (struct rspamd_multipattern *mp)
+{
+ g_assert (mp != NULL);
+
+ return mp->cnt;
+}
gint rspamd_multipattern_lookup (struct rspamd_multipattern *mp,
const gchar *in, gsize len, rspamd_multipattern_cb_t cb,
gpointer ud, guint *pnfound);
+/**
+ * Get pattern string from multipattern identified by index
+ * @param mp
+ * @param index
+ * @return
+ */
+const gchar* rspamd_multipattern_get_pattern (struct rspamd_multipattern *mp,
+ guint index);
+
+/**
+ * Returns number of patterns in a multipattern matcher
+ * @param mp
+ * @return
+ */
+guint rspamd_multipattern_get_npatterns (struct rspamd_multipattern *mp);
/**
* Destroys multipattern structure