91 lines
2.0 KiB
C
91 lines
2.0 KiB
C
#pragma once
|
|
|
|
extern "C"
|
|
{
|
|
#include <sys/queue.h>
|
|
}
|
|
|
|
#include <tfe_http.h>
|
|
#include <http_parser.h>
|
|
|
|
struct http_plugin
|
|
{
|
|
};
|
|
|
|
TAILQ_HEAD(hs_private_list, http_session_private);
|
|
struct http_session_private
|
|
{
|
|
struct tfe_http_session hs_public;
|
|
TAILQ_ENTRY(http_session_private) next;
|
|
struct http_connection_private * hc_private;
|
|
};
|
|
|
|
struct http_connection_private
|
|
{
|
|
/* ADDRESS */
|
|
struct tfe_stream_addr * layer_addr;
|
|
/* SESSION LIST, REQUEST-RESPONSE PAIRS */
|
|
struct hs_private_list hs_private_list;
|
|
/* IS PREEMPTED */
|
|
unsigned int is_preempted;
|
|
/* SESSION ID COUNTER */
|
|
unsigned int session_id_counter;
|
|
};
|
|
|
|
enum http_half_status
|
|
{
|
|
STATUS_INIT,
|
|
STATUS_READING,
|
|
STATUS_COMPLETE,
|
|
};
|
|
|
|
struct http_half_private
|
|
{
|
|
/* PUBLIC STRUCTURE */
|
|
struct tfe_http_half hf_public;
|
|
/* SESSION OF THIS REQUEST/RESPONSE */
|
|
struct http_session_private * session;
|
|
/* HTTP PARSER */
|
|
struct http_parser * parse_object;
|
|
/* HTTP PARSER SETTING */
|
|
struct http_parser_settings * parse_settings;
|
|
/* CURSOR RELATED TO DELAYED DATA */
|
|
size_t parse_cursor;
|
|
/* HTTP PARSER'S ERRNO */
|
|
enum http_errno parse_errno;
|
|
|
|
/* UNDERLAY BUFFER */
|
|
int method_or_status;
|
|
short major;
|
|
short minor;
|
|
|
|
struct evbuffer * evbuf_uri;
|
|
char * underlay_uri;
|
|
char * underlay_url;
|
|
|
|
struct evbuffer * evbuf_header_field;
|
|
struct evbuffer * evbuf_header_value;
|
|
struct evbuffer * evbuf_body;
|
|
|
|
enum http_half_status status_header;
|
|
enum http_half_status status_body;
|
|
enum http_half_status status_message;
|
|
};
|
|
|
|
static inline struct http_half_private * to_hf_request_private(struct http_session_private * hs_private)
|
|
{
|
|
struct tfe_http_half * hf_public = hs_private->hs_public.req;
|
|
return container_of(hf_public, struct http_half_private, hf_public);
|
|
}
|
|
|
|
static inline struct http_half_private * to_hf_response_private(struct http_session_private * hs_private)
|
|
{
|
|
struct tfe_http_half * hf_public = hs_private->hs_public.resp;
|
|
return container_of(hf_public, struct http_half_private, hf_public);
|
|
}
|
|
|
|
static inline struct tfe_http_half * to_hf_public(struct http_half_private * hf_private)
|
|
{
|
|
return &hf_private->hf_public;
|
|
}
|