c25356d5978632df6203437e1953bcb29e0c736fTimo Sirainen#ifndef STR_FIND_H
c25356d5978632df6203437e1953bcb29e0c736fTimo Sirainen#define STR_FIND_H
1d5e52e398381873081455ad99edec945038eec0Timo Sirainen
1d5e52e398381873081455ad99edec945038eec0Timo Sirainenstruct str_find_context;
1d5e52e398381873081455ad99edec945038eec0Timo Sirainen
1d5e52e398381873081455ad99edec945038eec0Timo Sirainenstruct str_find_context *str_find_init(pool_t pool, const char *key);
1d5e52e398381873081455ad99edec945038eec0Timo Sirainenvoid str_find_deinit(struct str_find_context **ctx);
1d5e52e398381873081455ad99edec945038eec0Timo Sirainen
1d5e52e398381873081455ad99edec945038eec0Timo Sirainen/* Returns TRUE if key is found. It's possible to send the data in arbitrary
1d5e52e398381873081455ad99edec945038eec0Timo Sirainen blocks and have the key still match. */
1d5e52e398381873081455ad99edec945038eec0Timo Sirainenbool str_find_more(struct str_find_context *ctx,
1d5e52e398381873081455ad99edec945038eec0Timo Sirainen const unsigned char *data, size_t size);
49a7e4dba84bbf35d82669d1ae79ad43949eed19Timo Sirainen/* After str_find_more() has returned TRUE, this function returns the end
49a7e4dba84bbf35d82669d1ae79ad43949eed19Timo Sirainen position in the previous data block where the key had matched. */
49a7e4dba84bbf35d82669d1ae79ad43949eed19Timo Sirainensize_t str_find_get_match_end_pos(struct str_find_context *ctx);
1d5e52e398381873081455ad99edec945038eec0Timo Sirainen/* Reset input data. The next str_find_more() call won't try to match the key
1d5e52e398381873081455ad99edec945038eec0Timo Sirainen to earlier data. */
1d5e52e398381873081455ad99edec945038eec0Timo Sirainenvoid str_find_reset(struct str_find_context *ctx);
1d5e52e398381873081455ad99edec945038eec0Timo Sirainen
1d5e52e398381873081455ad99edec945038eec0Timo Sirainen#endif