summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/fhp/fhp.h23
1 files changed, 21 insertions, 2 deletions
diff --git a/include/fhp/fhp.h b/include/fhp/fhp.h
index 3337cbe..9d680a9 100644
--- a/include/fhp/fhp.h
+++ b/include/fhp/fhp.h
@@ -33,6 +33,7 @@ typedef enum {
FHP_ERR_INVALID_CHAR_IN_HEADER_NAME,
FHP_ERR_INVALID_ERROR,
FHP_ERR_BUFFER_TOO_SMALL,
+ FHP_ERR_INVALID_BODY_TYPE,
FHP_ERR_LAST
} fhp_err_t;
@@ -82,6 +83,13 @@ typedef enum {
fhp_err_t
fhp_strtoken(fhp_token_t, char * const, size_t);
+typedef enum {
+ FHP_BODY_TYPE_NONE,
+ FHP_BODY_TYPE_CONTENT_LENGTH,
+ FHP_BODY_TYPE_TRANSFER_ENCODING,
+ FHP_BODY_TYPE_LAST
+} fhp_body_type_t;
+
//
// env functions
//
@@ -133,7 +141,8 @@ typedef enum {
FHP_STATE_LAST
} fhp_state_t;
-#define FHP_BUF_SIZE 1024
+#define FHP_MAX_BUF_SIZE 1024
+#define FHP_MAX_TRANSFER_ENCODINGS 4
struct fhp_t_ {
// env pointer
@@ -155,7 +164,7 @@ struct fhp_t_ {
uint64_t ofs;
// fragment data buffer
- uint8_t buf[FHP_BUF_SIZE];
+ uint8_t buf[FHP_MAX_BUF_SIZE];
size_t buf_len;
// buffer hashing state
@@ -168,6 +177,16 @@ struct fhp_t_ {
// hash of last header name
uint32_t header_name_hash;
+ // request body type
+ fhp_body_type_t body_type;
+
+ // content length
+ uint64_t content_length;
+
+ // transfer encodings
+ uint32_t tes[FHP_MAX_TRANSFER_ENCODINGS];
+ size_t num_tes;
+
// state for url hex decoder
uint32_t hex;
};