parslib/tinyparser.h

152 lines
3.4 KiB
C

#ifndef PARSER_H
#define PARSER_H
#define LINE_BUF 1024
#define TEST_ONE "GET / HTTP/1.1\r\n"\
"Host: archive.0xdeadbeer.xyz\r\n"\
"User-Agent: curl/8.9.1\r\n"\
"Accept: */*\r\n"
enum errs {
err_init = 0,
err_generic,
err_memory,
err_parse_title,
err_parse_title_method,
err_parse_title_uri,
err_parse_title_version
};
enum states {
state_init = 0,
state_title_method,
state_title_after_method,
state_title_uri,
state_title_after_uri,
state_title_version,
state_title_ok,
state_title_err
};
enum methods {
method_init = 0,
method_get,
method_post,
method_head
};
enum headers {
header_a_im = 0,
header_accept,
header_accept_charset,
header_accept_datetime,
header_accept_encoding,
header_accept_language,
header_access_control_request_method,
header_access_control_request_headers,
header_authorization,
header_cache_control,
header_connection,
header_content_encoding,
header_content_length,
header_content_md5,
header_content_type,
header_cookie,
header_date,
header_expect,
header_forwarded,
header_from,
header_host,
header_http2_settings,
header_if_match,
header_if_modified_since,
header_if_none_match,
header_if_range,
header_if_unmodified_since,
header_max_forwards,
header_origin,
header_pragma,
header_prefer,
header_proxy_authorization,
header_range,
header_referer,
header_te,
header_trailer,
header_transfer_encoding,
header_user_agent,
header_upgrade,
header_via,
header_warning,
header_upgrade_insecure_requests,
header_x_requested_with,
header_dnt,
header_x_forwarded_for,
header_x_forwarded_host,
header_x_forwarded_proto,
header_front_end_https,
header_x_http_method_override,
header_x_att_deviceid,
header_x_wap_profile,
header_proxy_connection,
header_x_uidh,
header_x_csrf_token,
header_x_request_id,
header_x_correlation_id,
header_correlation_id,
header_save_data,
header_sec_gpc,
header_accept_ch,
header_access_control_allow_origin,
header_access_control_allow_credentials,
header_access_control_expose_headers,
header_access_control_max_age,
header_access_control_allow_methods,
header_access_control_allow_headers,
header_accept_patch,
header_accept_ranges,
header_age,
header_allow,
header_alt_svc,
header_content_disposition,
header_content_language,
header_content_location,
header_content_range,
header_delta_base,
header_etag,
header_expires,
header_im,
header_last_modified,
header_link,
header_location,
header_p3p,
header_preference_applied,
header_proxy_authenticate,
header_public_key_pins,
header_retry_after,
header_server,
header_set_cookie,
header_strict_transport_security,
header_tk,
header_vary,
header_www_authenticate,
header_x_frame_options,
header_content_security_policy,
header_expect_ct,
header_nel,
header_permissions_policy,
header_refresh,
header_report_to,
header_status,
header_timing_allow_origin,
header_x_content_duration,
header_x_content_type_options,
header_x_powered_by,
header_x_redirect_by,
header_x_ua_compatible,
header_x_xss_protection
};
#endif