变更HTTP业务层回调函数定义,增加session系列操作方法定义及虚接口实现。
* 不提供业务层针对单个数据包(段)的处理函数(返回值),业务层只能对单个session定义操作; * 通过session的方法(函数)通知解析层对该session的处理方法。
This commit is contained in:
@@ -18,12 +18,15 @@ struct http_session_private
|
||||
struct tfe_http_session hs_public;
|
||||
TAILQ_ENTRY(http_session_private) next;
|
||||
struct http_connection_private * hc_private;
|
||||
struct ht_frame_session_ctx * ht_frame;
|
||||
};
|
||||
|
||||
struct http_connection_private
|
||||
{
|
||||
/* ADDRESS */
|
||||
struct tfe_stream_addr * layer_addr;
|
||||
/* STREAM */
|
||||
struct tfe_stream * stream;
|
||||
/* SESSION LIST, REQUEST-RESPONSE PAIRS */
|
||||
struct hs_private_list hs_private_list;
|
||||
/* IS PREEMPTED */
|
||||
@@ -32,7 +35,15 @@ struct http_connection_private
|
||||
unsigned int session_id_counter;
|
||||
};
|
||||
|
||||
enum http_half_status
|
||||
TAILQ_HEAD(http_header_private_list, http_header_private);
|
||||
struct http_header_private
|
||||
{
|
||||
TAILQ_ENTRY(http_header_private) next;
|
||||
struct http_field_name * field;
|
||||
char * value;
|
||||
};
|
||||
|
||||
enum hf_private_status
|
||||
{
|
||||
STATUS_INIT,
|
||||
STATUS_READING,
|
||||
@@ -53,6 +64,8 @@ struct http_half_private
|
||||
size_t parse_cursor;
|
||||
/* HTTP PARSER'S ERRNO */
|
||||
enum http_errno parse_errno;
|
||||
/* HEADER K-V */
|
||||
struct http_header_private_list header_list;
|
||||
|
||||
/* UNDERLAY BUFFER */
|
||||
int method_or_status;
|
||||
@@ -67,9 +80,9 @@ struct http_half_private
|
||||
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;
|
||||
enum hf_private_status status_header;
|
||||
enum hf_private_status status_body;
|
||||
enum hf_private_status status_message;
|
||||
};
|
||||
|
||||
static inline struct http_half_private * to_hf_request_private(struct http_session_private * hs_private)
|
||||
@@ -88,3 +101,13 @@ static inline struct tfe_http_half * to_hf_public(struct http_half_private * hf_
|
||||
{
|
||||
return &hf_private->hf_public;
|
||||
}
|
||||
|
||||
static inline struct http_half_private * to_hf_private(struct tfe_http_half * hf_public)
|
||||
{
|
||||
return container_of(hf_public, struct http_half_private, hf_public);
|
||||
}
|
||||
|
||||
static inline const struct http_half_private * to_hf_private(const struct tfe_http_half * hf_public)
|
||||
{
|
||||
return container_of(hf_public, struct http_half_private, hf_public);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user