Enable use of HTTP cache headers in curl plugin
[monky] / src / ccurl_thread.h
1 /* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
2  *
3  * Conky, a system monitor, based on torsmo
4  *
5  * Please see COPYING for details
6  *
7  * Copyright (c) 2005-2010 Brenden Matthews, Philip Kovacs, et. al.
8  *      (see AUTHORS)
9  * All rights reserved.
10  *
11  * This program is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation, either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  * You should have received a copy of the GNU General Public License
21  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
22  *
23  */
24
25 #ifndef _CURL_THREAD_H_
26 #define _CURL_THREAD_H_
27
28 #include "timed_thread.h"
29
30
31 /* curl thread lib exports begin */
32
33 typedef struct _ccurl_location_t {
34         /* uri of location */
35         char *uri;
36         char *last_modified;
37         char *etag;
38         /* a pointer to some arbitrary data, will be freed by ccurl_free_info() if
39          * non-null */
40         void *result;
41         /* internal thread pointer, destroyed by timed_thread.c */
42         timed_thread *p_timed_thread;
43         /* function to call when data is ready to be processed, the first argument
44          * will be the result pointer, and the second argument is an internal
45          * buffer that shouldn't be mangled */
46         void (*process_function)(void *, const char *);
47         /* internal list pointer, don't mess with this unless you don't know any
48          * better */
49         struct _ccurl_location_t *next;
50 } ccurl_location_t;
51
52 /* find an existing location for the uri specified */
53 ccurl_location_t *ccurl_find_location(ccurl_location_t **locations_head, char *uri);
54 /* free all locations (as well as location->uri and location->result if
55  * non-null) */
56 void ccurl_free_locations(ccurl_location_t **locations_head);
57 /* initiates a curl thread at the location specified using the interval in
58  * seconds */
59 void ccurl_init_thread(ccurl_location_t *curloc, int interval);
60
61 /* curl thread lib exports end */
62
63
64 /* $curl exports begin */
65
66 /* for $curl, free internal list pointer */
67 void ccurl_free_info(void);
68 /* runs instance of $curl */
69 void ccurl_process_info(char *p, int p_max_size, char *uri, int interval);
70
71 void curl_parse_arg(struct text_object *, const char *);
72 void curl_print(struct text_object *, char *, int);
73 void curl_obj_free(struct text_object *);
74
75 /* $curl exports end */
76
77 #endif /* _CURL_THREAD_H_ */
78