bool rune_eq(const struct rune *rune1, const struct rune *rune2);
/**
- * rune_alt_single - helper to implement check().
+ * rune_alt_single_str - helper to implement check().
* @ctx: context to allocate any error return from.
* @alt: alternative to test.
* @fieldval_str: field value as a string.
+ * @fieldval_strlen: length of @fieldval_str
+ */
+const char *rune_alt_single_str(const tal_t *ctx,
+ const struct rune_altern *alt,
+ const char *fieldval_str,
+ size_t fieldval_strlen);
+
+/**
+ * rune_alt_single_int - helper to implement check().
+ * @ctx: context to allocate any error return from.
+ * @alt: alternative to test.
* @fieldval_int: field value as an integer.
+ */
+const char *rune_alt_single_int(const tal_t *ctx,
+ const struct rune_altern *alt,
+ s64 fieldval_int);
+
+/**
+ * rune_alt_single_missing - helper to implement check().
+ * @ctx: context to allocate any error return from.
+ * @alt: alternative to test.
*
- * If the field value is missing, set neither fieldval_str nor fieldval_int,
- * otherwise you must set exactly one.
+ * Use this if alt->fieldname is unknown (it could still pass, if
+ * the test is that the fieldname is missing).
*/
-const char *rune_alt_single(const tal_t *ctx,
- const struct rune_altern *alt,
- const char *fieldval_str,
- const s64 *fieldval_int);
+const char *rune_alt_single_missing(const tal_t *ctx,
+ const struct rune_altern *alt);
+
/**
* rune_is_derived - is a rune derived from this other rune?
*/
struct rune *rune_from_base64(const tal_t *ctx, const char *str);
+/**
+ * rune_from_base64n - convert base64 string to rune.
+ * @ctx: context to allocate rune off.
+ * @str: base64 string.
+ * @len: length of @str.
+ *
+ * Returns NULL if it's malformed.
+ */
+struct rune *rune_from_base64n(const tal_t *ctx, const char *str, size_t len);
+
/**
* rune_to_base64 - convert run to base64 string.
* @ctx: context to allocate rune off.
* rune_restr_from_string - convenience routine to parse a single restriction.
* @ctx: context to allocate rune off.
* @str: the string of form "<field><cond><val>[|<field><cond><val>]*"
+ * @len: the length of @str.
*
- * This is really an internal routine, exposed for simple examples.
+ * This is useful for writing simple tests and making simple runes.
*/
struct rune_restr *rune_restr_from_string(const tal_t *ctx,
- const char *str);
+ const char *str,
+ size_t len);
+
+/**
+ * rune_condition_is_valid: is this a valid condition?
+ * @cond: potential condition character.
+ *
+ * Returns true if it's one of enum rune_condition.
+ */
+bool rune_condition_is_valid(enum rune_condition cond);
+
+/**
+ * rune_altern_fieldname_len: how much of this string is condition?
+ * @alternstr: potential alternative string
+ * @alternstrlen: length
+ *
+ * This helps parsing your own runes.
+ *
+ * Returns the first possible condition (check with rune_condition_is_valid)
+ * or alternstrlen if none found.
+ */
+size_t rune_altern_fieldname_len(const char *alternstr, size_t alternstrlen);
#endif /* CCAN_RUNE_RUNE_H */