12c593315Sopenharmony_ci 22c593315Sopenharmony_ci#ifndef INCLUDE_LLHTTP_H_ 32c593315Sopenharmony_ci#define INCLUDE_LLHTTP_H_ 42c593315Sopenharmony_ci 52c593315Sopenharmony_ci#define LLHTTP_VERSION_MAJOR 9 62c593315Sopenharmony_ci#define LLHTTP_VERSION_MINOR 0 72c593315Sopenharmony_ci#define LLHTTP_VERSION_PATCH 1 82c593315Sopenharmony_ci 92c593315Sopenharmony_ci#ifndef INCLUDE_LLHTTP_ITSELF_H_ 102c593315Sopenharmony_ci#define INCLUDE_LLHTTP_ITSELF_H_ 112c593315Sopenharmony_ci#ifdef __cplusplus 122c593315Sopenharmony_ciextern "C" { 132c593315Sopenharmony_ci#endif 142c593315Sopenharmony_ci 152c593315Sopenharmony_ci#include <stdint.h> 162c593315Sopenharmony_ci 172c593315Sopenharmony_citypedef struct llhttp__internal_s llhttp__internal_t; 182c593315Sopenharmony_cistruct llhttp__internal_s { 192c593315Sopenharmony_ci int32_t _index; 202c593315Sopenharmony_ci void* _span_pos0; 212c593315Sopenharmony_ci void* _span_cb0; 222c593315Sopenharmony_ci int32_t error; 232c593315Sopenharmony_ci const char* reason; 242c593315Sopenharmony_ci const char* error_pos; 252c593315Sopenharmony_ci void* data; 262c593315Sopenharmony_ci void* _current; 272c593315Sopenharmony_ci uint64_t content_length; 282c593315Sopenharmony_ci uint8_t type; 292c593315Sopenharmony_ci uint8_t method; 302c593315Sopenharmony_ci uint8_t http_major; 312c593315Sopenharmony_ci uint8_t http_minor; 322c593315Sopenharmony_ci uint8_t header_state; 332c593315Sopenharmony_ci uint8_t lenient_flags; 342c593315Sopenharmony_ci uint8_t upgrade; 352c593315Sopenharmony_ci uint8_t finish; 362c593315Sopenharmony_ci uint16_t flags; 372c593315Sopenharmony_ci uint16_t status_code; 382c593315Sopenharmony_ci uint8_t initial_message_completed; 392c593315Sopenharmony_ci void* settings; 402c593315Sopenharmony_ci}; 412c593315Sopenharmony_ci 422c593315Sopenharmony_ciint llhttp__internal_init(llhttp__internal_t* s); 432c593315Sopenharmony_ciint llhttp__internal_execute(llhttp__internal_t* s, const char* p, const char* endp); 442c593315Sopenharmony_ci 452c593315Sopenharmony_ci#ifdef __cplusplus 462c593315Sopenharmony_ci} /* extern "C" */ 472c593315Sopenharmony_ci#endif 482c593315Sopenharmony_ci#endif /* INCLUDE_LLHTTP_ITSELF_H_ */ 492c593315Sopenharmony_ci 502c593315Sopenharmony_ci 512c593315Sopenharmony_ci#ifndef LLLLHTTP_C_HEADERS_ 522c593315Sopenharmony_ci#define LLLLHTTP_C_HEADERS_ 532c593315Sopenharmony_ci#ifdef __cplusplus 542c593315Sopenharmony_ciextern "C" { 552c593315Sopenharmony_ci#endif 562c593315Sopenharmony_ci 572c593315Sopenharmony_cienum llhttp_errno { 582c593315Sopenharmony_ci HPE_OK = 0, 592c593315Sopenharmony_ci HPE_INTERNAL = 1, 602c593315Sopenharmony_ci HPE_STRICT = 2, 612c593315Sopenharmony_ci HPE_CR_EXPECTED = 25, 622c593315Sopenharmony_ci HPE_LF_EXPECTED = 3, 632c593315Sopenharmony_ci HPE_UNEXPECTED_CONTENT_LENGTH = 4, 642c593315Sopenharmony_ci HPE_UNEXPECTED_SPACE = 30, 652c593315Sopenharmony_ci HPE_CLOSED_CONNECTION = 5, 662c593315Sopenharmony_ci HPE_INVALID_METHOD = 6, 672c593315Sopenharmony_ci HPE_INVALID_URL = 7, 682c593315Sopenharmony_ci HPE_INVALID_CONSTANT = 8, 692c593315Sopenharmony_ci HPE_INVALID_VERSION = 9, 702c593315Sopenharmony_ci HPE_INVALID_HEADER_TOKEN = 10, 712c593315Sopenharmony_ci HPE_INVALID_CONTENT_LENGTH = 11, 722c593315Sopenharmony_ci HPE_INVALID_CHUNK_SIZE = 12, 732c593315Sopenharmony_ci HPE_INVALID_STATUS = 13, 742c593315Sopenharmony_ci HPE_INVALID_EOF_STATE = 14, 752c593315Sopenharmony_ci HPE_INVALID_TRANSFER_ENCODING = 15, 762c593315Sopenharmony_ci HPE_CB_MESSAGE_BEGIN = 16, 772c593315Sopenharmony_ci HPE_CB_HEADERS_COMPLETE = 17, 782c593315Sopenharmony_ci HPE_CB_MESSAGE_COMPLETE = 18, 792c593315Sopenharmony_ci HPE_CB_CHUNK_HEADER = 19, 802c593315Sopenharmony_ci HPE_CB_CHUNK_COMPLETE = 20, 812c593315Sopenharmony_ci HPE_PAUSED = 21, 822c593315Sopenharmony_ci HPE_PAUSED_UPGRADE = 22, 832c593315Sopenharmony_ci HPE_PAUSED_H2_UPGRADE = 23, 842c593315Sopenharmony_ci HPE_USER = 24, 852c593315Sopenharmony_ci HPE_CB_URL_COMPLETE = 26, 862c593315Sopenharmony_ci HPE_CB_STATUS_COMPLETE = 27, 872c593315Sopenharmony_ci HPE_CB_METHOD_COMPLETE = 32, 882c593315Sopenharmony_ci HPE_CB_VERSION_COMPLETE = 33, 892c593315Sopenharmony_ci HPE_CB_HEADER_FIELD_COMPLETE = 28, 902c593315Sopenharmony_ci HPE_CB_HEADER_VALUE_COMPLETE = 29, 912c593315Sopenharmony_ci HPE_CB_CHUNK_EXTENSION_NAME_COMPLETE = 34, 922c593315Sopenharmony_ci HPE_CB_CHUNK_EXTENSION_VALUE_COMPLETE = 35, 932c593315Sopenharmony_ci HPE_CB_RESET = 31 942c593315Sopenharmony_ci}; 952c593315Sopenharmony_citypedef enum llhttp_errno llhttp_errno_t; 962c593315Sopenharmony_ci 972c593315Sopenharmony_cienum llhttp_flags { 982c593315Sopenharmony_ci F_CONNECTION_KEEP_ALIVE = 0x1, 992c593315Sopenharmony_ci F_CONNECTION_CLOSE = 0x2, 1002c593315Sopenharmony_ci F_CONNECTION_UPGRADE = 0x4, 1012c593315Sopenharmony_ci F_CHUNKED = 0x8, 1022c593315Sopenharmony_ci F_UPGRADE = 0x10, 1032c593315Sopenharmony_ci F_CONTENT_LENGTH = 0x20, 1042c593315Sopenharmony_ci F_SKIPBODY = 0x40, 1052c593315Sopenharmony_ci F_TRAILING = 0x80, 1062c593315Sopenharmony_ci F_TRANSFER_ENCODING = 0x200 1072c593315Sopenharmony_ci}; 1082c593315Sopenharmony_citypedef enum llhttp_flags llhttp_flags_t; 1092c593315Sopenharmony_ci 1102c593315Sopenharmony_cienum llhttp_lenient_flags { 1112c593315Sopenharmony_ci LENIENT_HEADERS = 0x1, 1122c593315Sopenharmony_ci LENIENT_CHUNKED_LENGTH = 0x2, 1132c593315Sopenharmony_ci LENIENT_KEEP_ALIVE = 0x4, 1142c593315Sopenharmony_ci LENIENT_TRANSFER_ENCODING = 0x8, 1152c593315Sopenharmony_ci LENIENT_VERSION = 0x10, 1162c593315Sopenharmony_ci LENIENT_DATA_AFTER_CLOSE = 0x20, 1172c593315Sopenharmony_ci LENIENT_OPTIONAL_LF_AFTER_CR = 0x40, 1182c593315Sopenharmony_ci LENIENT_OPTIONAL_CRLF_AFTER_CHUNK = 0x80 1192c593315Sopenharmony_ci}; 1202c593315Sopenharmony_citypedef enum llhttp_lenient_flags llhttp_lenient_flags_t; 1212c593315Sopenharmony_ci 1222c593315Sopenharmony_cienum llhttp_type { 1232c593315Sopenharmony_ci HTTP_BOTH = 0, 1242c593315Sopenharmony_ci HTTP_REQUEST = 1, 1252c593315Sopenharmony_ci HTTP_RESPONSE = 2 1262c593315Sopenharmony_ci}; 1272c593315Sopenharmony_citypedef enum llhttp_type llhttp_type_t; 1282c593315Sopenharmony_ci 1292c593315Sopenharmony_cienum llhttp_finish { 1302c593315Sopenharmony_ci HTTP_FINISH_SAFE = 0, 1312c593315Sopenharmony_ci HTTP_FINISH_SAFE_WITH_CB = 1, 1322c593315Sopenharmony_ci HTTP_FINISH_UNSAFE = 2 1332c593315Sopenharmony_ci}; 1342c593315Sopenharmony_citypedef enum llhttp_finish llhttp_finish_t; 1352c593315Sopenharmony_ci 1362c593315Sopenharmony_cienum llhttp_method { 1372c593315Sopenharmony_ci HTTP_DELETE = 0, 1382c593315Sopenharmony_ci HTTP_GET = 1, 1392c593315Sopenharmony_ci HTTP_HEAD = 2, 1402c593315Sopenharmony_ci HTTP_POST = 3, 1412c593315Sopenharmony_ci HTTP_PUT = 4, 1422c593315Sopenharmony_ci HTTP_CONNECT = 5, 1432c593315Sopenharmony_ci HTTP_OPTIONS = 6, 1442c593315Sopenharmony_ci HTTP_TRACE = 7, 1452c593315Sopenharmony_ci HTTP_COPY = 8, 1462c593315Sopenharmony_ci HTTP_LOCK = 9, 1472c593315Sopenharmony_ci HTTP_MKCOL = 10, 1482c593315Sopenharmony_ci HTTP_MOVE = 11, 1492c593315Sopenharmony_ci HTTP_PROPFIND = 12, 1502c593315Sopenharmony_ci HTTP_PROPPATCH = 13, 1512c593315Sopenharmony_ci HTTP_SEARCH = 14, 1522c593315Sopenharmony_ci HTTP_UNLOCK = 15, 1532c593315Sopenharmony_ci HTTP_BIND = 16, 1542c593315Sopenharmony_ci HTTP_REBIND = 17, 1552c593315Sopenharmony_ci HTTP_UNBIND = 18, 1562c593315Sopenharmony_ci HTTP_ACL = 19, 1572c593315Sopenharmony_ci HTTP_REPORT = 20, 1582c593315Sopenharmony_ci HTTP_MKACTIVITY = 21, 1592c593315Sopenharmony_ci HTTP_CHECKOUT = 22, 1602c593315Sopenharmony_ci HTTP_MERGE = 23, 1612c593315Sopenharmony_ci HTTP_MSEARCH = 24, 1622c593315Sopenharmony_ci HTTP_NOTIFY = 25, 1632c593315Sopenharmony_ci HTTP_SUBSCRIBE = 26, 1642c593315Sopenharmony_ci HTTP_UNSUBSCRIBE = 27, 1652c593315Sopenharmony_ci HTTP_PATCH = 28, 1662c593315Sopenharmony_ci HTTP_PURGE = 29, 1672c593315Sopenharmony_ci HTTP_MKCALENDAR = 30, 1682c593315Sopenharmony_ci HTTP_LINK = 31, 1692c593315Sopenharmony_ci HTTP_UNLINK = 32, 1702c593315Sopenharmony_ci HTTP_SOURCE = 33, 1712c593315Sopenharmony_ci HTTP_PRI = 34, 1722c593315Sopenharmony_ci HTTP_DESCRIBE = 35, 1732c593315Sopenharmony_ci HTTP_ANNOUNCE = 36, 1742c593315Sopenharmony_ci HTTP_SETUP = 37, 1752c593315Sopenharmony_ci HTTP_PLAY = 38, 1762c593315Sopenharmony_ci HTTP_PAUSE = 39, 1772c593315Sopenharmony_ci HTTP_TEARDOWN = 40, 1782c593315Sopenharmony_ci HTTP_GET_PARAMETER = 41, 1792c593315Sopenharmony_ci HTTP_SET_PARAMETER = 42, 1802c593315Sopenharmony_ci HTTP_REDIRECT = 43, 1812c593315Sopenharmony_ci HTTP_RECORD = 44, 1822c593315Sopenharmony_ci HTTP_FLUSH = 45 1832c593315Sopenharmony_ci}; 1842c593315Sopenharmony_citypedef enum llhttp_method llhttp_method_t; 1852c593315Sopenharmony_ci 1862c593315Sopenharmony_cienum llhttp_status { 1872c593315Sopenharmony_ci HTTP_STATUS_CONTINUE = 100, 1882c593315Sopenharmony_ci HTTP_STATUS_SWITCHING_PROTOCOLS = 101, 1892c593315Sopenharmony_ci HTTP_STATUS_PROCESSING = 102, 1902c593315Sopenharmony_ci HTTP_STATUS_EARLY_HINTS = 103, 1912c593315Sopenharmony_ci HTTP_STATUS_RESPONSE_IS_STALE = 110, 1922c593315Sopenharmony_ci HTTP_STATUS_REVALIDATION_FAILED = 111, 1932c593315Sopenharmony_ci HTTP_STATUS_DISCONNECTED_OPERATION = 112, 1942c593315Sopenharmony_ci HTTP_STATUS_HEURISTIC_EXPIRATION = 113, 1952c593315Sopenharmony_ci HTTP_STATUS_MISCELLANEOUS_WARNING = 199, 1962c593315Sopenharmony_ci HTTP_STATUS_OK = 200, 1972c593315Sopenharmony_ci HTTP_STATUS_CREATED = 201, 1982c593315Sopenharmony_ci HTTP_STATUS_ACCEPTED = 202, 1992c593315Sopenharmony_ci HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION = 203, 2002c593315Sopenharmony_ci HTTP_STATUS_NO_CONTENT = 204, 2012c593315Sopenharmony_ci HTTP_STATUS_RESET_CONTENT = 205, 2022c593315Sopenharmony_ci HTTP_STATUS_PARTIAL_CONTENT = 206, 2032c593315Sopenharmony_ci HTTP_STATUS_MULTI_STATUS = 207, 2042c593315Sopenharmony_ci HTTP_STATUS_ALREADY_REPORTED = 208, 2052c593315Sopenharmony_ci HTTP_STATUS_TRANSFORMATION_APPLIED = 214, 2062c593315Sopenharmony_ci HTTP_STATUS_IM_USED = 226, 2072c593315Sopenharmony_ci HTTP_STATUS_MISCELLANEOUS_PERSISTENT_WARNING = 299, 2082c593315Sopenharmony_ci HTTP_STATUS_MULTIPLE_CHOICES = 300, 2092c593315Sopenharmony_ci HTTP_STATUS_MOVED_PERMANENTLY = 301, 2102c593315Sopenharmony_ci HTTP_STATUS_FOUND = 302, 2112c593315Sopenharmony_ci HTTP_STATUS_SEE_OTHER = 303, 2122c593315Sopenharmony_ci HTTP_STATUS_NOT_MODIFIED = 304, 2132c593315Sopenharmony_ci HTTP_STATUS_USE_PROXY = 305, 2142c593315Sopenharmony_ci HTTP_STATUS_SWITCH_PROXY = 306, 2152c593315Sopenharmony_ci HTTP_STATUS_TEMPORARY_REDIRECT = 307, 2162c593315Sopenharmony_ci HTTP_STATUS_PERMANENT_REDIRECT = 308, 2172c593315Sopenharmony_ci HTTP_STATUS_BAD_REQUEST = 400, 2182c593315Sopenharmony_ci HTTP_STATUS_UNAUTHORIZED = 401, 2192c593315Sopenharmony_ci HTTP_STATUS_PAYMENT_REQUIRED = 402, 2202c593315Sopenharmony_ci HTTP_STATUS_FORBIDDEN = 403, 2212c593315Sopenharmony_ci HTTP_STATUS_NOT_FOUND = 404, 2222c593315Sopenharmony_ci HTTP_STATUS_METHOD_NOT_ALLOWED = 405, 2232c593315Sopenharmony_ci HTTP_STATUS_NOT_ACCEPTABLE = 406, 2242c593315Sopenharmony_ci HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED = 407, 2252c593315Sopenharmony_ci HTTP_STATUS_REQUEST_TIMEOUT = 408, 2262c593315Sopenharmony_ci HTTP_STATUS_CONFLICT = 409, 2272c593315Sopenharmony_ci HTTP_STATUS_GONE = 410, 2282c593315Sopenharmony_ci HTTP_STATUS_LENGTH_REQUIRED = 411, 2292c593315Sopenharmony_ci HTTP_STATUS_PRECONDITION_FAILED = 412, 2302c593315Sopenharmony_ci HTTP_STATUS_PAYLOAD_TOO_LARGE = 413, 2312c593315Sopenharmony_ci HTTP_STATUS_URI_TOO_LONG = 414, 2322c593315Sopenharmony_ci HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE = 415, 2332c593315Sopenharmony_ci HTTP_STATUS_RANGE_NOT_SATISFIABLE = 416, 2342c593315Sopenharmony_ci HTTP_STATUS_EXPECTATION_FAILED = 417, 2352c593315Sopenharmony_ci HTTP_STATUS_IM_A_TEAPOT = 418, 2362c593315Sopenharmony_ci HTTP_STATUS_PAGE_EXPIRED = 419, 2372c593315Sopenharmony_ci HTTP_STATUS_ENHANCE_YOUR_CALM = 420, 2382c593315Sopenharmony_ci HTTP_STATUS_MISDIRECTED_REQUEST = 421, 2392c593315Sopenharmony_ci HTTP_STATUS_UNPROCESSABLE_ENTITY = 422, 2402c593315Sopenharmony_ci HTTP_STATUS_LOCKED = 423, 2412c593315Sopenharmony_ci HTTP_STATUS_FAILED_DEPENDENCY = 424, 2422c593315Sopenharmony_ci HTTP_STATUS_TOO_EARLY = 425, 2432c593315Sopenharmony_ci HTTP_STATUS_UPGRADE_REQUIRED = 426, 2442c593315Sopenharmony_ci HTTP_STATUS_PRECONDITION_REQUIRED = 428, 2452c593315Sopenharmony_ci HTTP_STATUS_TOO_MANY_REQUESTS = 429, 2462c593315Sopenharmony_ci HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE_UNOFFICIAL = 430, 2472c593315Sopenharmony_ci HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE = 431, 2482c593315Sopenharmony_ci HTTP_STATUS_LOGIN_TIMEOUT = 440, 2492c593315Sopenharmony_ci HTTP_STATUS_NO_RESPONSE = 444, 2502c593315Sopenharmony_ci HTTP_STATUS_RETRY_WITH = 449, 2512c593315Sopenharmony_ci HTTP_STATUS_BLOCKED_BY_PARENTAL_CONTROL = 450, 2522c593315Sopenharmony_ci HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS = 451, 2532c593315Sopenharmony_ci HTTP_STATUS_CLIENT_CLOSED_LOAD_BALANCED_REQUEST = 460, 2542c593315Sopenharmony_ci HTTP_STATUS_INVALID_X_FORWARDED_FOR = 463, 2552c593315Sopenharmony_ci HTTP_STATUS_REQUEST_HEADER_TOO_LARGE = 494, 2562c593315Sopenharmony_ci HTTP_STATUS_SSL_CERTIFICATE_ERROR = 495, 2572c593315Sopenharmony_ci HTTP_STATUS_SSL_CERTIFICATE_REQUIRED = 496, 2582c593315Sopenharmony_ci HTTP_STATUS_HTTP_REQUEST_SENT_TO_HTTPS_PORT = 497, 2592c593315Sopenharmony_ci HTTP_STATUS_INVALID_TOKEN = 498, 2602c593315Sopenharmony_ci HTTP_STATUS_CLIENT_CLOSED_REQUEST = 499, 2612c593315Sopenharmony_ci HTTP_STATUS_INTERNAL_SERVER_ERROR = 500, 2622c593315Sopenharmony_ci HTTP_STATUS_NOT_IMPLEMENTED = 501, 2632c593315Sopenharmony_ci HTTP_STATUS_BAD_GATEWAY = 502, 2642c593315Sopenharmony_ci HTTP_STATUS_SERVICE_UNAVAILABLE = 503, 2652c593315Sopenharmony_ci HTTP_STATUS_GATEWAY_TIMEOUT = 504, 2662c593315Sopenharmony_ci HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED = 505, 2672c593315Sopenharmony_ci HTTP_STATUS_VARIANT_ALSO_NEGOTIATES = 506, 2682c593315Sopenharmony_ci HTTP_STATUS_INSUFFICIENT_STORAGE = 507, 2692c593315Sopenharmony_ci HTTP_STATUS_LOOP_DETECTED = 508, 2702c593315Sopenharmony_ci HTTP_STATUS_BANDWIDTH_LIMIT_EXCEEDED = 509, 2712c593315Sopenharmony_ci HTTP_STATUS_NOT_EXTENDED = 510, 2722c593315Sopenharmony_ci HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED = 511, 2732c593315Sopenharmony_ci HTTP_STATUS_WEB_SERVER_UNKNOWN_ERROR = 520, 2742c593315Sopenharmony_ci HTTP_STATUS_WEB_SERVER_IS_DOWN = 521, 2752c593315Sopenharmony_ci HTTP_STATUS_CONNECTION_TIMEOUT = 522, 2762c593315Sopenharmony_ci HTTP_STATUS_ORIGIN_IS_UNREACHABLE = 523, 2772c593315Sopenharmony_ci HTTP_STATUS_TIMEOUT_OCCURED = 524, 2782c593315Sopenharmony_ci HTTP_STATUS_SSL_HANDSHAKE_FAILED = 525, 2792c593315Sopenharmony_ci HTTP_STATUS_INVALID_SSL_CERTIFICATE = 526, 2802c593315Sopenharmony_ci HTTP_STATUS_RAILGUN_ERROR = 527, 2812c593315Sopenharmony_ci HTTP_STATUS_SITE_IS_OVERLOADED = 529, 2822c593315Sopenharmony_ci HTTP_STATUS_SITE_IS_FROZEN = 530, 2832c593315Sopenharmony_ci HTTP_STATUS_IDENTITY_PROVIDER_AUTHENTICATION_ERROR = 561, 2842c593315Sopenharmony_ci HTTP_STATUS_NETWORK_READ_TIMEOUT = 598, 2852c593315Sopenharmony_ci HTTP_STATUS_NETWORK_CONNECT_TIMEOUT = 599 2862c593315Sopenharmony_ci}; 2872c593315Sopenharmony_citypedef enum llhttp_status llhttp_status_t; 2882c593315Sopenharmony_ci 2892c593315Sopenharmony_ci#define HTTP_ERRNO_MAP(XX) \ 2902c593315Sopenharmony_ci XX(0, OK, OK) \ 2912c593315Sopenharmony_ci XX(1, INTERNAL, INTERNAL) \ 2922c593315Sopenharmony_ci XX(2, STRICT, STRICT) \ 2932c593315Sopenharmony_ci XX(25, CR_EXPECTED, CR_EXPECTED) \ 2942c593315Sopenharmony_ci XX(3, LF_EXPECTED, LF_EXPECTED) \ 2952c593315Sopenharmony_ci XX(4, UNEXPECTED_CONTENT_LENGTH, UNEXPECTED_CONTENT_LENGTH) \ 2962c593315Sopenharmony_ci XX(30, UNEXPECTED_SPACE, UNEXPECTED_SPACE) \ 2972c593315Sopenharmony_ci XX(5, CLOSED_CONNECTION, CLOSED_CONNECTION) \ 2982c593315Sopenharmony_ci XX(6, INVALID_METHOD, INVALID_METHOD) \ 2992c593315Sopenharmony_ci XX(7, INVALID_URL, INVALID_URL) \ 3002c593315Sopenharmony_ci XX(8, INVALID_CONSTANT, INVALID_CONSTANT) \ 3012c593315Sopenharmony_ci XX(9, INVALID_VERSION, INVALID_VERSION) \ 3022c593315Sopenharmony_ci XX(10, INVALID_HEADER_TOKEN, INVALID_HEADER_TOKEN) \ 3032c593315Sopenharmony_ci XX(11, INVALID_CONTENT_LENGTH, INVALID_CONTENT_LENGTH) \ 3042c593315Sopenharmony_ci XX(12, INVALID_CHUNK_SIZE, INVALID_CHUNK_SIZE) \ 3052c593315Sopenharmony_ci XX(13, INVALID_STATUS, INVALID_STATUS) \ 3062c593315Sopenharmony_ci XX(14, INVALID_EOF_STATE, INVALID_EOF_STATE) \ 3072c593315Sopenharmony_ci XX(15, INVALID_TRANSFER_ENCODING, INVALID_TRANSFER_ENCODING) \ 3082c593315Sopenharmony_ci XX(16, CB_MESSAGE_BEGIN, CB_MESSAGE_BEGIN) \ 3092c593315Sopenharmony_ci XX(17, CB_HEADERS_COMPLETE, CB_HEADERS_COMPLETE) \ 3102c593315Sopenharmony_ci XX(18, CB_MESSAGE_COMPLETE, CB_MESSAGE_COMPLETE) \ 3112c593315Sopenharmony_ci XX(19, CB_CHUNK_HEADER, CB_CHUNK_HEADER) \ 3122c593315Sopenharmony_ci XX(20, CB_CHUNK_COMPLETE, CB_CHUNK_COMPLETE) \ 3132c593315Sopenharmony_ci XX(21, PAUSED, PAUSED) \ 3142c593315Sopenharmony_ci XX(22, PAUSED_UPGRADE, PAUSED_UPGRADE) \ 3152c593315Sopenharmony_ci XX(23, PAUSED_H2_UPGRADE, PAUSED_H2_UPGRADE) \ 3162c593315Sopenharmony_ci XX(24, USER, USER) \ 3172c593315Sopenharmony_ci XX(26, CB_URL_COMPLETE, CB_URL_COMPLETE) \ 3182c593315Sopenharmony_ci XX(27, CB_STATUS_COMPLETE, CB_STATUS_COMPLETE) \ 3192c593315Sopenharmony_ci XX(32, CB_METHOD_COMPLETE, CB_METHOD_COMPLETE) \ 3202c593315Sopenharmony_ci XX(33, CB_VERSION_COMPLETE, CB_VERSION_COMPLETE) \ 3212c593315Sopenharmony_ci XX(28, CB_HEADER_FIELD_COMPLETE, CB_HEADER_FIELD_COMPLETE) \ 3222c593315Sopenharmony_ci XX(29, CB_HEADER_VALUE_COMPLETE, CB_HEADER_VALUE_COMPLETE) \ 3232c593315Sopenharmony_ci XX(34, CB_CHUNK_EXTENSION_NAME_COMPLETE, CB_CHUNK_EXTENSION_NAME_COMPLETE) \ 3242c593315Sopenharmony_ci XX(35, CB_CHUNK_EXTENSION_VALUE_COMPLETE, CB_CHUNK_EXTENSION_VALUE_COMPLETE) \ 3252c593315Sopenharmony_ci XX(31, CB_RESET, CB_RESET) \ 3262c593315Sopenharmony_ci 3272c593315Sopenharmony_ci 3282c593315Sopenharmony_ci#define HTTP_METHOD_MAP(XX) \ 3292c593315Sopenharmony_ci XX(0, DELETE, DELETE) \ 3302c593315Sopenharmony_ci XX(1, GET, GET) \ 3312c593315Sopenharmony_ci XX(2, HEAD, HEAD) \ 3322c593315Sopenharmony_ci XX(3, POST, POST) \ 3332c593315Sopenharmony_ci XX(4, PUT, PUT) \ 3342c593315Sopenharmony_ci XX(5, CONNECT, CONNECT) \ 3352c593315Sopenharmony_ci XX(6, OPTIONS, OPTIONS) \ 3362c593315Sopenharmony_ci XX(7, TRACE, TRACE) \ 3372c593315Sopenharmony_ci XX(8, COPY, COPY) \ 3382c593315Sopenharmony_ci XX(9, LOCK, LOCK) \ 3392c593315Sopenharmony_ci XX(10, MKCOL, MKCOL) \ 3402c593315Sopenharmony_ci XX(11, MOVE, MOVE) \ 3412c593315Sopenharmony_ci XX(12, PROPFIND, PROPFIND) \ 3422c593315Sopenharmony_ci XX(13, PROPPATCH, PROPPATCH) \ 3432c593315Sopenharmony_ci XX(14, SEARCH, SEARCH) \ 3442c593315Sopenharmony_ci XX(15, UNLOCK, UNLOCK) \ 3452c593315Sopenharmony_ci XX(16, BIND, BIND) \ 3462c593315Sopenharmony_ci XX(17, REBIND, REBIND) \ 3472c593315Sopenharmony_ci XX(18, UNBIND, UNBIND) \ 3482c593315Sopenharmony_ci XX(19, ACL, ACL) \ 3492c593315Sopenharmony_ci XX(20, REPORT, REPORT) \ 3502c593315Sopenharmony_ci XX(21, MKACTIVITY, MKACTIVITY) \ 3512c593315Sopenharmony_ci XX(22, CHECKOUT, CHECKOUT) \ 3522c593315Sopenharmony_ci XX(23, MERGE, MERGE) \ 3532c593315Sopenharmony_ci XX(24, MSEARCH, M-SEARCH) \ 3542c593315Sopenharmony_ci XX(25, NOTIFY, NOTIFY) \ 3552c593315Sopenharmony_ci XX(26, SUBSCRIBE, SUBSCRIBE) \ 3562c593315Sopenharmony_ci XX(27, UNSUBSCRIBE, UNSUBSCRIBE) \ 3572c593315Sopenharmony_ci XX(28, PATCH, PATCH) \ 3582c593315Sopenharmony_ci XX(29, PURGE, PURGE) \ 3592c593315Sopenharmony_ci XX(30, MKCALENDAR, MKCALENDAR) \ 3602c593315Sopenharmony_ci XX(31, LINK, LINK) \ 3612c593315Sopenharmony_ci XX(32, UNLINK, UNLINK) \ 3622c593315Sopenharmony_ci XX(33, SOURCE, SOURCE) \ 3632c593315Sopenharmony_ci 3642c593315Sopenharmony_ci 3652c593315Sopenharmony_ci#define RTSP_METHOD_MAP(XX) \ 3662c593315Sopenharmony_ci XX(1, GET, GET) \ 3672c593315Sopenharmony_ci XX(3, POST, POST) \ 3682c593315Sopenharmony_ci XX(6, OPTIONS, OPTIONS) \ 3692c593315Sopenharmony_ci XX(35, DESCRIBE, DESCRIBE) \ 3702c593315Sopenharmony_ci XX(36, ANNOUNCE, ANNOUNCE) \ 3712c593315Sopenharmony_ci XX(37, SETUP, SETUP) \ 3722c593315Sopenharmony_ci XX(38, PLAY, PLAY) \ 3732c593315Sopenharmony_ci XX(39, PAUSE, PAUSE) \ 3742c593315Sopenharmony_ci XX(40, TEARDOWN, TEARDOWN) \ 3752c593315Sopenharmony_ci XX(41, GET_PARAMETER, GET_PARAMETER) \ 3762c593315Sopenharmony_ci XX(42, SET_PARAMETER, SET_PARAMETER) \ 3772c593315Sopenharmony_ci XX(43, REDIRECT, REDIRECT) \ 3782c593315Sopenharmony_ci XX(44, RECORD, RECORD) \ 3792c593315Sopenharmony_ci XX(45, FLUSH, FLUSH) \ 3802c593315Sopenharmony_ci 3812c593315Sopenharmony_ci 3822c593315Sopenharmony_ci#define HTTP_ALL_METHOD_MAP(XX) \ 3832c593315Sopenharmony_ci XX(0, DELETE, DELETE) \ 3842c593315Sopenharmony_ci XX(1, GET, GET) \ 3852c593315Sopenharmony_ci XX(2, HEAD, HEAD) \ 3862c593315Sopenharmony_ci XX(3, POST, POST) \ 3872c593315Sopenharmony_ci XX(4, PUT, PUT) \ 3882c593315Sopenharmony_ci XX(5, CONNECT, CONNECT) \ 3892c593315Sopenharmony_ci XX(6, OPTIONS, OPTIONS) \ 3902c593315Sopenharmony_ci XX(7, TRACE, TRACE) \ 3912c593315Sopenharmony_ci XX(8, COPY, COPY) \ 3922c593315Sopenharmony_ci XX(9, LOCK, LOCK) \ 3932c593315Sopenharmony_ci XX(10, MKCOL, MKCOL) \ 3942c593315Sopenharmony_ci XX(11, MOVE, MOVE) \ 3952c593315Sopenharmony_ci XX(12, PROPFIND, PROPFIND) \ 3962c593315Sopenharmony_ci XX(13, PROPPATCH, PROPPATCH) \ 3972c593315Sopenharmony_ci XX(14, SEARCH, SEARCH) \ 3982c593315Sopenharmony_ci XX(15, UNLOCK, UNLOCK) \ 3992c593315Sopenharmony_ci XX(16, BIND, BIND) \ 4002c593315Sopenharmony_ci XX(17, REBIND, REBIND) \ 4012c593315Sopenharmony_ci XX(18, UNBIND, UNBIND) \ 4022c593315Sopenharmony_ci XX(19, ACL, ACL) \ 4032c593315Sopenharmony_ci XX(20, REPORT, REPORT) \ 4042c593315Sopenharmony_ci XX(21, MKACTIVITY, MKACTIVITY) \ 4052c593315Sopenharmony_ci XX(22, CHECKOUT, CHECKOUT) \ 4062c593315Sopenharmony_ci XX(23, MERGE, MERGE) \ 4072c593315Sopenharmony_ci XX(24, MSEARCH, M-SEARCH) \ 4082c593315Sopenharmony_ci XX(25, NOTIFY, NOTIFY) \ 4092c593315Sopenharmony_ci XX(26, SUBSCRIBE, SUBSCRIBE) \ 4102c593315Sopenharmony_ci XX(27, UNSUBSCRIBE, UNSUBSCRIBE) \ 4112c593315Sopenharmony_ci XX(28, PATCH, PATCH) \ 4122c593315Sopenharmony_ci XX(29, PURGE, PURGE) \ 4132c593315Sopenharmony_ci XX(30, MKCALENDAR, MKCALENDAR) \ 4142c593315Sopenharmony_ci XX(31, LINK, LINK) \ 4152c593315Sopenharmony_ci XX(32, UNLINK, UNLINK) \ 4162c593315Sopenharmony_ci XX(33, SOURCE, SOURCE) \ 4172c593315Sopenharmony_ci XX(34, PRI, PRI) \ 4182c593315Sopenharmony_ci XX(35, DESCRIBE, DESCRIBE) \ 4192c593315Sopenharmony_ci XX(36, ANNOUNCE, ANNOUNCE) \ 4202c593315Sopenharmony_ci XX(37, SETUP, SETUP) \ 4212c593315Sopenharmony_ci XX(38, PLAY, PLAY) \ 4222c593315Sopenharmony_ci XX(39, PAUSE, PAUSE) \ 4232c593315Sopenharmony_ci XX(40, TEARDOWN, TEARDOWN) \ 4242c593315Sopenharmony_ci XX(41, GET_PARAMETER, GET_PARAMETER) \ 4252c593315Sopenharmony_ci XX(42, SET_PARAMETER, SET_PARAMETER) \ 4262c593315Sopenharmony_ci XX(43, REDIRECT, REDIRECT) \ 4272c593315Sopenharmony_ci XX(44, RECORD, RECORD) \ 4282c593315Sopenharmony_ci XX(45, FLUSH, FLUSH) \ 4292c593315Sopenharmony_ci 4302c593315Sopenharmony_ci 4312c593315Sopenharmony_ci#define HTTP_STATUS_MAP(XX) \ 4322c593315Sopenharmony_ci XX(100, CONTINUE, CONTINUE) \ 4332c593315Sopenharmony_ci XX(101, SWITCHING_PROTOCOLS, SWITCHING_PROTOCOLS) \ 4342c593315Sopenharmony_ci XX(102, PROCESSING, PROCESSING) \ 4352c593315Sopenharmony_ci XX(103, EARLY_HINTS, EARLY_HINTS) \ 4362c593315Sopenharmony_ci XX(110, RESPONSE_IS_STALE, RESPONSE_IS_STALE) \ 4372c593315Sopenharmony_ci XX(111, REVALIDATION_FAILED, REVALIDATION_FAILED) \ 4382c593315Sopenharmony_ci XX(112, DISCONNECTED_OPERATION, DISCONNECTED_OPERATION) \ 4392c593315Sopenharmony_ci XX(113, HEURISTIC_EXPIRATION, HEURISTIC_EXPIRATION) \ 4402c593315Sopenharmony_ci XX(199, MISCELLANEOUS_WARNING, MISCELLANEOUS_WARNING) \ 4412c593315Sopenharmony_ci XX(200, OK, OK) \ 4422c593315Sopenharmony_ci XX(201, CREATED, CREATED) \ 4432c593315Sopenharmony_ci XX(202, ACCEPTED, ACCEPTED) \ 4442c593315Sopenharmony_ci XX(203, NON_AUTHORITATIVE_INFORMATION, NON_AUTHORITATIVE_INFORMATION) \ 4452c593315Sopenharmony_ci XX(204, NO_CONTENT, NO_CONTENT) \ 4462c593315Sopenharmony_ci XX(205, RESET_CONTENT, RESET_CONTENT) \ 4472c593315Sopenharmony_ci XX(206, PARTIAL_CONTENT, PARTIAL_CONTENT) \ 4482c593315Sopenharmony_ci XX(207, MULTI_STATUS, MULTI_STATUS) \ 4492c593315Sopenharmony_ci XX(208, ALREADY_REPORTED, ALREADY_REPORTED) \ 4502c593315Sopenharmony_ci XX(214, TRANSFORMATION_APPLIED, TRANSFORMATION_APPLIED) \ 4512c593315Sopenharmony_ci XX(226, IM_USED, IM_USED) \ 4522c593315Sopenharmony_ci XX(299, MISCELLANEOUS_PERSISTENT_WARNING, MISCELLANEOUS_PERSISTENT_WARNING) \ 4532c593315Sopenharmony_ci XX(300, MULTIPLE_CHOICES, MULTIPLE_CHOICES) \ 4542c593315Sopenharmony_ci XX(301, MOVED_PERMANENTLY, MOVED_PERMANENTLY) \ 4552c593315Sopenharmony_ci XX(302, FOUND, FOUND) \ 4562c593315Sopenharmony_ci XX(303, SEE_OTHER, SEE_OTHER) \ 4572c593315Sopenharmony_ci XX(304, NOT_MODIFIED, NOT_MODIFIED) \ 4582c593315Sopenharmony_ci XX(305, USE_PROXY, USE_PROXY) \ 4592c593315Sopenharmony_ci XX(306, SWITCH_PROXY, SWITCH_PROXY) \ 4602c593315Sopenharmony_ci XX(307, TEMPORARY_REDIRECT, TEMPORARY_REDIRECT) \ 4612c593315Sopenharmony_ci XX(308, PERMANENT_REDIRECT, PERMANENT_REDIRECT) \ 4622c593315Sopenharmony_ci XX(400, BAD_REQUEST, BAD_REQUEST) \ 4632c593315Sopenharmony_ci XX(401, UNAUTHORIZED, UNAUTHORIZED) \ 4642c593315Sopenharmony_ci XX(402, PAYMENT_REQUIRED, PAYMENT_REQUIRED) \ 4652c593315Sopenharmony_ci XX(403, FORBIDDEN, FORBIDDEN) \ 4662c593315Sopenharmony_ci XX(404, NOT_FOUND, NOT_FOUND) \ 4672c593315Sopenharmony_ci XX(405, METHOD_NOT_ALLOWED, METHOD_NOT_ALLOWED) \ 4682c593315Sopenharmony_ci XX(406, NOT_ACCEPTABLE, NOT_ACCEPTABLE) \ 4692c593315Sopenharmony_ci XX(407, PROXY_AUTHENTICATION_REQUIRED, PROXY_AUTHENTICATION_REQUIRED) \ 4702c593315Sopenharmony_ci XX(408, REQUEST_TIMEOUT, REQUEST_TIMEOUT) \ 4712c593315Sopenharmony_ci XX(409, CONFLICT, CONFLICT) \ 4722c593315Sopenharmony_ci XX(410, GONE, GONE) \ 4732c593315Sopenharmony_ci XX(411, LENGTH_REQUIRED, LENGTH_REQUIRED) \ 4742c593315Sopenharmony_ci XX(412, PRECONDITION_FAILED, PRECONDITION_FAILED) \ 4752c593315Sopenharmony_ci XX(413, PAYLOAD_TOO_LARGE, PAYLOAD_TOO_LARGE) \ 4762c593315Sopenharmony_ci XX(414, URI_TOO_LONG, URI_TOO_LONG) \ 4772c593315Sopenharmony_ci XX(415, UNSUPPORTED_MEDIA_TYPE, UNSUPPORTED_MEDIA_TYPE) \ 4782c593315Sopenharmony_ci XX(416, RANGE_NOT_SATISFIABLE, RANGE_NOT_SATISFIABLE) \ 4792c593315Sopenharmony_ci XX(417, EXPECTATION_FAILED, EXPECTATION_FAILED) \ 4802c593315Sopenharmony_ci XX(418, IM_A_TEAPOT, IM_A_TEAPOT) \ 4812c593315Sopenharmony_ci XX(419, PAGE_EXPIRED, PAGE_EXPIRED) \ 4822c593315Sopenharmony_ci XX(420, ENHANCE_YOUR_CALM, ENHANCE_YOUR_CALM) \ 4832c593315Sopenharmony_ci XX(421, MISDIRECTED_REQUEST, MISDIRECTED_REQUEST) \ 4842c593315Sopenharmony_ci XX(422, UNPROCESSABLE_ENTITY, UNPROCESSABLE_ENTITY) \ 4852c593315Sopenharmony_ci XX(423, LOCKED, LOCKED) \ 4862c593315Sopenharmony_ci XX(424, FAILED_DEPENDENCY, FAILED_DEPENDENCY) \ 4872c593315Sopenharmony_ci XX(425, TOO_EARLY, TOO_EARLY) \ 4882c593315Sopenharmony_ci XX(426, UPGRADE_REQUIRED, UPGRADE_REQUIRED) \ 4892c593315Sopenharmony_ci XX(428, PRECONDITION_REQUIRED, PRECONDITION_REQUIRED) \ 4902c593315Sopenharmony_ci XX(429, TOO_MANY_REQUESTS, TOO_MANY_REQUESTS) \ 4912c593315Sopenharmony_ci XX(430, REQUEST_HEADER_FIELDS_TOO_LARGE_UNOFFICIAL, REQUEST_HEADER_FIELDS_TOO_LARGE_UNOFFICIAL) \ 4922c593315Sopenharmony_ci XX(431, REQUEST_HEADER_FIELDS_TOO_LARGE, REQUEST_HEADER_FIELDS_TOO_LARGE) \ 4932c593315Sopenharmony_ci XX(440, LOGIN_TIMEOUT, LOGIN_TIMEOUT) \ 4942c593315Sopenharmony_ci XX(444, NO_RESPONSE, NO_RESPONSE) \ 4952c593315Sopenharmony_ci XX(449, RETRY_WITH, RETRY_WITH) \ 4962c593315Sopenharmony_ci XX(450, BLOCKED_BY_PARENTAL_CONTROL, BLOCKED_BY_PARENTAL_CONTROL) \ 4972c593315Sopenharmony_ci XX(451, UNAVAILABLE_FOR_LEGAL_REASONS, UNAVAILABLE_FOR_LEGAL_REASONS) \ 4982c593315Sopenharmony_ci XX(460, CLIENT_CLOSED_LOAD_BALANCED_REQUEST, CLIENT_CLOSED_LOAD_BALANCED_REQUEST) \ 4992c593315Sopenharmony_ci XX(463, INVALID_X_FORWARDED_FOR, INVALID_X_FORWARDED_FOR) \ 5002c593315Sopenharmony_ci XX(494, REQUEST_HEADER_TOO_LARGE, REQUEST_HEADER_TOO_LARGE) \ 5012c593315Sopenharmony_ci XX(495, SSL_CERTIFICATE_ERROR, SSL_CERTIFICATE_ERROR) \ 5022c593315Sopenharmony_ci XX(496, SSL_CERTIFICATE_REQUIRED, SSL_CERTIFICATE_REQUIRED) \ 5032c593315Sopenharmony_ci XX(497, HTTP_REQUEST_SENT_TO_HTTPS_PORT, HTTP_REQUEST_SENT_TO_HTTPS_PORT) \ 5042c593315Sopenharmony_ci XX(498, INVALID_TOKEN, INVALID_TOKEN) \ 5052c593315Sopenharmony_ci XX(499, CLIENT_CLOSED_REQUEST, CLIENT_CLOSED_REQUEST) \ 5062c593315Sopenharmony_ci XX(500, INTERNAL_SERVER_ERROR, INTERNAL_SERVER_ERROR) \ 5072c593315Sopenharmony_ci XX(501, NOT_IMPLEMENTED, NOT_IMPLEMENTED) \ 5082c593315Sopenharmony_ci XX(502, BAD_GATEWAY, BAD_GATEWAY) \ 5092c593315Sopenharmony_ci XX(503, SERVICE_UNAVAILABLE, SERVICE_UNAVAILABLE) \ 5102c593315Sopenharmony_ci XX(504, GATEWAY_TIMEOUT, GATEWAY_TIMEOUT) \ 5112c593315Sopenharmony_ci XX(505, HTTP_VERSION_NOT_SUPPORTED, HTTP_VERSION_NOT_SUPPORTED) \ 5122c593315Sopenharmony_ci XX(506, VARIANT_ALSO_NEGOTIATES, VARIANT_ALSO_NEGOTIATES) \ 5132c593315Sopenharmony_ci XX(507, INSUFFICIENT_STORAGE, INSUFFICIENT_STORAGE) \ 5142c593315Sopenharmony_ci XX(508, LOOP_DETECTED, LOOP_DETECTED) \ 5152c593315Sopenharmony_ci XX(509, BANDWIDTH_LIMIT_EXCEEDED, BANDWIDTH_LIMIT_EXCEEDED) \ 5162c593315Sopenharmony_ci XX(510, NOT_EXTENDED, NOT_EXTENDED) \ 5172c593315Sopenharmony_ci XX(511, NETWORK_AUTHENTICATION_REQUIRED, NETWORK_AUTHENTICATION_REQUIRED) \ 5182c593315Sopenharmony_ci XX(520, WEB_SERVER_UNKNOWN_ERROR, WEB_SERVER_UNKNOWN_ERROR) \ 5192c593315Sopenharmony_ci XX(521, WEB_SERVER_IS_DOWN, WEB_SERVER_IS_DOWN) \ 5202c593315Sopenharmony_ci XX(522, CONNECTION_TIMEOUT, CONNECTION_TIMEOUT) \ 5212c593315Sopenharmony_ci XX(523, ORIGIN_IS_UNREACHABLE, ORIGIN_IS_UNREACHABLE) \ 5222c593315Sopenharmony_ci XX(524, TIMEOUT_OCCURED, TIMEOUT_OCCURED) \ 5232c593315Sopenharmony_ci XX(525, SSL_HANDSHAKE_FAILED, SSL_HANDSHAKE_FAILED) \ 5242c593315Sopenharmony_ci XX(526, INVALID_SSL_CERTIFICATE, INVALID_SSL_CERTIFICATE) \ 5252c593315Sopenharmony_ci XX(527, RAILGUN_ERROR, RAILGUN_ERROR) \ 5262c593315Sopenharmony_ci XX(529, SITE_IS_OVERLOADED, SITE_IS_OVERLOADED) \ 5272c593315Sopenharmony_ci XX(530, SITE_IS_FROZEN, SITE_IS_FROZEN) \ 5282c593315Sopenharmony_ci XX(561, IDENTITY_PROVIDER_AUTHENTICATION_ERROR, IDENTITY_PROVIDER_AUTHENTICATION_ERROR) \ 5292c593315Sopenharmony_ci XX(598, NETWORK_READ_TIMEOUT, NETWORK_READ_TIMEOUT) \ 5302c593315Sopenharmony_ci XX(599, NETWORK_CONNECT_TIMEOUT, NETWORK_CONNECT_TIMEOUT) \ 5312c593315Sopenharmony_ci 5322c593315Sopenharmony_ci 5332c593315Sopenharmony_ci#ifdef __cplusplus 5342c593315Sopenharmony_ci} /* extern "C" */ 5352c593315Sopenharmony_ci#endif 5362c593315Sopenharmony_ci#endif /* LLLLHTTP_C_HEADERS_ */ 5372c593315Sopenharmony_ci 5382c593315Sopenharmony_ci 5392c593315Sopenharmony_ci#ifndef INCLUDE_LLHTTP_API_H_ 5402c593315Sopenharmony_ci#define INCLUDE_LLHTTP_API_H_ 5412c593315Sopenharmony_ci#ifdef __cplusplus 5422c593315Sopenharmony_ciextern "C" { 5432c593315Sopenharmony_ci#endif 5442c593315Sopenharmony_ci#include <stddef.h> 5452c593315Sopenharmony_ci 5462c593315Sopenharmony_ci#if defined(__wasm__) 5472c593315Sopenharmony_ci#define LLHTTP_EXPORT __attribute__((visibility("default"))) 5482c593315Sopenharmony_ci#else 5492c593315Sopenharmony_ci#define LLHTTP_EXPORT 5502c593315Sopenharmony_ci#endif 5512c593315Sopenharmony_ci 5522c593315Sopenharmony_citypedef llhttp__internal_t llhttp_t; 5532c593315Sopenharmony_citypedef struct llhttp_settings_s llhttp_settings_t; 5542c593315Sopenharmony_ci 5552c593315Sopenharmony_citypedef int (*llhttp_data_cb)(llhttp_t*, const char *at, size_t length); 5562c593315Sopenharmony_citypedef int (*llhttp_cb)(llhttp_t*); 5572c593315Sopenharmony_ci 5582c593315Sopenharmony_cistruct llhttp_settings_s { 5592c593315Sopenharmony_ci /* Possible return values 0, -1, `HPE_PAUSED` */ 5602c593315Sopenharmony_ci llhttp_cb on_message_begin; 5612c593315Sopenharmony_ci 5622c593315Sopenharmony_ci /* Possible return values 0, -1, HPE_USER */ 5632c593315Sopenharmony_ci llhttp_data_cb on_url; 5642c593315Sopenharmony_ci llhttp_data_cb on_status; 5652c593315Sopenharmony_ci llhttp_data_cb on_method; 5662c593315Sopenharmony_ci llhttp_data_cb on_version; 5672c593315Sopenharmony_ci llhttp_data_cb on_header_field; 5682c593315Sopenharmony_ci llhttp_data_cb on_header_value; 5692c593315Sopenharmony_ci llhttp_data_cb on_chunk_extension_name; 5702c593315Sopenharmony_ci llhttp_data_cb on_chunk_extension_value; 5712c593315Sopenharmony_ci 5722c593315Sopenharmony_ci /* Possible return values: 5732c593315Sopenharmony_ci * 0 - Proceed normally 5742c593315Sopenharmony_ci * 1 - Assume that request/response has no body, and proceed to parsing the 5752c593315Sopenharmony_ci * next message 5762c593315Sopenharmony_ci * 2 - Assume absence of body (as above) and make `llhttp_execute()` return 5772c593315Sopenharmony_ci * `HPE_PAUSED_UPGRADE` 5782c593315Sopenharmony_ci * -1 - Error 5792c593315Sopenharmony_ci * `HPE_PAUSED` 5802c593315Sopenharmony_ci */ 5812c593315Sopenharmony_ci llhttp_cb on_headers_complete; 5822c593315Sopenharmony_ci 5832c593315Sopenharmony_ci /* Possible return values 0, -1, HPE_USER */ 5842c593315Sopenharmony_ci llhttp_data_cb on_body; 5852c593315Sopenharmony_ci 5862c593315Sopenharmony_ci /* Possible return values 0, -1, `HPE_PAUSED` */ 5872c593315Sopenharmony_ci llhttp_cb on_message_complete; 5882c593315Sopenharmony_ci llhttp_cb on_url_complete; 5892c593315Sopenharmony_ci llhttp_cb on_status_complete; 5902c593315Sopenharmony_ci llhttp_cb on_method_complete; 5912c593315Sopenharmony_ci llhttp_cb on_version_complete; 5922c593315Sopenharmony_ci llhttp_cb on_header_field_complete; 5932c593315Sopenharmony_ci llhttp_cb on_header_value_complete; 5942c593315Sopenharmony_ci llhttp_cb on_chunk_extension_name_complete; 5952c593315Sopenharmony_ci llhttp_cb on_chunk_extension_value_complete; 5962c593315Sopenharmony_ci 5972c593315Sopenharmony_ci /* When on_chunk_header is called, the current chunk length is stored 5982c593315Sopenharmony_ci * in parser->content_length. 5992c593315Sopenharmony_ci * Possible return values 0, -1, `HPE_PAUSED` 6002c593315Sopenharmony_ci */ 6012c593315Sopenharmony_ci llhttp_cb on_chunk_header; 6022c593315Sopenharmony_ci llhttp_cb on_chunk_complete; 6032c593315Sopenharmony_ci llhttp_cb on_reset; 6042c593315Sopenharmony_ci}; 6052c593315Sopenharmony_ci 6062c593315Sopenharmony_ci/* Initialize the parser with specific type and user settings. 6072c593315Sopenharmony_ci * 6082c593315Sopenharmony_ci * NOTE: lifetime of `settings` has to be at least the same as the lifetime of 6092c593315Sopenharmony_ci * the `parser` here. In practice, `settings` has to be either a static 6102c593315Sopenharmony_ci * variable or be allocated with `malloc`, `new`, etc. 6112c593315Sopenharmony_ci */ 6122c593315Sopenharmony_ciLLHTTP_EXPORT 6132c593315Sopenharmony_civoid llhttp_init(llhttp_t* parser, llhttp_type_t type, 6142c593315Sopenharmony_ci const llhttp_settings_t* settings); 6152c593315Sopenharmony_ci 6162c593315Sopenharmony_ciLLHTTP_EXPORT 6172c593315Sopenharmony_cillhttp_t* llhttp_alloc(llhttp_type_t type); 6182c593315Sopenharmony_ci 6192c593315Sopenharmony_ciLLHTTP_EXPORT 6202c593315Sopenharmony_civoid llhttp_free(llhttp_t* parser); 6212c593315Sopenharmony_ci 6222c593315Sopenharmony_ciLLHTTP_EXPORT 6232c593315Sopenharmony_ciuint8_t llhttp_get_type(llhttp_t* parser); 6242c593315Sopenharmony_ci 6252c593315Sopenharmony_ciLLHTTP_EXPORT 6262c593315Sopenharmony_ciuint8_t llhttp_get_http_major(llhttp_t* parser); 6272c593315Sopenharmony_ci 6282c593315Sopenharmony_ciLLHTTP_EXPORT 6292c593315Sopenharmony_ciuint8_t llhttp_get_http_minor(llhttp_t* parser); 6302c593315Sopenharmony_ci 6312c593315Sopenharmony_ciLLHTTP_EXPORT 6322c593315Sopenharmony_ciuint8_t llhttp_get_method(llhttp_t* parser); 6332c593315Sopenharmony_ci 6342c593315Sopenharmony_ciLLHTTP_EXPORT 6352c593315Sopenharmony_ciint llhttp_get_status_code(llhttp_t* parser); 6362c593315Sopenharmony_ci 6372c593315Sopenharmony_ciLLHTTP_EXPORT 6382c593315Sopenharmony_ciuint8_t llhttp_get_upgrade(llhttp_t* parser); 6392c593315Sopenharmony_ci 6402c593315Sopenharmony_ci/* Reset an already initialized parser back to the start state, preserving the 6412c593315Sopenharmony_ci * existing parser type, callback settings, user data, and lenient flags. 6422c593315Sopenharmony_ci */ 6432c593315Sopenharmony_ciLLHTTP_EXPORT 6442c593315Sopenharmony_civoid llhttp_reset(llhttp_t* parser); 6452c593315Sopenharmony_ci 6462c593315Sopenharmony_ci/* Initialize the settings object */ 6472c593315Sopenharmony_ciLLHTTP_EXPORT 6482c593315Sopenharmony_civoid llhttp_settings_init(llhttp_settings_t* settings); 6492c593315Sopenharmony_ci 6502c593315Sopenharmony_ci/* Parse full or partial request/response, invoking user callbacks along the 6512c593315Sopenharmony_ci * way. 6522c593315Sopenharmony_ci * 6532c593315Sopenharmony_ci * If any of `llhttp_data_cb` returns errno not equal to `HPE_OK` - the parsing 6542c593315Sopenharmony_ci * interrupts, and such errno is returned from `llhttp_execute()`. If 6552c593315Sopenharmony_ci * `HPE_PAUSED` was used as a errno, the execution can be resumed with 6562c593315Sopenharmony_ci * `llhttp_resume()` call. 6572c593315Sopenharmony_ci * 6582c593315Sopenharmony_ci * In a special case of CONNECT/Upgrade request/response `HPE_PAUSED_UPGRADE` 6592c593315Sopenharmony_ci * is returned after fully parsing the request/response. If the user wishes to 6602c593315Sopenharmony_ci * continue parsing, they need to invoke `llhttp_resume_after_upgrade()`. 6612c593315Sopenharmony_ci * 6622c593315Sopenharmony_ci * NOTE: if this function ever returns a non-pause type error, it will continue 6632c593315Sopenharmony_ci * to return the same error upon each successive call up until `llhttp_init()` 6642c593315Sopenharmony_ci * is called. 6652c593315Sopenharmony_ci */ 6662c593315Sopenharmony_ciLLHTTP_EXPORT 6672c593315Sopenharmony_cillhttp_errno_t llhttp_execute(llhttp_t* parser, const char* data, size_t len); 6682c593315Sopenharmony_ci 6692c593315Sopenharmony_ci/* This method should be called when the other side has no further bytes to 6702c593315Sopenharmony_ci * send (e.g. shutdown of readable side of the TCP connection.) 6712c593315Sopenharmony_ci * 6722c593315Sopenharmony_ci * Requests without `Content-Length` and other messages might require treating 6732c593315Sopenharmony_ci * all incoming bytes as the part of the body, up to the last byte of the 6742c593315Sopenharmony_ci * connection. This method will invoke `on_message_complete()` callback if the 6752c593315Sopenharmony_ci * request was terminated safely. Otherwise a error code would be returned. 6762c593315Sopenharmony_ci */ 6772c593315Sopenharmony_ciLLHTTP_EXPORT 6782c593315Sopenharmony_cillhttp_errno_t llhttp_finish(llhttp_t* parser); 6792c593315Sopenharmony_ci 6802c593315Sopenharmony_ci/* Returns `1` if the incoming message is parsed until the last byte, and has 6812c593315Sopenharmony_ci * to be completed by calling `llhttp_finish()` on EOF 6822c593315Sopenharmony_ci */ 6832c593315Sopenharmony_ciLLHTTP_EXPORT 6842c593315Sopenharmony_ciint llhttp_message_needs_eof(const llhttp_t* parser); 6852c593315Sopenharmony_ci 6862c593315Sopenharmony_ci/* Returns `1` if there might be any other messages following the last that was 6872c593315Sopenharmony_ci * successfully parsed. 6882c593315Sopenharmony_ci */ 6892c593315Sopenharmony_ciLLHTTP_EXPORT 6902c593315Sopenharmony_ciint llhttp_should_keep_alive(const llhttp_t* parser); 6912c593315Sopenharmony_ci 6922c593315Sopenharmony_ci/* Make further calls of `llhttp_execute()` return `HPE_PAUSED` and set 6932c593315Sopenharmony_ci * appropriate error reason. 6942c593315Sopenharmony_ci * 6952c593315Sopenharmony_ci * Important: do not call this from user callbacks! User callbacks must return 6962c593315Sopenharmony_ci * `HPE_PAUSED` if pausing is required. 6972c593315Sopenharmony_ci */ 6982c593315Sopenharmony_ciLLHTTP_EXPORT 6992c593315Sopenharmony_civoid llhttp_pause(llhttp_t* parser); 7002c593315Sopenharmony_ci 7012c593315Sopenharmony_ci/* Might be called to resume the execution after the pause in user's callback. 7022c593315Sopenharmony_ci * See `llhttp_execute()` above for details. 7032c593315Sopenharmony_ci * 7042c593315Sopenharmony_ci * Call this only if `llhttp_execute()` returns `HPE_PAUSED`. 7052c593315Sopenharmony_ci */ 7062c593315Sopenharmony_ciLLHTTP_EXPORT 7072c593315Sopenharmony_civoid llhttp_resume(llhttp_t* parser); 7082c593315Sopenharmony_ci 7092c593315Sopenharmony_ci/* Might be called to resume the execution after the pause in user's callback. 7102c593315Sopenharmony_ci * See `llhttp_execute()` above for details. 7112c593315Sopenharmony_ci * 7122c593315Sopenharmony_ci * Call this only if `llhttp_execute()` returns `HPE_PAUSED_UPGRADE` 7132c593315Sopenharmony_ci */ 7142c593315Sopenharmony_ciLLHTTP_EXPORT 7152c593315Sopenharmony_civoid llhttp_resume_after_upgrade(llhttp_t* parser); 7162c593315Sopenharmony_ci 7172c593315Sopenharmony_ci/* Returns the latest return error */ 7182c593315Sopenharmony_ciLLHTTP_EXPORT 7192c593315Sopenharmony_cillhttp_errno_t llhttp_get_errno(const llhttp_t* parser); 7202c593315Sopenharmony_ci 7212c593315Sopenharmony_ci/* Returns the verbal explanation of the latest returned error. 7222c593315Sopenharmony_ci * 7232c593315Sopenharmony_ci * Note: User callback should set error reason when returning the error. See 7242c593315Sopenharmony_ci * `llhttp_set_error_reason()` for details. 7252c593315Sopenharmony_ci */ 7262c593315Sopenharmony_ciLLHTTP_EXPORT 7272c593315Sopenharmony_ciconst char* llhttp_get_error_reason(const llhttp_t* parser); 7282c593315Sopenharmony_ci 7292c593315Sopenharmony_ci/* Assign verbal description to the returned error. Must be called in user 7302c593315Sopenharmony_ci * callbacks right before returning the errno. 7312c593315Sopenharmony_ci * 7322c593315Sopenharmony_ci * Note: `HPE_USER` error code might be useful in user callbacks. 7332c593315Sopenharmony_ci */ 7342c593315Sopenharmony_ciLLHTTP_EXPORT 7352c593315Sopenharmony_civoid llhttp_set_error_reason(llhttp_t* parser, const char* reason); 7362c593315Sopenharmony_ci 7372c593315Sopenharmony_ci/* Returns the pointer to the last parsed byte before the returned error. The 7382c593315Sopenharmony_ci * pointer is relative to the `data` argument of `llhttp_execute()`. 7392c593315Sopenharmony_ci * 7402c593315Sopenharmony_ci * Note: this method might be useful for counting the number of parsed bytes. 7412c593315Sopenharmony_ci */ 7422c593315Sopenharmony_ciLLHTTP_EXPORT 7432c593315Sopenharmony_ciconst char* llhttp_get_error_pos(const llhttp_t* parser); 7442c593315Sopenharmony_ci 7452c593315Sopenharmony_ci/* Returns textual name of error code */ 7462c593315Sopenharmony_ciLLHTTP_EXPORT 7472c593315Sopenharmony_ciconst char* llhttp_errno_name(llhttp_errno_t err); 7482c593315Sopenharmony_ci 7492c593315Sopenharmony_ci/* Returns textual name of HTTP method */ 7502c593315Sopenharmony_ciLLHTTP_EXPORT 7512c593315Sopenharmony_ciconst char* llhttp_method_name(llhttp_method_t method); 7522c593315Sopenharmony_ci 7532c593315Sopenharmony_ci/* Returns textual name of HTTP status */ 7542c593315Sopenharmony_ciLLHTTP_EXPORT 7552c593315Sopenharmony_ciconst char* llhttp_status_name(llhttp_status_t status); 7562c593315Sopenharmony_ci 7572c593315Sopenharmony_ci/* Enables/disables lenient header value parsing (disabled by default). 7582c593315Sopenharmony_ci * 7592c593315Sopenharmony_ci * Lenient parsing disables header value token checks, extending llhttp's 7602c593315Sopenharmony_ci * protocol support to highly non-compliant clients/server. No 7612c593315Sopenharmony_ci * `HPE_INVALID_HEADER_TOKEN` will be raised for incorrect header values when 7622c593315Sopenharmony_ci * lenient parsing is "on". 7632c593315Sopenharmony_ci * 7642c593315Sopenharmony_ci * **Enabling this flag can pose a security issue since you will be exposed to 7652c593315Sopenharmony_ci * request smuggling attacks. USE WITH CAUTION!** 7662c593315Sopenharmony_ci */ 7672c593315Sopenharmony_ciLLHTTP_EXPORT 7682c593315Sopenharmony_civoid llhttp_set_lenient_headers(llhttp_t* parser, int enabled); 7692c593315Sopenharmony_ci 7702c593315Sopenharmony_ci 7712c593315Sopenharmony_ci/* Enables/disables lenient handling of conflicting `Transfer-Encoding` and 7722c593315Sopenharmony_ci * `Content-Length` headers (disabled by default). 7732c593315Sopenharmony_ci * 7742c593315Sopenharmony_ci * Normally `llhttp` would error when `Transfer-Encoding` is present in 7752c593315Sopenharmony_ci * conjunction with `Content-Length`. This error is important to prevent HTTP 7762c593315Sopenharmony_ci * request smuggling, but may be less desirable for small number of cases 7772c593315Sopenharmony_ci * involving legacy servers. 7782c593315Sopenharmony_ci * 7792c593315Sopenharmony_ci * **Enabling this flag can pose a security issue since you will be exposed to 7802c593315Sopenharmony_ci * request smuggling attacks. USE WITH CAUTION!** 7812c593315Sopenharmony_ci */ 7822c593315Sopenharmony_ciLLHTTP_EXPORT 7832c593315Sopenharmony_civoid llhttp_set_lenient_chunked_length(llhttp_t* parser, int enabled); 7842c593315Sopenharmony_ci 7852c593315Sopenharmony_ci 7862c593315Sopenharmony_ci/* Enables/disables lenient handling of `Connection: close` and HTTP/1.0 7872c593315Sopenharmony_ci * requests responses. 7882c593315Sopenharmony_ci * 7892c593315Sopenharmony_ci * Normally `llhttp` would error on (in strict mode) or discard (in loose mode) 7902c593315Sopenharmony_ci * the HTTP request/response after the request/response with `Connection: close` 7912c593315Sopenharmony_ci * and `Content-Length`. This is important to prevent cache poisoning attacks, 7922c593315Sopenharmony_ci * but might interact badly with outdated and insecure clients. With this flag 7932c593315Sopenharmony_ci * the extra request/response will be parsed normally. 7942c593315Sopenharmony_ci * 7952c593315Sopenharmony_ci * **Enabling this flag can pose a security issue since you will be exposed to 7962c593315Sopenharmony_ci * poisoning attacks. USE WITH CAUTION!** 7972c593315Sopenharmony_ci */ 7982c593315Sopenharmony_ciLLHTTP_EXPORT 7992c593315Sopenharmony_civoid llhttp_set_lenient_keep_alive(llhttp_t* parser, int enabled); 8002c593315Sopenharmony_ci 8012c593315Sopenharmony_ci/* Enables/disables lenient handling of `Transfer-Encoding` header. 8022c593315Sopenharmony_ci * 8032c593315Sopenharmony_ci * Normally `llhttp` would error when a `Transfer-Encoding` has `chunked` value 8042c593315Sopenharmony_ci * and another value after it (either in a single header or in multiple 8052c593315Sopenharmony_ci * headers whose value are internally joined using `, `). 8062c593315Sopenharmony_ci * This is mandated by the spec to reliably determine request body size and thus 8072c593315Sopenharmony_ci * avoid request smuggling. 8082c593315Sopenharmony_ci * With this flag the extra value will be parsed normally. 8092c593315Sopenharmony_ci * 8102c593315Sopenharmony_ci * **Enabling this flag can pose a security issue since you will be exposed to 8112c593315Sopenharmony_ci * request smuggling attacks. USE WITH CAUTION!** 8122c593315Sopenharmony_ci */ 8132c593315Sopenharmony_ciLLHTTP_EXPORT 8142c593315Sopenharmony_civoid llhttp_set_lenient_transfer_encoding(llhttp_t* parser, int enabled); 8152c593315Sopenharmony_ci 8162c593315Sopenharmony_ci/* Enables/disables lenient handling of HTTP version. 8172c593315Sopenharmony_ci * 8182c593315Sopenharmony_ci * Normally `llhttp` would error when the HTTP version in the request or status line 8192c593315Sopenharmony_ci * is not `0.9`, `1.0`, `1.1` or `2.0`. 8202c593315Sopenharmony_ci * With this flag the invalid value will be parsed normally. 8212c593315Sopenharmony_ci * 8222c593315Sopenharmony_ci * **Enabling this flag can pose a security issue since you will allow unsupported 8232c593315Sopenharmony_ci * HTTP versions. USE WITH CAUTION!** 8242c593315Sopenharmony_ci */ 8252c593315Sopenharmony_ciLLHTTP_EXPORT 8262c593315Sopenharmony_civoid llhttp_set_lenient_version(llhttp_t* parser, int enabled); 8272c593315Sopenharmony_ci 8282c593315Sopenharmony_ci/* Enables/disables lenient handling of additional data received after a message ends 8292c593315Sopenharmony_ci * and keep-alive is disabled. 8302c593315Sopenharmony_ci * 8312c593315Sopenharmony_ci * Normally `llhttp` would error when additional unexpected data is received if the message 8322c593315Sopenharmony_ci * contains the `Connection` header with `close` value. 8332c593315Sopenharmony_ci * With this flag the extra data will discarded without throwing an error. 8342c593315Sopenharmony_ci * 8352c593315Sopenharmony_ci * **Enabling this flag can pose a security issue since you will be exposed to 8362c593315Sopenharmony_ci * poisoning attacks. USE WITH CAUTION!** 8372c593315Sopenharmony_ci */ 8382c593315Sopenharmony_ciLLHTTP_EXPORT 8392c593315Sopenharmony_civoid llhttp_set_lenient_data_after_close(llhttp_t* parser, int enabled); 8402c593315Sopenharmony_ci 8412c593315Sopenharmony_ci/* Enables/disables lenient handling of incomplete CRLF sequences. 8422c593315Sopenharmony_ci * 8432c593315Sopenharmony_ci * Normally `llhttp` would error when a CR is not followed by LF when terminating the 8442c593315Sopenharmony_ci * request line, the status line, the headers or a chunk header. 8452c593315Sopenharmony_ci * With this flag only a CR is required to terminate such sections. 8462c593315Sopenharmony_ci * 8472c593315Sopenharmony_ci * **Enabling this flag can pose a security issue since you will be exposed to 8482c593315Sopenharmony_ci * request smuggling attacks. USE WITH CAUTION!** 8492c593315Sopenharmony_ci */ 8502c593315Sopenharmony_ciLLHTTP_EXPORT 8512c593315Sopenharmony_civoid llhttp_set_lenient_optional_lf_after_cr(llhttp_t* parser, int enabled); 8522c593315Sopenharmony_ci 8532c593315Sopenharmony_ci/* Enables/disables lenient handling of chunks not separated via CRLF. 8542c593315Sopenharmony_ci * 8552c593315Sopenharmony_ci * Normally `llhttp` would error when after a chunk data a CRLF is missing before 8562c593315Sopenharmony_ci * starting a new chunk. 8572c593315Sopenharmony_ci * With this flag the new chunk can start immediately after the previous one. 8582c593315Sopenharmony_ci * 8592c593315Sopenharmony_ci * **Enabling this flag can pose a security issue since you will be exposed to 8602c593315Sopenharmony_ci * request smuggling attacks. USE WITH CAUTION!** 8612c593315Sopenharmony_ci */ 8622c593315Sopenharmony_ciLLHTTP_EXPORT 8632c593315Sopenharmony_civoid llhttp_set_lenient_optional_crlf_after_chunk(llhttp_t* parser, int enabled); 8642c593315Sopenharmony_ci 8652c593315Sopenharmony_ci#ifdef __cplusplus 8662c593315Sopenharmony_ci} /* extern "C" */ 8672c593315Sopenharmony_ci#endif 8682c593315Sopenharmony_ci#endif /* INCLUDE_LLHTTP_API_H_ */ 8692c593315Sopenharmony_ci 8702c593315Sopenharmony_ci 8712c593315Sopenharmony_ci#endif /* INCLUDE_LLHTTP_H_ */ 872