From 1dd7e97eb3f2cd317ef64fa9c054aacba6499215 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Sun, 10 Jun 2007 17:46:44 +0000 Subject: Merge scheme switcher branch in. svn path=/trunk/netsurf/; revision=3330 --- content/fetch.h | 46 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 10 deletions(-) (limited to 'content/fetch.h') diff --git a/content/fetch.h b/content/fetch.h index bf4446830..348171d2c 100644 --- a/content/fetch.h +++ b/content/fetch.h @@ -14,7 +14,6 @@ #include #include -#include #include "utils/config.h" typedef enum { @@ -64,15 +63,17 @@ struct ssl_cert_info { #endif extern bool fetch_active; -extern CURLM *fetch_curl_multi; + +typedef void (*fetch_callback)(fetch_msg msg, void *p, const void *data, + unsigned long size); + void fetch_init(void); struct fetch * fetch_start(const char *url, const char *referer, - void (*callback)(fetch_msg msg, void *p, const void *data, - unsigned long size), - void *p, bool only_2xx, const char *post_urlenc, - struct form_successful_control *post_multipart, - bool verifiable, const char *parent_url, char *headers[]); + fetch_callback callback, + void *p, bool only_2xx, const char *post_urlenc, + struct form_successful_control *post_multipart, + bool verifiable, const char *parent_url, char *headers[]); void fetch_abort(struct fetch *f); void fetch_poll(void); void fetch_quit(void); @@ -80,10 +81,35 @@ const char *fetch_filetype(const char *unix_path); char *fetch_mimetype(const char *ro_path); bool fetch_can_fetch(const char *url); void fetch_change_callback(struct fetch *fetch, - void (*callback)(fetch_msg msg, void *p, const void *data, - unsigned long size), - void *p); + fetch_callback callback, + void *p); long fetch_http_code(struct fetch *fetch); const char *fetch_get_referer(struct fetch *fetch); +/* API for fetchers themselves */ + +typedef bool (*fetcher_initialise)(const char *); +typedef void* (*fetcher_setup_fetch)(struct fetch *, const char *, + bool, const char *, + struct form_successful_control *, bool, + const char *, const char **); +typedef bool (*fetcher_start_fetch)(void *); +typedef void (*fetcher_abort_fetch)(void *); +typedef void (*fetcher_free_fetch)(void *); +typedef void (*fetcher_poll_fetcher)(const char *); +typedef void (*fetcher_finalise)(const char *); + +bool fetch_add_fetcher(const char *scheme, + fetcher_initialise initialiser, + fetcher_setup_fetch setup_fetch, + fetcher_start_fetch start_fetch, + fetcher_abort_fetch abort_fetch, + fetcher_free_fetch free_fetch, + fetcher_poll_fetcher poll_fetcher, + fetcher_finalise finaliser); + +void fetch_send_callback(fetch_msg msg, struct fetch *fetch, void *data, unsigned long size); +void fetch_can_be_freed(struct fetch *fetch); +void fetch_set_http_code(struct fetch *fetch, long http_code); +const char *fetch_get_referer_to_send(struct fetch *fetch); #endif -- cgit v1.2.3