ELinks 0.18.0
session.c File Reference

Sessions managment - you'll find things here which you wouldn't expect. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "elinks.h"
#include "bfu/dialog.h"
#include "bookmarks/bookmarks.h"
#include "cache/cache.h"
#include "config/home.h"
#include "config/options.h"
#include "dialogs/menu.h"
#include "dialogs/status.h"
#include "document/document.h"
#include "document/html/frames.h"
#include "document/html/iframes.h"
#include "document/refresh.h"
#include "document/renderer.h"
#include "document/view.h"
#include "globhist/globhist.h"
#include "intl/libintl.h"
#include "main/event.h"
#include "main/object.h"
#include "main/timer.h"
#include "network/connection.h"
#include "network/state.h"
#include "osdep/newwin.h"
#include "protocol/http/blacklist.h"
#include "protocol/protocol.h"
#include "protocol/uri.h"
#include "session/download.h"
#include "session/history.h"
#include "session/location.h"
#include "session/session.h"
#include "session/task.h"
#include "terminal/tab.h"
#include "terminal/terminal.h"
#include "terminal/window.h"
#include "util/conv.h"
#include "util/error.h"
#include "util/memlist.h"
#include "util/memory.h"
#include "util/string.h"
#include "util/time.h"
#include "viewer/text/draw.h"
#include "viewer/text/form.h"
#include "viewer/text/link.h"
#include "viewer/text/view.h"
#include "viewer/text/search.h"
Include dependency graph for session.c:

Data Structures

struct  file_to_load
struct  session_info
 This structure and related functions are used to maintain information for instances opened in new windows. More...
struct  questions_entry

Macros

#define file_to_load_is_active(ftl)
#define load_css_imports(ses, doc_view)

Functions

static struct file_to_loadrequest_additional_file (struct session *, const char *, struct uri *, int)
static struct session_infoget_session_info (int id)
static void done_session_info (struct session_info *info)
void done_saved_session_info (void)
static void session_info_timeout (int id)
 Timer callback for session_info.timer.
int add_session_info (struct session *ses, struct uri *uri, struct uri *referrer, cache_mode_T cache_mode, enum task_type task)
 Registers a base session and returns its id.
static struct sessioninit_saved_session (struct terminal *term, int id)
static struct sessionget_master_session (void)
static void done_retry_connection_without_verification (void *data)
static void retry_connection_without_verification (void *data)
void print_error_dialog (struct session *ses, struct connection_state state, struct uri *uri, connection_priority_T priority)
static void abort_files_load (struct session *ses, int interrupt)
void free_files (struct session *ses)
static void request_frameset (struct session *, struct frameset_desc *, int)
static void request_frame (struct session *ses, char *name, struct uri *uri, int depth)
static void request_iframe (struct session *ses, char *name, struct uri *uri, int depth)
static void request_iframes (struct session *ses, struct iframeset_desc *iframeset_desc, int depth)
static void load_ecmascript_imports (struct session *ses, struct document_view *doc_view)
static void load_iframes (struct session *ses, struct document_view *doc_view)
NONSTATIC_INLINE void load_frames (struct session *ses, struct document_view *doc_view)
void display_timer (struct session *ses)
 Timer callback for session.display_timer.
void load_common (struct session *ses)
void check_questions_queue (struct session *ses)
void add_questions_entry (void(*callback)(struct session *, void *), void *data)
static int check_incomplete_redirects (struct cache_entry *cached)
int session_is_loading (struct session *ses)
void doc_rerender_after_document_update (struct session *ses)
void doc_loading_callback (struct download *download, struct session *ses)
static void file_loading_callback (struct download *download, struct file_to_load *ftl)
static void load_additional_file (struct file_to_load *ftl, cache_mode_T cache_mode)
void process_file_requests (struct session *ses)
static void dialog_goto_url_open (void *data)
static int setup_first_session (struct session *ses, struct uri *uri)
static void setup_session (struct session *ses, struct uri *uri, struct session *base)
 First load the current URI of the base session.
static void init_remote_session (struct session *ses, remote_session_flags_T *remote_ptr, struct uri *uri)
struct stringencode_session_info (struct string *info, struct string_list_item list *url_list)
int decode_session_info (struct terminal *term, struct terminal_info *info)
 Older elinks versions (up to and including 0.9.1) sends no magic variable and if this is detected we fallback to the old session info format.
void abort_loading (struct session *ses, int interrupt)
static void destroy_session (struct session *ses)
void reload (struct session *ses, cache_mode_T cache_mode)
void reload_frame (struct session *ses, char *name, cache_mode_T cache_mode)
struct frameses_find_frame (struct session *ses, const char *name)
struct frameses_find_iframe (struct session *ses, char *name)
void set_session_referrer (struct session *ses, struct uri *referrer)
static void tabwin_func (struct window *tab, struct term_event *ev)
struct linkget_current_link_in_view (struct document_view *doc_view)
char * get_ui_clipboard_file (void)

Variables

struct session list sessions = { D_LIST_HEAD_EL(sessions) }
remote_session_flags_T remote_session_flags
static window_handler_T tabwin_func
static struct session_info list session_info = { D_LIST_HEAD_EL(session_info) }
static int session_info_id = 1
struct questions_entry list questions_queue = { D_LIST_HEAD_EL(questions_queue) }

Detailed Description

Sessions managment - you'll find things here which you wouldn't expect.

Macro Definition Documentation

◆ file_to_load_is_active

#define file_to_load_is_active ( ftl)
Value:
((ftl)->req_sent && is_in_progress_state((ftl)->download.state))
#define is_in_progress_state(state)
Definition state.h:30
Definition download.h:52
struct connection_state state
Definition download.h:66

◆ load_css_imports

#define load_css_imports ( ses,
doc_view )

Function Documentation

◆ abort_files_load()

void abort_files_load ( struct session * ses,
int interrupt )
static

◆ abort_loading()

void abort_loading ( struct session * ses,
int interrupt )

◆ add_questions_entry()

void add_questions_entry ( void(* callback )(struct session *, void *),
void * data )

◆ add_session_info()

int add_session_info ( struct session * ses,
struct uri * uri,
struct uri * referrer,
cache_mode_T cache_mode,
enum task_type task )

Registers a base session and returns its id.

Value <= 0 means error.

◆ check_incomplete_redirects()

int check_incomplete_redirects ( struct cache_entry * cached)
static

◆ check_questions_queue()

void check_questions_queue ( struct session * ses)

◆ decode_session_info()

int decode_session_info ( struct terminal * term,
struct terminal_info * info )

Older elinks versions (up to and including 0.9.1) sends no magic variable and if this is detected we fallback to the old session info format.

For this format the magic member of terminal_info hold the length of the URI string. The old format is handled by the default label in the switch.

The new session info format supports extraction of multiple URIS from the terminal_info data member. The magic variable controls how to interpret the fields:

◆ destroy_session()

void destroy_session ( struct session * ses)
static

◆ dialog_goto_url_open()

void dialog_goto_url_open ( void * data)
static

◆ display_timer()

void display_timer ( struct session * ses)

Timer callback for session.display_timer.

As explained in install_timer(), this function must erase the expired timer ID from all variables.

◆ doc_loading_callback()

void doc_loading_callback ( struct download * download,
struct session * ses )

◆ doc_rerender_after_document_update()

void doc_rerender_after_document_update ( struct session * ses)

This is really not nice. But that's the way how to display the final Javascript render taken from toggle_plain_html(ses, ses->doc_view, 0); This is toggled

◆ done_retry_connection_without_verification()

void done_retry_connection_without_verification ( void * data)
static

◆ done_saved_session_info()

void done_saved_session_info ( void )

◆ done_session_info()

void done_session_info ( struct session_info * info)
static

◆ encode_session_info()

struct string * encode_session_info ( struct string * info,
struct string_list_item list * url_list )

◆ file_loading_callback()

void file_loading_callback ( struct download * download,
struct file_to_load * ftl )
static

◆ free_files()

void free_files ( struct session * ses)

◆ get_current_link_in_view()

struct link * get_current_link_in_view ( struct document_view * doc_view)

◆ get_master_session()

struct session * get_master_session ( void )
static

◆ get_session_info()

struct session_info * get_session_info ( int id)
static

◆ get_ui_clipboard_file()

char * get_ui_clipboard_file ( void )

◆ init_remote_session()

void init_remote_session ( struct session * ses,
remote_session_flags_T * remote_ptr,
struct uri * uri )
static

◆ init_saved_session()

struct session * init_saved_session ( struct terminal * term,
int id )
static

◆ load_additional_file()

void load_additional_file ( struct file_to_load * ftl,
cache_mode_T cache_mode )
static

◆ load_common()

void load_common ( struct session * ses)

◆ load_ecmascript_imports()

void load_ecmascript_imports ( struct session * ses,
struct document_view * doc_view )
inlinestatic

◆ load_frames()

NONSTATIC_INLINE void load_frames ( struct session * ses,
struct document_view * doc_view )

◆ load_iframes()

void load_iframes ( struct session * ses,
struct document_view * doc_view )
static

◆ print_error_dialog()

void print_error_dialog ( struct session * ses,
struct connection_state state,
struct uri * uri,
connection_priority_T priority )

◆ process_file_requests()

void process_file_requests ( struct session * ses)

◆ reload()

void reload ( struct session * ses,
cache_mode_T cache_mode )

◆ reload_frame()

void reload_frame ( struct session * ses,
char * name,
cache_mode_T cache_mode )

◆ request_additional_file()

struct file_to_load * request_additional_file ( struct session * ses,
const char * name,
struct uri * uri,
int pri )
static

◆ request_frame()

void request_frame ( struct session * ses,
char * name,
struct uri * uri,
int depth )
static

◆ request_frameset()

void request_frameset ( struct session * ses,
struct frameset_desc * frameset_desc,
int depth )
static

◆ request_iframe()

void request_iframe ( struct session * ses,
char * name,
struct uri * uri,
int depth )
static

◆ request_iframes()

void request_iframes ( struct session * ses,
struct iframeset_desc * iframeset_desc,
int depth )
static

◆ retry_connection_without_verification()

void retry_connection_without_verification ( void * data)
static

◆ ses_find_frame()

struct frame * ses_find_frame ( struct session * ses,
const char * name )

◆ ses_find_iframe()

struct frame * ses_find_iframe ( struct session * ses,
char * name )

◆ session_info_timeout()

void session_info_timeout ( int id)
static

Timer callback for session_info.timer.

As explained in install_timer(), this function must erase the expired timer ID from all variables.

◆ session_is_loading()

int session_is_loading ( struct session * ses)
related

◆ set_session_referrer()

void set_session_referrer ( struct session * ses,
struct uri * referrer )
related

◆ setup_first_session()

int setup_first_session ( struct session * ses,
struct uri * uri )
static
Returns
0 if the first session was not properly initialized and setup_session() should be called on the session as well.

◆ setup_session()

void setup_session ( struct session * ses,
struct uri * uri,
struct session * base )
static

First load the current URI of the base session.

In most cases it will just be fetched from the cache so that the new tab will not appear `‘empty’ while loading the real URI or showing the goto URL dialog.

◆ tabwin_func()

void tabwin_func ( struct window * tab,
struct term_event * ev )
static

Variable Documentation

◆ questions_queue

struct questions_entry list questions_queue = { D_LIST_HEAD_EL(questions_queue) }

◆ remote_session_flags

◆ session_info

struct session_info list session_info = { D_LIST_HEAD_EL(session_info) }
static

◆ session_info_id

int session_info_id = 1
static

◆ sessions

struct session list sessions = { D_LIST_HEAD_EL(sessions) }

◆ tabwin_func

window_handler_T tabwin_func
static