Loading...
Searching...
No Matches
CAPI_Session.h
Go to the documentation of this file.
1/**************************************************************************************************
2 * This file is a part of Ultralight, an ultra-portable web-browser engine. *
3 * *
4 * See <https://ultralig.ht> for licensing and more. *
5 * *
6 * (C) 2024 Ultralight, Inc. *
7 **************************************************************************************************/
8
9///
10/// @file CAPI_Session.h
11///
12/// Storage for a browsing session (cookies, local storage, etc.).
13///
14/// `#include <Ultralight/CAPI/CAPI_Session.h>`
15///
16/// This class stores data for a unique browsing session (cookies, local storage, application cache,
17/// indexed db. etc.). You can create multiple sessions to isolate data between different browsing
18/// contexts.
19///
20/// ## Default Session
21///
22/// The library has a default session named "default" that is used if no session is specified when
23/// when creating a View.
24///
25/// ## Session Lifetime
26///
27/// Sessions can be either temporary (in-memory only) or persistent (backed to disk).
28///
29#ifndef ULTRALIGHT_CAPI_SESSION_H
30#define ULTRALIGHT_CAPI_SESSION_H
31
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
38/******************************************************************************
39 * Session
40 *****************************************************************************/
41
42///
43/// Create a Session to store local data in (such as cookies, local storage, application cache,
44/// indexed db, etc).
45///
46ULExport ULSession ulCreateSession(ULRenderer renderer, bool is_persistent, ULString name);
47
48///
49/// Destroy a Session.
50///
52
53///
54/// Get the default session (persistent session named "default").
55///
56/// @note This session is owned by the Renderer, you shouldn't destroy it.
57///
59
60///
61/// Whether or not is persistent (backed to disk).
62///
64
65///
66/// Unique name identifying the session (used for unique disk path).
67///
69
70///
71/// Unique numeric Id for the session.
72///
73ULExport unsigned long long ulSessionGetId(ULSession session);
74
75///
76/// The disk path to write to (used by persistent sessions only).
77///
79
80#ifdef __cplusplus
81} // extern "C"
82#endif
83
84#endif // ULTRALIGHT_CAPI_SESSION_H
Various defines and utility functions for the C API.
struct C_String * ULString
Definition CAPI_Defines.h:65
struct C_Session * ULSession
Definition CAPI_Defines.h:61
#define ULExport
Definition CAPI_Defines.h:38
struct C_Renderer * ULRenderer
Definition CAPI_Defines.h:60
ULExport void ulDestroySession(ULSession session)
Destroy a Session.
ULExport unsigned long long ulSessionGetId(ULSession session)
Unique numeric Id for the session.
ULExport bool ulSessionIsPersistent(ULSession session)
Whether or not is persistent (backed to disk).
ULExport ULSession ulDefaultSession(ULRenderer renderer)
Get the default session (persistent session named "default").
ULExport ULString ulSessionGetDiskPath(ULSession session)
The disk path to write to (used by persistent sessions only).
ULExport ULSession ulCreateSession(ULRenderer renderer, bool is_persistent, ULString name)
Create a Session to store local data in (such as cookies, local storage, application cache,...
ULExport ULString ulSessionGetName(ULSession session)
Unique name identifying the session (used for unique disk path).