summaryrefslogtreecommitdiff
path: root/include/fhp
diff options
context:
space:
mode:
Diffstat (limited to 'include/fhp')
-rw-r--r--include/fhp/fhp.h25
1 files changed, 23 insertions, 2 deletions
diff --git a/include/fhp/fhp.h b/include/fhp/fhp.h
index 3b7e280..72df8a5 100644
--- a/include/fhp/fhp.h
+++ b/include/fhp/fhp.h
@@ -10,6 +10,10 @@ typedef enum {
FHP_ERR_CB,
FHP_ERR_BAD_STATE,
FHP_ERR_INVALID_CHAR,
+ FHP_ERR_INVALID_CHAR_IN_METHOD,
+ FHP_ERR_INVALID_CHAR_IN_URL,
+ FHP_ERR_INVALID_CHAR_IN_URL_PERCENT,
+ FHP_ERR_INVALID_CHAR_IN_VERSION,
FHP_ERR_INVALID_ERROR,
FHP_ERR_BUFFER_TOO_SMALL,
FHP_ERR_LAST
@@ -60,6 +64,8 @@ typedef enum {
FHP_STATE_METHOD,
FHP_STATE_METHOD_END,
FHP_STATE_URL,
+ FHP_STATE_URL_PERCENT,
+ FHP_STATE_URL_PERCENT_LAST,
FHP_STATE_URL_END,
FHP_STATE_VERSION,
FHP_STATE_VERSION_END,
@@ -80,15 +86,27 @@ typedef enum {
#define FHP_BUF_SIZE 1024
struct fhp_t_ {
+ // current parser state
fhp_state_t state;
+
+ // user callback
fhp_cb_t cb;
- uint64_t ofs;
- fhp_err_t err;
+ // opaque user data
void *user_data;
+ // last error
+ fhp_err_t err;
+
+ // number of bytes read
+ uint64_t ofs;
+
+ // fragment data buffer
uint8_t buf[FHP_BUF_SIZE];
size_t buf_len;
+
+ // state for url hex decoder
+ uint32_t hex;
};
fhp_err_t
@@ -97,4 +115,7 @@ fhp_init(fhp_t * const, fhp_cb_t, void * const);
fhp_err_t
fhp_push(fhp_t * const, uint8_t * const, size_t);
+void *
+fhp_user_data(fhp_t * const);
+
#endif /* FHP_H */