From c10bcfa7def7a1093d78dcb15fd95388a633fc99 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Sun, 28 Aug 2016 03:22:19 -0400 Subject: add cl-parser.c --- include/fhp/fhp.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'include/fhp') diff --git a/include/fhp/fhp.h b/include/fhp/fhp.h index 46efb44..1e32a0d 100644 --- a/include/fhp/fhp.h +++ b/include/fhp/fhp.h @@ -41,6 +41,12 @@ typedef enum { FHP_ERR_TE_PARSER_DONE, FHP_ERR_NULL_TE_BUF, FHP_ERR_SMALL_TE_BUF, + FHP_ERR_INVALID_CHAR_BEFORE_CL, + FHP_ERR_INVALID_CHAR_IN_CL, + FHP_ERR_INVALID_CHAR_AFTER_CL, + FHP_ERR_CL_PARSER_DONE, + FHP_ERR_BAD_CL_STATE, + FHP_ERR_CL_OVERFLOW, FHP_ERR_LAST } fhp_err_t; @@ -113,6 +119,25 @@ typedef struct { void fhp_env_init(fhp_env_t * const env); fhp_env_t *fhp_get_default_env(void); +// +// content length parser functions +// + +typedef enum { + FHP_CL_STATE_INIT, + FHP_CL_STATE_DATA, + FHP_CL_STATE_TRAILING_SPACES, + FHP_CL_STATE_ERROR, + FHP_CL_STATE_DONE, + FHP_CL_STATE_LAST +} fhp_cl_state_t; + +typedef struct { + fhp_cl_state_t state; + fhp_err_t err; + uint64_t val; +} fhp_cl_parser_t; + // // transfer encoding parser functions // -- cgit v1.2.3