From 0485651622e4078532d8d834668b2ec9c255a820 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Sun, 28 Aug 2016 15:31:47 -0400 Subject: s/fhp_t/fhp_ctx_t/g --- fhp.c | 278 +++++++++++++++++++++++++++++++++--------------------------------- 1 file changed, 139 insertions(+), 139 deletions(-) (limited to 'fhp.c') diff --git a/fhp.c b/fhp.c index 1eceeee..e73fba8 100644 --- a/fhp.c +++ b/fhp.c @@ -4,7 +4,7 @@ // context functions // -static const fhp_t FHP_DEFAULT_CONTEXT = { +static const fhp_ctx_t FHP_DEFAULT_CONTEXT = { .state = FHP_STATE_INIT, .user_data = NULL, .cb = NULL, @@ -20,48 +20,48 @@ static const fhp_t FHP_DEFAULT_CONTEXT = { }; fhp_err_t -fhp_init( - fhp_t * const fhp, +fhp_ctx_init( + fhp_ctx_t * const ctx, fhp_env_t * const env, fhp_cb_t cb, void * const user_data ) { - *fhp = FHP_DEFAULT_CONTEXT; - fhp->env = env ? env : fhp_get_default_env(); - fhp->user_data = user_data; - fhp->cb = cb; + *ctx = FHP_DEFAULT_CONTEXT; + ctx->env = env ? env : fhp_get_default_env(); + ctx->user_data = user_data; + ctx->cb = cb; /* return success */ return FHP_OK; } static void -fhp_buf_clear(fhp_t * const fhp) { +fhp_ctx_buf_clear(fhp_ctx_t * const ctx) { // clear buffer - fhp->buf_len = 0; + ctx->buf_len = 0; } static fhp_err_t -fhp_buf_flush( - fhp_t * const fhp, +fhp_ctx_buf_flush( + fhp_ctx_t * const ctx, fhp_token_t token ) { - if (fhp->buf_len > 0) { + if (ctx->buf_len > 0) { // push data - if (!fhp->cb(fhp, token, fhp->buf, fhp->buf_len)) + if (!ctx->cb(ctx, token, ctx->buf, ctx->buf_len)) return FHP_ERR_CB; // update buffer hash - if (fhp->is_hashing) - fhp->buf_hash = fhp_lc_hash_push(fhp->buf_hash, fhp->buf, fhp->buf_len); + if (ctx->is_hashing) + ctx->buf_hash = fhp_lc_hash_push(ctx->buf_hash, ctx->buf, ctx->buf_len); // push to header value parser fhp_err_t err; - if ((err = fhp_header_value_parser_push(fhp, fhp->buf, fhp->buf_len)) != FHP_OK) + if ((err = fhp_header_value_parser_push(ctx, ctx->buf, ctx->buf_len)) != FHP_OK) return err; // clear buffer - fhp_buf_clear(fhp); + fhp_ctx_buf_clear(ctx); } // return success @@ -69,46 +69,46 @@ fhp_buf_flush( } static fhp_err_t -fhp_buf_push( - fhp_t * const fhp, +fhp_ctx_buf_push( + fhp_ctx_t * const ctx, fhp_token_t token, uint8_t byte ) { // flush buffer - if (fhp->buf_len + 1 >= FHP_MAX_BUF_SIZE) { + if (ctx->buf_len + 1 >= FHP_CTX_MAX_BUF_SIZE) { fhp_err_t err; - if ((err = fhp_buf_flush(fhp, token)) != FHP_OK) + if ((err = fhp_ctx_buf_flush(ctx, token)) != FHP_OK) return err; } // append to buffer - fhp->buf[fhp->buf_len] = byte; - fhp->buf_len++; + ctx->buf[ctx->buf_len] = byte; + ctx->buf_len++; // return success return FHP_OK; } static fhp_err_t -fhp_handle_method(fhp_t * const fhp) { +fhp_ctx_handle_method(fhp_ctx_t * const ctx) { // get method token - fhp->http_method = FHP_TOKEN_METHOD_OTHER; - if (fhp->buf_hash == fhp->env->hashes[FHP_STR_GET]) { - fhp->http_method = FHP_TOKEN_METHOD_GET; - } else if (fhp->buf_hash == fhp->env->hashes[FHP_STR_POST]) { - fhp->http_method = FHP_TOKEN_METHOD_POST; - } else if (fhp->buf_hash == fhp->env->hashes[FHP_STR_HEAD]) { - fhp->http_method = FHP_TOKEN_METHOD_HEAD; - } else if (fhp->buf_hash == fhp->env->hashes[FHP_STR_PUT]) { - fhp->http_method = FHP_TOKEN_METHOD_PUT; - } else if (fhp->buf_hash == fhp->env->hashes[FHP_STR_DELETE]) { - fhp->http_method = FHP_TOKEN_METHOD_DELETE; - } else if (fhp->buf_hash == fhp->env->hashes[FHP_STR_OPTIONS]) { - fhp->http_method = FHP_TOKEN_METHOD_OPTIONS; + ctx->http_method = FHP_TOKEN_METHOD_OTHER; + if (ctx->buf_hash == ctx->env->hashes[FHP_STR_GET]) { + ctx->http_method = FHP_TOKEN_METHOD_GET; + } else if (ctx->buf_hash == ctx->env->hashes[FHP_STR_POST]) { + ctx->http_method = FHP_TOKEN_METHOD_POST; + } else if (ctx->buf_hash == ctx->env->hashes[FHP_STR_HEAD]) { + ctx->http_method = FHP_TOKEN_METHOD_HEAD; + } else if (ctx->buf_hash == ctx->env->hashes[FHP_STR_PUT]) { + ctx->http_method = FHP_TOKEN_METHOD_PUT; + } else if (ctx->buf_hash == ctx->env->hashes[FHP_STR_DELETE]) { + ctx->http_method = FHP_TOKEN_METHOD_DELETE; + } else if (ctx->buf_hash == ctx->env->hashes[FHP_STR_OPTIONS]) { + ctx->http_method = FHP_TOKEN_METHOD_OPTIONS; } // send method token - if (!fhp->cb(fhp, fhp->http_method, 0, 0)) + if (!ctx->cb(ctx, ctx->http_method, 0, 0)) return FHP_ERR_CB; // return success @@ -116,27 +116,27 @@ fhp_handle_method(fhp_t * const fhp) { } static fhp_err_t -fhp_push_byte( - fhp_t * const fhp, +fhp_ctx_push_byte( + fhp_ctx_t * const ctx, uint8_t byte ) { fhp_err_t err; retry: - switch (fhp->state) { + switch (ctx->state) { case FHP_STATE_INIT: switch (byte) { CASE_TOKEN_CHARS // send start token - if (!fhp->cb(fhp, FHP_TOKEN_METHOD_START, 0, 0)) + if (!ctx->cb(ctx, FHP_TOKEN_METHOD_START, 0, 0)) return FHP_ERR_CB; // enable buffer hashing - fhp->is_hashing = true; - fhp->buf_hash = fhp_hash_init(); + ctx->is_hashing = true; + ctx->buf_hash = fhp_hash_init(); // set state - fhp->state = FHP_STATE_METHOD; + ctx->state = FHP_STATE_METHOD; goto retry; break; @@ -149,29 +149,29 @@ retry: switch (byte) { CASE_TOKEN_CHARS // add to buffer - if ((err = fhp_buf_push(fhp, FHP_TOKEN_METHOD_FRAGMENT, byte)) != FHP_OK) + if ((err = fhp_ctx_buf_push(ctx, FHP_TOKEN_METHOD_FRAGMENT, byte)) != FHP_OK) return err; break; case ' ': // flush buffer - if ((err = fhp_buf_flush(fhp, FHP_TOKEN_METHOD_FRAGMENT)) != FHP_OK) + if ((err = fhp_ctx_buf_flush(ctx, FHP_TOKEN_METHOD_FRAGMENT)) != FHP_OK) return err; // disable buffer hashing - fhp->is_hashing = false; + ctx->is_hashing = false; // send end token - if (!fhp->cb(fhp, FHP_TOKEN_METHOD_END, 0, 0)) + if (!ctx->cb(ctx, FHP_TOKEN_METHOD_END, 0, 0)) return FHP_ERR_CB; // handle method - fhp_err_t err = fhp_handle_method(fhp); + fhp_err_t err = fhp_ctx_handle_method(ctx); if (err != FHP_OK) return err; // set state - fhp->state = FHP_STATE_METHOD_END; + ctx->state = FHP_STATE_METHOD_END; goto retry; break; @@ -187,10 +187,10 @@ retry: // ignore break; CASE_URL_CHARS - if (!fhp->cb(fhp, FHP_TOKEN_URL_START, 0, 0)) + if (!ctx->cb(ctx, FHP_TOKEN_URL_START, 0, 0)) return FHP_ERR_CB; - fhp->state = FHP_STATE_URL; + ctx->state = FHP_STATE_URL; goto retry; default: return FHP_ERR_INVALID_CHAR_IN_URL; @@ -201,26 +201,26 @@ retry: switch (byte) { case ' ': // flush buffer - if ((err = fhp_buf_flush(fhp, FHP_TOKEN_URL_FRAGMENT)) != FHP_OK) + if ((err = fhp_ctx_buf_flush(ctx, FHP_TOKEN_URL_FRAGMENT)) != FHP_OK) return err; // send end token - if (!fhp->cb(fhp, FHP_TOKEN_URL_END, 0, 0)) + if (!ctx->cb(ctx, FHP_TOKEN_URL_END, 0, 0)) return FHP_ERR_CB; // set state - fhp->state = FHP_STATE_URL_END; + ctx->state = FHP_STATE_URL_END; goto retry; break; case '%': // set state - fhp->state = FHP_STATE_URL_PERCENT; + ctx->state = FHP_STATE_URL_PERCENT; break; CASE_URL_CHARS // add to buffer - if ((err = fhp_buf_push(fhp, FHP_TOKEN_URL_FRAGMENT, byte)) != FHP_OK) + if ((err = fhp_ctx_buf_push(ctx, FHP_TOKEN_URL_FRAGMENT, byte)) != FHP_OK) return err; } @@ -228,13 +228,13 @@ retry: case FHP_STATE_URL_PERCENT: switch (byte) { CASE_DIGIT_CHARS - fhp->hex = byte - '0'; - fhp->state = FHP_STATE_URL_PERCENT_LAST; + ctx->hex = byte - '0'; + ctx->state = FHP_STATE_URL_PERCENT_LAST; break; CASE_HEX_ALPHA_CHARS - fhp->hex = 10 + byte - ((byte >= 'a') ? 'a' : 'A'); - fhp->state = FHP_STATE_URL_PERCENT_LAST; + ctx->hex = 10 + byte - ((byte >= 'a') ? 'a' : 'A'); + ctx->state = FHP_STATE_URL_PERCENT_LAST; break; default: @@ -245,21 +245,21 @@ retry: case FHP_STATE_URL_PERCENT_LAST: switch (byte) { CASE_DIGIT_CHARS - fhp->hex = (fhp->hex << 4) + (byte - '0'); + ctx->hex = (ctx->hex << 4) + (byte - '0'); break; CASE_HEX_ALPHA_CHARS - fhp->hex = (fhp->hex << 4) + (10 + byte - ((byte >= 'a') ? 'a' : 'A')); + ctx->hex = (ctx->hex << 4) + (10 + byte - ((byte >= 'a') ? 'a' : 'A')); break; default: return FHP_ERR_INVALID_CHAR_IN_URL_PERCENT; } // add to buffer - if ((err = fhp_buf_push(fhp, FHP_TOKEN_URL_FRAGMENT, fhp->hex)) != FHP_OK) + if ((err = fhp_ctx_buf_push(ctx, FHP_TOKEN_URL_FRAGMENT, ctx->hex)) != FHP_OK) return err; // set state - fhp->state = FHP_STATE_URL; + ctx->state = FHP_STATE_URL; break; case FHP_STATE_URL_END: @@ -268,15 +268,15 @@ retry: // ignore break; default: - if (!fhp->cb(fhp, FHP_TOKEN_VERSION_START, 0, 0)) + if (!ctx->cb(ctx, FHP_TOKEN_VERSION_START, 0, 0)) return FHP_ERR_CB; // enable buffer hashing - fhp->is_hashing = true; - fhp->buf_hash = fhp_hash_init(); + ctx->is_hashing = true; + ctx->buf_hash = fhp_hash_init(); // set state - fhp->state = FHP_STATE_VERSION; + ctx->state = FHP_STATE_VERSION; goto retry; } @@ -286,36 +286,36 @@ retry: case '\r': case '\n': // flush buffer - if ((err = fhp_buf_flush(fhp, FHP_TOKEN_VERSION_FRAGMENT)) != FHP_OK) + if ((err = fhp_ctx_buf_flush(ctx, FHP_TOKEN_VERSION_FRAGMENT)) != FHP_OK) return err; // send end token - if (!fhp->cb(fhp, FHP_TOKEN_VERSION_END, 0, 0)) + if (!ctx->cb(ctx, FHP_TOKEN_VERSION_END, 0, 0)) return FHP_ERR_CB; // disable buffer hashing - fhp->is_hashing = false; + ctx->is_hashing = false; // get version token - fhp->http_version = FHP_TOKEN_VERSION_OTHER; - if (fhp->buf_hash == fhp->env->hashes[FHP_STR_HTTP_10]) { - fhp->http_version = FHP_TOKEN_VERSION_HTTP_10; - } else if (fhp->buf_hash == fhp->env->hashes[FHP_STR_HTTP_11]) { - fhp->http_version = FHP_TOKEN_VERSION_HTTP_11; + ctx->http_version = FHP_TOKEN_VERSION_OTHER; + if (ctx->buf_hash == ctx->env->hashes[FHP_STR_HTTP_10]) { + ctx->http_version = FHP_TOKEN_VERSION_HTTP_10; + } else if (ctx->buf_hash == ctx->env->hashes[FHP_STR_HTTP_11]) { + ctx->http_version = FHP_TOKEN_VERSION_HTTP_11; } // send version token - if (!fhp->cb(fhp, fhp->http_version, 0, 0)) + if (!ctx->cb(ctx, ctx->http_version, 0, 0)) return FHP_ERR_CB; // set state - fhp->state = FHP_STATE_VERSION_END; + ctx->state = FHP_STATE_VERSION_END; goto retry; break; CASE_VERSION_CHARS // add to buffer - if ((err = fhp_buf_push(fhp, FHP_TOKEN_VERSION_FRAGMENT, byte)) != FHP_OK) + if ((err = fhp_ctx_buf_push(ctx, FHP_TOKEN_VERSION_FRAGMENT, byte)) != FHP_OK) return err; break; @@ -327,11 +327,11 @@ retry: case FHP_STATE_VERSION_END: switch (byte) { case '\r': - fhp->state = FHP_STATE_VERSION_END_CR; + ctx->state = FHP_STATE_VERSION_END_CR; break; case '\n': - fhp->state = FHP_STATE_STATUS_END; + ctx->state = FHP_STATE_STATUS_END; break; default: @@ -344,7 +344,7 @@ retry: case FHP_STATE_VERSION_END_CR: switch (byte) { case '\n': - fhp->state = FHP_STATE_STATUS_END; + ctx->state = FHP_STATE_STATUS_END; break; default: @@ -356,26 +356,26 @@ retry: switch (byte) { CASE_TOKEN_CHARS // send start token - if (!fhp->cb(fhp, FHP_TOKEN_HEADER_NAME_START, 0, 0)) + if (!ctx->cb(ctx, FHP_TOKEN_HEADER_NAME_START, 0, 0)) return FHP_ERR_CB; // enable buffer hashing - fhp->is_hashing = true; - fhp->buf_hash = fhp_hash_init(); + ctx->is_hashing = true; + ctx->buf_hash = fhp_hash_init(); // set state - fhp->state = FHP_STATE_HEADER_NAME; + ctx->state = FHP_STATE_HEADER_NAME; goto retry; break; case '\r': // set state - fhp->state = FHP_STATE_STATUS_END_CR; + ctx->state = FHP_STATE_STATUS_END_CR; break; case '\n': // set state - fhp->state = FHP_STATE_HEADERS_END; + ctx->state = FHP_STATE_HEADERS_END; break; } @@ -385,7 +385,7 @@ retry: switch (byte) { case '\n': // set state - fhp->state = FHP_STATE_HEADERS_END; + ctx->state = FHP_STATE_HEADERS_END; break; default: @@ -397,25 +397,25 @@ retry: switch (byte) { CASE_TOKEN_CHARS // add to buffer - if ((err = fhp_buf_push(fhp, FHP_TOKEN_HEADER_NAME_FRAGMENT, byte)) != FHP_OK) + if ((err = fhp_ctx_buf_push(ctx, FHP_TOKEN_HEADER_NAME_FRAGMENT, byte)) != FHP_OK) return err; break; case ':': // flush buffer - if ((err = fhp_buf_flush(fhp, FHP_TOKEN_HEADER_NAME_FRAGMENT)) != FHP_OK) + if ((err = fhp_ctx_buf_flush(ctx, FHP_TOKEN_HEADER_NAME_FRAGMENT)) != FHP_OK) return err; // disable buffer hashing and cache header name hash - fhp->is_hashing = false; - fhp->header_name_hash = fhp->buf_hash; + ctx->is_hashing = false; + ctx->header_name_hash = ctx->buf_hash; // send end token - if (!fhp->cb(fhp, FHP_TOKEN_HEADER_NAME_END, 0, 0)) + if (!ctx->cb(ctx, FHP_TOKEN_HEADER_NAME_END, 0, 0)) return FHP_ERR_CB; // set state - fhp->state = FHP_STATE_HEADER_NAME_END; + ctx->state = FHP_STATE_HEADER_NAME_END; break; default: @@ -431,16 +431,16 @@ retry: break; default: // send start token - if (!fhp->cb(fhp, FHP_TOKEN_HEADER_VALUE_START, 0, 0)) + if (!ctx->cb(ctx, FHP_TOKEN_HEADER_VALUE_START, 0, 0)) return FHP_ERR_CB; // init header value parser fhp_err_t err; - if ((err = fhp_header_value_parser_init(fhp)) != FHP_OK) + if ((err = fhp_header_value_parser_init(ctx)) != FHP_OK) return err; // set state - fhp->state = FHP_STATE_HEADER_VALUE; + ctx->state = FHP_STATE_HEADER_VALUE; goto retry; break; @@ -450,17 +450,17 @@ retry: case FHP_STATE_HEADER_VALUE: switch (byte) { case '\r': - fhp->state = FHP_STATE_HEADER_VALUE_END_CR; + ctx->state = FHP_STATE_HEADER_VALUE_END_CR; break; case '\n': - fhp->state = FHP_STATE_HEADER_VALUE_END; + ctx->state = FHP_STATE_HEADER_VALUE_END; break; default: // FIXME: need more limits on valid octets // add to buffer - if ((err = fhp_buf_push(fhp, FHP_TOKEN_HEADER_VALUE_FRAGMENT, byte)) != FHP_OK) + if ((err = fhp_ctx_buf_push(ctx, FHP_TOKEN_HEADER_VALUE_FRAGMENT, byte)) != FHP_OK) return err; break; @@ -470,7 +470,7 @@ retry: case FHP_STATE_HEADER_VALUE_END_CR: switch (byte) { case '\n': - fhp->state = FHP_STATE_HEADER_VALUE_END; + ctx->state = FHP_STATE_HEADER_VALUE_END; break; default: return FHP_ERR_INVALID_CHAR; @@ -485,74 +485,74 @@ retry: // add space to buffer // folding to ' ', as per RFC7230 3.2.4 // https://tools.ietf.org/html/rfc7230#section-3.2.4 - if ((err = fhp_buf_push(fhp, FHP_TOKEN_HEADER_VALUE_FRAGMENT, ' ')) != FHP_OK) + if ((err = fhp_ctx_buf_push(ctx, FHP_TOKEN_HEADER_VALUE_FRAGMENT, ' ')) != FHP_OK) return err; // set state - fhp->state = FHP_STATE_HEADER_VALUE; + ctx->state = FHP_STATE_HEADER_VALUE; break; CASE_TOKEN_CHARS // flush buffer - if ((err = fhp_buf_flush(fhp, FHP_TOKEN_HEADER_VALUE_FRAGMENT)) != FHP_OK) + if ((err = fhp_ctx_buf_flush(ctx, FHP_TOKEN_HEADER_VALUE_FRAGMENT)) != FHP_OK) return err; // end header value - if (!fhp->cb(fhp, FHP_TOKEN_HEADER_VALUE_END, 0, 0)) + if (!ctx->cb(ctx, FHP_TOKEN_HEADER_VALUE_END, 0, 0)) return FHP_ERR_CB; // end header value parser - if ((err = fhp_header_value_parser_done(fhp)) != FHP_OK) + if ((err = fhp_header_value_parser_done(ctx)) != FHP_OK) return err; // send start token - if (!fhp->cb(fhp, FHP_TOKEN_HEADER_NAME_START, 0, 0)) + if (!ctx->cb(ctx, FHP_TOKEN_HEADER_NAME_START, 0, 0)) return FHP_ERR_CB; // enable buffer hashing - fhp->is_hashing = true; - fhp->buf_hash = fhp_hash_init(); + ctx->is_hashing = true; + ctx->buf_hash = fhp_hash_init(); // add to buffer - if ((err = fhp_buf_push(fhp, FHP_TOKEN_HEADER_NAME_FRAGMENT, byte)) != FHP_OK) + if ((err = fhp_ctx_buf_push(ctx, FHP_TOKEN_HEADER_NAME_FRAGMENT, byte)) != FHP_OK) return err; // set state - fhp->state = FHP_STATE_HEADER_NAME; + ctx->state = FHP_STATE_HEADER_NAME; break; case '\r': // flush buffer - if ((err = fhp_buf_flush(fhp, FHP_TOKEN_HEADER_VALUE_FRAGMENT)) != FHP_OK) + if ((err = fhp_ctx_buf_flush(ctx, FHP_TOKEN_HEADER_VALUE_FRAGMENT)) != FHP_OK) return err; // end header value - if (!fhp->cb(fhp, FHP_TOKEN_HEADER_VALUE_END, 0, 0)) + if (!ctx->cb(ctx, FHP_TOKEN_HEADER_VALUE_END, 0, 0)) return FHP_ERR_CB; // end header value parser - if ((err = fhp_header_value_parser_done(fhp)) != FHP_OK) + if ((err = fhp_header_value_parser_done(ctx)) != FHP_OK) return err; // set state - fhp->state = FHP_STATE_HEADERS_END_CR; + ctx->state = FHP_STATE_HEADERS_END_CR; break; case '\n': // flush buffer - if ((err = fhp_buf_flush(fhp, FHP_TOKEN_HEADER_VALUE_FRAGMENT)) != FHP_OK) + if ((err = fhp_ctx_buf_flush(ctx, FHP_TOKEN_HEADER_VALUE_FRAGMENT)) != FHP_OK) return err; // end header value - if (!fhp->cb(fhp, FHP_TOKEN_HEADER_VALUE_END, 0, 0)) + if (!ctx->cb(ctx, FHP_TOKEN_HEADER_VALUE_END, 0, 0)) return FHP_ERR_CB; // end header value parser - if ((err = fhp_header_value_parser_done(fhp)) != FHP_OK) + if ((err = fhp_header_value_parser_done(ctx)) != FHP_OK) return err; // set state - fhp->state = FHP_STATE_HEADERS_END; + ctx->state = FHP_STATE_HEADERS_END; break; default: @@ -563,7 +563,7 @@ retry: case FHP_STATE_HEADERS_END_CR: switch (byte) { case '\n': - fhp->state = FHP_STATE_HEADERS_END; + ctx->state = FHP_STATE_HEADERS_END; break; default: @@ -582,32 +582,32 @@ retry: } // increment byte offset - fhp->ofs++; + ctx->ofs++; /* return success */ return FHP_OK; } fhp_err_t -fhp_push( - fhp_t * const fhp, +fhp_ctx_push( + fhp_ctx_t * const ctx, uint8_t * const buf, size_t len ) { - switch (fhp->state) { + switch (ctx->state) { case FHP_STATE_ERROR: - return fhp->err; + return ctx->err; break; default: for (size_t i = 0; i < len; i++) { // push byte - fhp_err_t err = fhp_push_byte(fhp, buf[i]); + fhp_err_t err = fhp_ctx_push_byte(ctx, buf[i]); // check result if (err != FHP_OK) { - fhp->state = FHP_STATE_ERROR; - fhp->err = err; + ctx->state = FHP_STATE_ERROR; + ctx->err = err; return err; } } @@ -618,21 +618,21 @@ fhp_push( } fhp_env_t * -fhp_get_env(fhp_t * const fhp) { - return fhp->env; +fhp_ctx_get_env(fhp_ctx_t * const ctx) { + return ctx->env; } void * -fhp_get_user_data(fhp_t * const fhp) { - return fhp->user_data; +fhp_ctx_get_user_data(fhp_ctx_t * const ctx) { + return ctx->user_data; } size_t -fhp_get_num_tes(fhp_t * const fhp) { - return fhp->num_tes; +fhp_ctx_get_num_tes(fhp_ctx_t * const ctx) { + return ctx->num_tes; } uint64_t -fhp_get_content_length(fhp_t * const fhp) { - return fhp->content_length; +fhp_ctx_get_content_length(fhp_ctx_t * const ctx) { + return ctx->content_length; } -- cgit v1.2.3