New EVBUFFER_EOL_NUL to read NUL-terminated strings from an evbuffer

This commit is contained in:
Andrea Montefusco 2011-11-14 11:42:52 -05:00 committed by Nick Mathewson
parent 27b5398fe0
commit d7a8b36eaf
2 changed files with 8 additions and 1 deletions

View File

@ -1498,6 +1498,11 @@ evbuffer_search_eol(struct evbuffer *buffer,
goto done;
extra_drain = 1;
break;
case EVBUFFER_EOL_NUL:
if (evbuffer_strchr(&it, '\0') < 0)
goto done;
extra_drain = 1;
break;
default:
goto done;
}

View File

@ -387,7 +387,9 @@ enum evbuffer_eol_style {
/** An EOL is a CR followed by an LF. */
EVBUFFER_EOL_CRLF_STRICT,
/** An EOL is a LF. */
EVBUFFER_EOL_LF
EVBUFFER_EOL_LF,
/** An EOL is a NUL character (that is, a single byte with value 0) */
EVBUFFER_EOL_NUL
};
/**