summaryrefslogtreecommitdiff
path: root/content/fetch.h
diff options
context:
space:
mode:
Diffstat (limited to 'content/fetch.h')
-rw-r--r--content/fetch.h46
1 files changed, 36 insertions, 10 deletions
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 <stdbool.h>
#include <sys/select.h>
-#include <curl/curl.h>
#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