2006-04-10 03:21:13 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2006 John M Bell <jmb202@ecs.soton.ac.uk>
|
2007-08-08 20:16:03 +04:00
|
|
|
*
|
|
|
|
* This file is part of NetSurf, http://www.netsurf-browser.org/
|
|
|
|
*
|
|
|
|
* NetSurf is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; version 2 of the License.
|
|
|
|
*
|
|
|
|
* NetSurf is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2006-04-10 03:21:13 +04:00
|
|
|
*/
|
|
|
|
|
2016-06-14 01:34:45 +03:00
|
|
|
/**
|
|
|
|
* \file
|
|
|
|
* Unified URL information database internal interface.
|
2006-04-10 03:21:13 +04:00
|
|
|
*/
|
|
|
|
|
2017-03-14 00:19:59 +03:00
|
|
|
#ifndef NETSURF_CONTENT_URLDB_H
|
|
|
|
#define NETSURF_CONTENT_URLDB_H
|
2006-04-10 03:21:13 +04:00
|
|
|
|
2016-06-14 01:34:45 +03:00
|
|
|
#include <libwapcaplet/libwapcaplet.h>
|
|
|
|
|
|
|
|
#include "netsurf/url_db.h"
|
|
|
|
#include "netsurf/cookie_db.h"
|
2006-04-10 03:21:13 +04:00
|
|
|
|
2014-11-02 02:27:29 +03:00
|
|
|
/**
|
|
|
|
* Destroy urldb
|
|
|
|
*/
|
2006-12-09 01:38:46 +03:00
|
|
|
void urldb_destroy(void);
|
|
|
|
|
2014-11-02 02:27:29 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the cross-session persistence of the entry for an URL
|
|
|
|
*
|
|
|
|
* \param url Absolute URL to persist
|
|
|
|
* \param persist True to persist, false otherwise
|
2017-03-14 00:19:59 +03:00
|
|
|
* \return NSERROR_OK on success or NSERROR_NOT_FOUND if url not in database
|
2014-11-02 02:27:29 +03:00
|
|
|
*/
|
2017-03-14 00:19:59 +03:00
|
|
|
nserror urldb_set_url_persistence(struct nsurl *url, bool persist);
|
2014-11-02 02:27:29 +03:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Insert an URL into the database
|
|
|
|
*
|
|
|
|
* \param url Absolute URL to insert
|
|
|
|
* \return true on success, false otherwise
|
|
|
|
*/
|
2016-06-14 01:34:45 +03:00
|
|
|
bool urldb_add_url(struct nsurl *url);
|
2006-04-10 03:21:13 +04:00
|
|
|
|
2014-11-02 02:27:29 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set an URL's title string, replacing any existing one
|
|
|
|
*
|
|
|
|
* \param url The URL to look for
|
|
|
|
* \param title The title string to use (copied)
|
2017-03-13 19:38:24 +03:00
|
|
|
* \return NSERROR_OK on success otherwise appropriate error code
|
2014-11-02 02:27:29 +03:00
|
|
|
*/
|
2017-03-13 19:38:24 +03:00
|
|
|
nserror urldb_set_url_title(struct nsurl *url, const char *title);
|
2016-06-14 01:34:45 +03:00
|
|
|
|
2014-11-02 02:27:29 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set an URL's content type
|
|
|
|
*
|
|
|
|
* \param url The URL to look for
|
|
|
|
* \param type The type to set
|
|
|
|
*/
|
2016-06-14 01:34:45 +03:00
|
|
|
void urldb_set_url_content_type(struct nsurl *url, content_type type);
|
|
|
|
|
2014-11-02 02:27:29 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Update an URL's visit data
|
|
|
|
*
|
|
|
|
* \param url The URL to update
|
2017-03-08 16:13:21 +03:00
|
|
|
* \return NSERROR_OK on success or NSERROR_NOT_FOUND if url not in database
|
2014-11-02 02:27:29 +03:00
|
|
|
*/
|
2017-03-08 16:13:21 +03:00
|
|
|
nserror urldb_update_url_visit_data(struct nsurl *url);
|
2016-06-14 01:34:45 +03:00
|
|
|
|
2014-11-02 02:27:29 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Reset an URL's visit statistics
|
|
|
|
*
|
|
|
|
* \param url The URL to reset
|
|
|
|
*/
|
2016-06-14 01:34:45 +03:00
|
|
|
void urldb_reset_url_visit_data(struct nsurl *url);
|
2014-11-02 02:27:29 +03:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Extract an URL from the db
|
|
|
|
*
|
|
|
|
* \param url URL to extract
|
|
|
|
* \return Pointer to database's copy of URL or NULL if not found
|
|
|
|
*/
|
2016-06-14 01:34:45 +03:00
|
|
|
struct nsurl *urldb_get_url(struct nsurl *url);
|
2006-04-10 03:21:13 +04:00
|
|
|
|
2014-11-02 02:27:29 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieve certificate verification permissions from database
|
|
|
|
*
|
|
|
|
* \param url Absolute URL to search for
|
|
|
|
* \return true to permit connections to hosts with invalid certificates,
|
|
|
|
* false otherwise.
|
|
|
|
*/
|
2016-06-14 01:34:45 +03:00
|
|
|
bool urldb_get_cert_permissions(struct nsurl *url);
|
2006-04-10 03:21:13 +04:00
|
|
|
|
2014-11-02 02:27:29 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set thumbnail for url, replacing any existing thumbnail
|
|
|
|
*
|
|
|
|
* \param url Absolute URL to consider
|
|
|
|
* \param bitmap Opaque pointer to thumbnail data, or NULL to invalidate
|
2017-03-14 00:19:59 +03:00
|
|
|
* \return true on successful setting else false
|
2014-11-02 02:27:29 +03:00
|
|
|
*/
|
2016-08-09 14:26:37 +03:00
|
|
|
bool urldb_set_thumbnail(struct nsurl *url, struct bitmap *bitmap);
|
2014-11-02 02:27:29 +03:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Parse Set-Cookie header and insert cookie(s) into database
|
|
|
|
*
|
|
|
|
* \param header Header to parse, with Set-Cookie: stripped
|
|
|
|
* \param url URL being fetched
|
2017-03-14 00:19:59 +03:00
|
|
|
* \param referrer Referring resource, or 0 for verifiable transaction
|
2014-11-02 02:27:29 +03:00
|
|
|
* \return true on success, false otherwise
|
|
|
|
*/
|
2016-06-14 01:34:45 +03:00
|
|
|
bool urldb_set_cookie(const char *header, struct nsurl *url, struct nsurl *referer);
|
|
|
|
|
2014-11-02 02:27:29 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieve cookies for an URL
|
|
|
|
*
|
|
|
|
* \param url URL being fetched
|
|
|
|
* \param include_http_only Whether to include HTTP(S) only cookies.
|
|
|
|
* \return Cookies string for libcurl (on heap), or NULL on error/no cookies
|
|
|
|
*/
|
2016-06-14 01:34:45 +03:00
|
|
|
char *urldb_get_cookie(struct nsurl *url, bool include_http_only);
|
2014-11-02 02:27:29 +03:00
|
|
|
|
|
|
|
|
2006-04-10 03:21:13 +04:00
|
|
|
#endif
|