This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
tango-tfe/plugin/protocol/http/include/internal/http_common.h

108 lines
2.8 KiB
C

#pragma once
extern "C"
{
#include <sys/queue.h>
}
#include <tfe_http.h>
#include <http_half.h>
#include <http_parser.h>
struct http_plugin
{
};
TAILQ_HEAD(hs_private_list, http_session_private);
struct http_plugin_status
{
};
struct http_session_private
{
/* PUBLIC */
struct tfe_http_session hs_public;
/* TAILQ POINTER */
TAILQ_ENTRY(http_session_private) next;
/* REF, HTTP CONNECTION */
struct http_connection_private * hc_private;
/* HTTP FRAME CTX */
struct http_frame_session_ctx * ht_frame;
/* USER SETUP REQUEST HALF */
struct http_half_private * hf_private_req_user;
/* USER SETUP RESPONSE HALF */
struct http_half_private * hf_private_resp_user;
/* SUSPEND TAG */
bool suspend_tag_user;
/* SUSPEND EVENT */
tfe_http_event suspend_event;
/* SUSPEND TAG EFFECTIVE */
bool suspend_tag_effective;
};
struct http_connection_private
{
/* STREAM */
const struct tfe_stream * stream;
/* SESSION LIST, REQUEST-RESPONSE PAIRS */
struct hs_private_list hs_private_list;
/* ORPHAN SESSION LIST */
struct hs_private_list hs_private_orphan_list;
/* IS PREEMPTED */
unsigned int is_preempted;
/* SESSION ID COUNTER */
unsigned int session_id_counter;
};
static inline struct http_half_private * to_hf_request_private(struct http_session_private * hs_private)
{
if(hs_private == NULL) return NULL;
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)
{
if(hs_private == NULL) return NULL;
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)
{
if(hf_private == NULL) return NULL;
return &hf_private->hf_public;
}
static inline struct http_half_private * to_hf_private(struct tfe_http_half * hf_public)
{
if(hf_public == NULL) return NULL;
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)
{
if(hf_public == NULL) return NULL;
return container_of(hf_public, struct http_half_private, hf_public);
}
static inline const struct tfe_http_session * to_hs_public(const struct http_session_private * hs_private)
{
if (hs_private == NULL) return NULL;
return &hs_private->hs_public;
}
static inline struct tfe_http_session * to_hs_public(struct http_session_private * hs_private)
{
if (hs_private == NULL) return NULL;
return &hs_private->hs_public;
}
static inline struct http_session_private * to_hs_private(struct tfe_http_session * hs_public)
{
if (hs_public == NULL) return NULL;
return container_of(hs_public, struct http_session_private, hs_public);
}