1 /* SPDX-License-Identifier: MIT */
2 
3 /* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy
6  * of this software and associated documentation files (the "Software"), to
7  * deal in the Software without restriction, including without limitation the
8  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9  * sell copies of the Software, and to permit persons to whom the Software is
10  * furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in
13  * all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21  * IN THE SOFTWARE.
22  */
23 #ifndef ZEPHYR_INCLUDE_NET_HTTP_PARSER_STATE_H_
24 #define ZEPHYR_INCLUDE_NET_HTTP_PARSER_STATE_H_
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 enum state {
30 	s_dead = 1, /* important that this is > 0 */
31 	s_start_req_or_res,
32 	s_res_or_resp_H,
33 	s_start_res,
34 	s_res_H,
35 	s_res_HT,
36 	s_res_HTT,
37 	s_res_HTTP,
38 	s_res_first_http_major,
39 	s_res_http_major,
40 	s_res_first_http_minor,
41 	s_res_http_minor,
42 	s_res_first_status_code,
43 	s_res_status_code,
44 	s_res_status_start,
45 	s_res_status,
46 	s_res_line_almost_done,
47 	s_start_req,
48 	s_req_method,
49 	s_req_spaces_before_url,
50 	s_req_schema,
51 	s_req_schema_slash,
52 	s_req_schema_slash_slash,
53 	s_req_server_start,
54 	s_req_server,
55 	s_req_server_with_at,
56 	s_req_path,
57 	s_req_query_string_start,
58 	s_req_query_string,
59 	s_req_fragment_start,
60 	s_req_fragment,
61 	s_req_http_start,
62 	s_req_http_H,
63 	s_req_http_HT,
64 	s_req_http_HTT,
65 	s_req_http_HTTP,
66 	s_req_first_http_major,
67 	s_req_http_major,
68 	s_req_first_http_minor,
69 	s_req_http_minor,
70 	s_req_line_almost_done,
71 	s_header_field_start,
72 	s_header_field,
73 	s_header_value_discard_ws,
74 	s_header_value_discard_ws_almost_done,
75 	s_header_value_discard_lws,
76 	s_header_value_start,
77 	s_header_value,
78 	s_header_value_lws,
79 	s_header_almost_done,
80 	s_chunk_size_start,
81 	s_chunk_size,
82 	s_chunk_parameters,
83 	s_chunk_size_almost_done,
84 	s_headers_almost_done,
85 	s_headers_done,
86 	/* Important: 's_headers_done' must be the last 'header' state. All
87 	 * states beyond this must be 'body' states. It is used for overflow
88 	 * checking. See the PARSING_HEADER() macro.
89 	 */
90 	s_chunk_data,
91 	s_chunk_data_almost_done,
92 	s_chunk_data_done,
93 	s_body_identity,
94 	s_body_identity_eof,
95 	s_message_done
96 };
97 
98 #ifdef __cplusplus
99 }
100 #endif
101 #endif
102