summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/fhp/fhp.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/include/fhp/fhp.h b/include/fhp/fhp.h
index 9d680a9..d537a6e 100644
--- a/include/fhp/fhp.h
+++ b/include/fhp/fhp.h
@@ -34,6 +34,11 @@ typedef enum {
FHP_ERR_INVALID_ERROR,
FHP_ERR_BUFFER_TOO_SMALL,
FHP_ERR_INVALID_BODY_TYPE,
+ FHP_ERR_TOO_MANY_TES,
+ FHP_ERR_INVALID_CHAR_IN_TE_NAME,
+ FHP_ERR_INVALID_CHAR_IN_TE,
+ FHP_ERR_BAD_TE_STATE,
+ FHP_ERR_TE_PARSER_DONE,
FHP_ERR_LAST
} fhp_err_t;
@@ -104,6 +109,46 @@ void fhp_env_init(fhp_env_t * const env);
fhp_env_t *fhp_get_default_env(void);
//
+// transfer encoding parser functions
+//
+
+typedef enum {
+ FHP_TE_STATE_INIT,
+ FHP_TE_STATE_NAME,
+ FHP_TE_STATE_IGNORE_UNTIL_COMMA,
+ FHP_TE_STATE_SPACE,
+ FHP_TE_STATE_ERROR,
+ FHP_TE_STATE_DONE,
+ FHP_TE_STATE_LAST
+} fhp_te_state_t;
+
+#define FHP_TE_MAX_BUF_SIZE 16
+#define FHP_TE_MAX_TES 4
+
+typedef struct {
+ fhp_te_state_t state;
+
+ uint8_t buf[FHP_TE_MAX_BUF_SIZE];
+ size_t len;
+
+ uint32_t buf_hash;
+
+ uint32_t tes[FHP_TE_MAX_TES];
+ size_t num_tes;
+
+ fhp_err_t err;
+} fhp_te_parser_t;
+
+fhp_err_t
+fhp_te_parser_init(fhp_te_parser_t * const te);
+
+fhp_err_t
+fhp_te_parser_push(fhp_te_parser_t *, uint8_t * const, size_t);
+
+fhp_err_t
+fhp_te_parser_done(fhp_te_parser_t * const);
+
+//
// context functions
//