From b1c2cf83fd655f1347b76efd65a2206ca2b6676f Mon Sep 17 00:00:00 2001 From: Peter Griess Date: Mon, 23 May 2011 11:42:13 -0500 Subject: [PATCH] Expose F_* flags as public API. Fixes #42. --- http_parser.c | 10 ---------- http_parser.h | 13 ++++++++++++- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/http_parser.c b/http_parser.c index 5991cef..1c30c1d 100644 --- a/http_parser.c +++ b/http_parser.c @@ -314,16 +314,6 @@ enum header_states }; -enum flags - { F_CHUNKED = 1 << 0 - , F_CONNECTION_KEEP_ALIVE = 1 << 1 - , F_CONNECTION_CLOSE = 1 << 2 - , F_TRAILING = 1 << 3 - , F_UPGRADE = 1 << 4 - , F_SKIPBODY = 1 << 5 - }; - - #define CR '\r' #define LF '\n' #define LOWER(c) (unsigned char)(c | 0x20) diff --git a/http_parser.h b/http_parser.h index 9c7a26d..afce3e9 100644 --- a/http_parser.h +++ b/http_parser.h @@ -114,10 +114,21 @@ enum http_method enum http_parser_type { HTTP_REQUEST, HTTP_RESPONSE, HTTP_BOTH }; +/* Flag values for http_parser.flags field */ +enum flags + { F_CHUNKED = 1 << 0 + , F_CONNECTION_KEEP_ALIVE = 1 << 1 + , F_CONNECTION_CLOSE = 1 << 2 + , F_TRAILING = 1 << 3 + , F_UPGRADE = 1 << 4 + , F_SKIPBODY = 1 << 5 + }; + + struct http_parser { /** PRIVATE **/ unsigned char type : 2; - unsigned char flags : 6; + unsigned char flags : 6; /* F_* values from 'flags' enum; semi-public */ unsigned char state; unsigned char header_state; unsigned char index;