summaryrefslogtreecommitdiff
path: root/http_parser.h
diff options
context:
space:
mode:
authorMikhail Burakov <mburakov@mailbox.org>2022-12-25 13:50:41 +0100
committerMikhail Burakov <mburakov@mailbox.org>2022-12-25 13:50:41 +0100
commitd58fcf64d9e7a3f309a706ce6a81eb9a41eb5348 (patch)
tree56ce15a6d0a006d8c8d5e01144216d8d2d46e5f0 /http_parser.h
parent3f1e645ee1410d90b493b2e0034e25d68bd0d3eb (diff)
Cosmetic rework of toolbox
Diffstat (limited to 'http_parser.h')
-rw-r--r--http_parser.h39
1 files changed, 20 insertions, 19 deletions
diff --git a/http_parser.h b/http_parser.h
index 9dffe6b..3c197a1 100644
--- a/http_parser.h
+++ b/http_parser.h
@@ -15,22 +15,23 @@
* along with toolbox. If not, see <https://www.gnu.org/licenses/>.
*/
-#ifndef HTTP_PARSER_H_
-#define HTTP_PARSER_H_
+#ifndef TOOLBOX_HTTP_PARSER_H_
+#define TOOLBOX_HTTP_PARSER_H_
+#include <stdbool.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
-enum HttpParser_Result {
- kHttpParser_ResultFinished = 0,
- kHttpParser_ResultWantMore,
- kHttpParser_ResultError,
+enum HttpParserResult {
+ kHttpParserResultFinished = 0,
+ kHttpParserResultWantMore,
+ kHttpParserResultError,
};
-struct HttpParser_Callbacks {
+struct HttpParserCallbacks {
void (*on_request)(void* user, const char* method, size_t method_size,
const char* target, size_t target_size);
void (*on_field)(void* user, const char* name, size_t name_size,
@@ -38,15 +39,15 @@ struct HttpParser_Callbacks {
void (*on_finished)(void* user, size_t offset);
};
-struct HttpParser_State;
+struct HttpParserState;
-typedef enum HttpParser_Result (*HttpParser_Handler)(
- struct HttpParser_State*, const void*, size_t,
- const struct HttpParser_Callbacks*, void*);
+typedef enum HttpParserResult (*HttpParserHandler)(
+ struct HttpParserState*, const void*, size_t,
+ const struct HttpParserCallbacks*, void*);
-struct HttpParser_State {
- HttpParser_Handler stage;
- int maybe_eol;
+struct HttpParserState {
+ HttpParserHandler stage;
+ bool maybe_eol;
size_t parsing_offset;
size_t first_offset;
size_t first_size;
@@ -54,13 +55,13 @@ struct HttpParser_State {
size_t second_size;
};
-void HttpParser_Reset(struct HttpParser_State* state);
-enum HttpParser_Result HttpParser_Parse(
- struct HttpParser_State* state, const void* buffer, size_t buffer_size,
- const struct HttpParser_Callbacks* callbacks, void* user);
+void HttpParserReset(struct HttpParserState* state);
+enum HttpParserResult HttpParserParse(
+ struct HttpParserState* state, const void* buffer, size_t buffer_size,
+ const struct HttpParserCallbacks* callbacks, void* user);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
-#endif // HTTP_PARSER_H_
+#endif // TOOLBOX_HTTP_PARSER_H_