+/**
+ * bytestring_spn - search a bytestring for a set of bytes
+ * @s: a bytestring
+ * @accept: a bytestring containing a set of bytes to accept
+ *
+ * Returns the length, in bytes, of the initial segment of @s which
+ * consists entirely of characters in @accept.
+ */
+size_t bytestring_spn(struct bytestring s, struct bytestring accept);
+
+/**
+ * bytestring_cspn - search a bytestring for a set of bytes (complemented)
+ * @s: a bytestring
+ * @reject: a bytestring containing a set of bytes to reject
+ *
+ * Returns the length, in bytes, of the initial segment of @s which
+ * consists entirely of characters not in @reject.
+ */
+size_t bytestring_cspn(struct bytestring s, struct bytestring reject);
+
+/**
+ * bytestring_splitchr_first - split a bytestring on a single character delimiter
+ * @whole: a bytestring
+ * @delim: delimiter character
+ *
+ * Returns the first @delim delimited substring of @whole.
+ */
+struct bytestring bytestring_splitchr_first(struct bytestring whole,
+ char delim);
+
+/**
+ * bytestring_splitchr_next - split a bytestring on a single character delimiter
+ * @whole: a bytestring
+ * @delim: delimiter character
+ * @prev: last substring
+ *
+ * Returns the next @delim delimited substring of @whole after @prev.
+ */
+struct bytestring bytestring_splitchr_next(struct bytestring whole,
+ char delim, struct bytestring prev);
+
+#define bytestring_foreach_splitchr(_s, _w, _delim) \
+ for ((_s) = bytestring_splitchr_first((_w), (_delim)); \
+ (_s).ptr; \
+ (_s) = bytestring_splitchr_next((_w), (_delim), (_s)))
+
+/**
+ * bytestring_splitchrs_first - split a bytestring on a set of delimiter
+ * characters
+ * @whole: a bytestring
+ * @delim: delimiter characters
+ *
+ * Returns the first substring of @whole delimited by any character in
+ * @delim.
+ */
+struct bytestring bytestring_splitchrs_first(struct bytestring whole,
+ struct bytestring delim);
+
+/**
+ * bytestring_splitchr_next - split a bytestring on a set of delimiter
+ * characters
+ * @whole: a bytestring
+ * @delim: delimiter character
+ * @prev: last substring
+ *
+ * Returns the next @delim delimited substring of @whole after @prev.
+ */
+struct bytestring bytestring_splitchrs_next(struct bytestring whole,
+ struct bytestring delim,
+ struct bytestring prev);
+
+#define bytestring_foreach_splitchrs(_s, _w, _delim) \
+ for ((_s) = bytestring_splitchrs_first((_w), (_delim)); \
+ (_s).ptr; \
+ (_s) = bytestring_splitchrs_next((_w), (_delim), (_s)))
+
+/**
+ * bytestring_splitstr_first - split a bytestring on a delimiter string
+ * @whole: a bytestring
+ * @delim: delimiter substring
+ *
+ * Returns the first substring of @whole delimited by the substring in
+ * @delim.
+ */
+struct bytestring bytestring_splitstr_first(struct bytestring whole,
+ struct bytestring delim);
+
+/**
+ * bytestring_splitstr_next - split a bytestring on a delimiter string
+ * @whole: a bytestring
+ * @delim: delimiter string
+ * @prev: last substring
+ *
+ * Returns the next @delim delimited substring of @whole after @prev.
+ */
+struct bytestring bytestring_splitstr_next(struct bytestring whole,
+ struct bytestring delim,
+ struct bytestring prev);
+
+#define bytestring_foreach_splitstr(_s, _w, _delim) \
+ for ((_s) = bytestring_splitstr_first((_w), (_delim)); \
+ (_s).ptr; \
+ (_s) = bytestring_splitstr_next((_w), (_delim), (_s)))
+