NetSurf
url_db.h
Go to the documentation of this file.
1/*
2 * Copyright 2006 John M Bell <jmb202@ecs.soton.ac.uk>
3 *
4 * This file is part of NetSurf, http://www.netsurf-browser.org/
5 *
6 * NetSurf is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * NetSurf is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19/**
20 * \file
21 * Unified URL information database public interface
22 */
23
24#ifndef _NETSURF_URL_DB_H_
25#define _NETSURF_URL_DB_H_
26
27#include <stdbool.h>
28#include <time.h>
29
30#include "utils/errors.h"
32
33struct nsurl;
34struct bitmap;
35
36struct url_data {
37 const char *title; /**< Resource title */
38 unsigned int visits; /**< Visit count */
39 time_t last_visit; /**< Last visit time */
40 content_type type; /**< Type of resource */
41};
42
43
44/**
45 * Import an URL database from file, replacing any existing database
46 *
47 * \param filename Name of file containing data
48 */
49nserror urldb_load(const char *filename);
50
51
52/**
53 * Export the current database to file
54 *
55 * \param filename Name of file to export to
56 */
57nserror urldb_save(const char *filename);
58
59
60/**
61 * Iterate over entries in the database which match the given prefix
62 *
63 * \param prefix Prefix to match
64 * \param callback Callback function
65 */
66void urldb_iterate_partial(const char *prefix, bool (*callback)(struct nsurl *url, const struct url_data *data));
67
68
69/**
70 * Iterate over all entries in database
71 *
72 * \param callback Function to callback for each entry
73 */
74void urldb_iterate_entries(bool (*callback)(struct nsurl *url, const struct url_data *data));
75
76
77/**
78 * Find data for an URL.
79 *
80 * \param url Absolute URL to look for
81 * \return Pointer to result struct, or NULL
82 */
83const struct url_data *urldb_get_url_data(struct nsurl *url);
84
85
86/**
87 * Set certificate verification permissions
88 *
89 * \param url URL to consider
90 * \param permit Set to true to allow invalid certificates
91 */
92void urldb_set_cert_permissions(struct nsurl *url, bool permit);
93
94
95/**
96 * Dump URL database to stderr
97 */
98void urldb_dump(void);
99
100#endif
Declaration of content enumerations.
content_type
The type of a content.
Definition: content_type.h:53
Error codes.
nserror
Enumeration of error codes.
Definition: errors.h:29
struct nsurl nsurl
NetSurf URL object.
Definition: nsurl.h:31
RISC OS wimp toolkit bitmap.
Definition: bitmap.c:68
unsigned int visits
Visit count.
Definition: url_db.h:38
time_t last_visit
Last visit time.
Definition: url_db.h:39
content_type type
Type of resource.
Definition: url_db.h:40
const char * title
Resource title.
Definition: url_db.h:37
Interface to time operations.
nserror urldb_save(const char *filename)
Export the current database to file.
Definition: urldb.c:3094
void urldb_iterate_partial(const char *prefix, bool(*callback)(struct nsurl *url, const struct url_data *data))
Iterate over entries in the database which match the given prefix.
void urldb_set_cert_permissions(struct nsurl *url, bool permit)
Set certificate verification permissions.
Definition: urldb.c:3455
void urldb_dump(void)
Dump URL database to stderr.
Definition: urldb.c:4481
nserror urldb_load(const char *filename)
Import an URL database from file, replacing any existing database.
Definition: urldb.c:2876
void urldb_iterate_entries(bool(*callback)(struct nsurl *url, const struct url_data *data))
Iterate over all entries in database.
const struct url_data * urldb_get_url_data(struct nsurl *url)
Find data for an URL.
Definition: urldb.c:3309