summaryrefslogtreecommitdiff
path: root/include/fhp
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2016-08-27 19:03:51 -0400
committerPaul Duncan <pabs@pablotron.org>2016-08-27 19:03:51 -0400
commitf0668928544479c030e05d7cfc87f0c392a6d065 (patch)
treee235112d8d080f93df01b24d85ee7c91ba69d2f2 /include/fhp
parent998f207725e0427b6518fea5e6d64347cb14e231 (diff)
downloadlibfhp-f0668928544479c030e05d7cfc87f0c392a6d065.tar.bz2
libfhp-f0668928544479c030e05d7cfc87f0c392a6d065.zip
cleanup, additional work towards transfer encoding support
Diffstat (limited to 'include/fhp')
-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;
};