6#ifndef __CWIST_SESSION_H__
7#define __CWIST_SESSION_H__
HTTP Protocol Definitions and Helpers.
Compatibility header: forwards to <cwist/net/http/query.h>.
cwist_session_t * cwist_session_start(cwist_app *app, cwist_http_request *req, cwist_http_response *res)
Load or create a session for the current request.
void cwist_session_invalidate(cwist_session_t *session)
Mark the session for destruction (clears cookie on commit).
struct cwist_session cwist_session_t
Opaque session handle attached to a request.
void cwist_session_delete(cwist_session_t *session, const char *key)
Delete a session key.
void cwist_app_set_session_max_age(cwist_app *app, int seconds)
Set session cookie max-age in seconds. Defaults to 86400 (1 day).
void cwist_app_set_session_name(cwist_app *app, const char *name)
Set session cookie name. Defaults to "cwist_session".
int cwist_app_use_session(cwist_app *app, const char *secret)
Initialize session handling for an app with a signing secret.
const char * cwist_session_get(cwist_session_t *session, const char *key)
Get a session value by key.
int cwist_session_set(cwist_session_t *session, const char *key, const char *value)
Set a session value. Value is copied.
cwist_middleware_func cwist_mw_session(cwist_app *app)
Session middleware factory.
void cwist_session_destroy(cwist_session_t *session)
Destroy a session handle and its data.
int cwist_session_commit(cwist_session_t *session, cwist_http_response *res)
Persist the session to the response cookie.
Main Application Context.
HTTP Response Object. Supports standard string body or Zero-Copy pointer body.
Core Application Structure and Lifecycle Management.
void(* cwist_middleware_func)(cwist_http_request *req, cwist_http_response *res, cwist_handler_func next)
Middleware type that receives req/res pair and the next stage in the chain.