free_mark_by_index(i); if (!mark_vs) return; vs = mem_calloc(1, sizeof(*vs)); if (!vs) return; copy_vs(vs, mark_vs); marks[i] = vs; } static void done_marks(struct module *xxx) { int i; for (i = 0; i < MARKS_SIZE; i++) { free_mark_by_index(i); } } struct module viewer_marks_module = struct_module( /* name: */ N_("Marks"), /* options: */ NULL, /* hooks: */ NULL, /* submodules: */ NULL, /* data: */ NULL, /* init: */ NULL, /* done: */ done_marks );
INIT_OPT_STRING("connection.ssl.client_cert", N_("Certificate File"), "file", 0, "", N_("The location of a file containing the client certificate " "and unencrypted private key in PEM format. If unset, the " "file pointed to by the X509_CLIENT_CERT variable is used " "instead.")), #endif NULL_OPTION_INFO, }; static struct module openssl_module = struct_module( /* name: */ "OpenSSL", /* options: */ openssl_options, /* events: */ NULL, /* submodules: */ NULL, /* data: */ NULL, /* init: */ init_openssl, /* done: */ done_openssl ); #elif defined(CONFIG_GNUTLS) static gnutls_anon_client_credentials_t anon_cred = NULL; static gnutls_certificate_credentials_t xcred = NULL; #if 0 const static int kx_priority[16] = { GNUTLS_KX_RSA, GNUTLS_KX_DHE_DSS, GNUTLS_KX_DHE_RSA, GNUTLS_KX_SRP, /* Do not use anonymous authentication, unless you know what that means */ GNUTLS_KX_ANON_DH, GNUTLS_KX_RSA_EXPORT, 0
#include "osdep/osdep.h" #include "protocol/auth/auth.h" #include "protocol/common.h" #include "protocol/protocol.h" #include "protocol/smb/smb.h" #include "protocol/uri.h" #include "util/conv.h" #include "util/file.h" #include "util/memory.h" #include "util/string.h" struct module smb_protocol_module = struct_module( /* name: */ N_("SMB"), /* options: */ NULL, /* hooks: */ NULL, /* submodules: */ NULL, /* data: */ NULL, /* init: */ NULL, /* done: */ NULL ); static FILE *header_out, *data_out; /* The child process generally does not bother to free the memory it * allocates. When the process exits, the operating system will free * the memory anyway. There is no point in changing this, because the * child process also inherits memory allocations from the parent * process, and it would be very cumbersome to free those. */ static void smb_error(struct connection_state error)
#include "osdep/osdep.h" #include "osdep/sysname.h" #include "protocol/common.h" #include "protocol/file/mailcap.h" #include "protocol/http/http.h" #include "protocol/uri.h" #include "terminal/terminal.h" #include "util/conv.h" #include "util/env.h" #include "util/string.h" struct module mailcap_protocol_module = struct_module( /* name: */ N_("Mailcap"), /* options: */ NULL, /* hooks: */ NULL, /* submodules: */ NULL, /* data: */ NULL, /* init: */ NULL, /* done: */ NULL ); #ifdef HAVE_FORK static void get_request(struct connection *conn) { struct read_buffer *rb = alloc_read_buffer(conn->socket); if (!rb) return; memcpy(rb->data, "HTTP/1.0 200 OK\r\nContent-Type: text/plain\r\n\r\n", 45); rb->length = 45;
#ifdef CONFIG_LUA &lua_scripting_module, #endif #ifdef CONFIG_GUILE &guile_scripting_module, #endif #ifdef CONFIG_PERL &perl_scripting_module, #endif #ifdef CONFIG_PYTHON &python_scripting_module, #endif #ifdef CONFIG_RUBY &ruby_scripting_module, #endif #ifdef CONFIG_SM_SCRIPTING &smjs_scripting_module, #endif NULL, }; struct module scripting_module = struct_module( /* name: */ N_("Scripting"), /* options: */ NULL, /* events: */ NULL, /* submodules: */ scripting_modules, /* data: */ NULL, /* init: */ NULL, /* done: */ NULL );
return 0; } static void init_timer(struct module *module) { static const struct change_hook_info timer_change_hooks[] = { { (const unsigned char *)"infofiles.save_interval", periodic_save_change_hook }, { NULL, NULL }, }; register_change_hooks(timer_change_hooks); periodic_save_handler(NULL); } static void done_timer(struct module *module) { kill_timer(&periodic_save_timer); } struct module periodic_saving_module = struct_module( /* name: */ N_("Periodic Saving"), /* options: */ NULL, /* hooks: */ NULL, /* submodules: */ NULL, /* data: */ NULL, /* init: */ init_timer, /* done: */ done_timer );
if (uu) { struct uri *uri = ses && have_location(ses) ? cur_loc(ses)->vs.uri : NULL; uu = rewrite_uri(uu, uri, arg); if (uu) { mem_free(*url); *url = uu; } } return EVENT_HOOK_STATUS_NEXT; } struct event_hook_info uri_rewrite_hooks[] = { { "goto-url", -1, goto_url_hook }, NULL_EVENT_HOOK_INFO }; struct module uri_rewrite_module = struct_module( /* name: */ N_("URI rewrite"), /* options: */ uri_rewrite_options, /* hooks: */ uri_rewrite_hooks, /* submodules: */ NULL, /* data: */ NULL, /* init: */ NULL, /* done: */ NULL );
done_auth(struct module *xxx) { free_auth(); } struct auth_entry * get_invalid_auth_entry(void) { struct auth_entry *entry; #ifdef DEBUG_HTTP_AUTH DBG("get_invalid_auth_entry"); #endif foreach (entry, auth_entry_list) if (!entry->valid) return entry; return NULL; } struct module auth_module = struct_module( /* name: */ N_("Authentication"), /* options: */ NULL, /* hooks: */ NULL, /* submodules: */ NULL, /* data: */ NULL, /* init: */ NULL, /* done: */ done_auth );
/* ECMAScript browser scripting module */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "elinks.h" #include "main/module.h" #include "scripting/smjs/core.h" #include "scripting/smjs/hooks.h" struct module smjs_scripting_module = struct_module( /* name: */ "ECMAScript scripting engine", /* options: */ NULL, /* events: */ smjs_scripting_hooks, /* submodules: */ NULL, /* data: */ NULL, /* init: */ init_smjs, /* done: */ cleanup_smjs );
} static struct event_hook_info goto_url_history_hooks[] = { { "periodic-saving", 0, goto_url_history_write_hook, NULL }, NULL_EVENT_HOOK_INFO, }; static void init_url_history(struct module *module) { load_url_history(); } static void done_url_history(struct module *module) { save_url_history(); free_list(goto_url_history.entries); } struct module goto_url_history_module = struct_module( /* name: */ N_("Goto URL History"), /* options: */ NULL, /* hooks: */ goto_url_history_hooks, /* submodules: */ NULL, /* data: */ NULL, /* init: */ init_url_history, /* done: */ done_url_history );
return add_uri_to_string(string, uri, URI_FILENAME); } /* Backends dynamic area: */ #include "mime/backend/default.h" #include "mime/backend/mailcap.h" #include "mime/backend/mimetypes.h" static struct module *mime_submodules[] = { &default_mime_module, #ifdef CONFIG_MAILCAP &mailcap_mime_module, #endif #ifdef CONFIG_MIMETYPES &mimetypes_mime_module, #endif NULL, }; struct module mime_module = struct_module( /* name: */ N_("MIME"), /* options: */ mime_options, /* hooks: */ NULL, /* submodules: */ mime_submodules, /* data: */ NULL, /* init: */ NULL, /* done: */ NULL );
#elif defined(HAVE_JS_SETBRANCHCALLBACK) setup_safeguard(interpreter, ctx); #endif ret = JS_CallFunction(ctx, NULL, fun, 0, NULL, &rval); #if defined(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT) done_heartbeat(interpreter->heartbeat); #endif if (ret == 2) { /* onClick="history.back()" */ return 0; } if (ret == JS_FALSE) { return -1; } if (JSVAL_IS_VOID(rval)) { /* Undefined value. */ return -1; } return jsval_to_boolean(ctx, &rval); } struct module spidermonkey_module = struct_module( /* name: */ N_("SpiderMonkey"), /* options: */ NULL, /* events: */ NULL, /* submodules: */ NULL, /* data: */ NULL, /* init: */ spidermonkey_init, /* done: */ spidermonkey_done );
INIT_OPT_BOOL("protocol.file", N_("Try encoding extensions"), "try_encoding_extensions", 0, 1, N_("When set, if we can't open a file named 'filename', " "we'll try to open 'filename' with some encoding extension " "appended (ie. 'filename.gz'); it depends on the supported " "encodings.")), NULL_OPTION_INFO, }; struct module file_protocol_module = struct_module( /* name: */ N_("File"), /* options: */ file_options, /* hooks: */ NULL, /* submodules: */ NULL, /* data: */ NULL, /* init: */ NULL, /* done: */ NULL ); /* Directory listing */ /* Based on the @entry attributes and file-/dir-/linkname is added to the @data * fragment. All the strings are in the system charset. */ static inline void add_dir_entry(struct directory_entry *entry, struct string *page, int pathlen, unsigned char *dircolor) { unsigned char *lnk = NULL;