Oops, add missing files.
[monky] / src / ccurl_thread.h
1 /*
2  * Conky, a system monitor, based on torsmo
3  *
4  * Please see COPYING for details
5  *
6  * Copyright (c) 2005-2009 Brenden Matthews, Philip Kovacs, et. al.
7  *      (see AUTHORS)
8  * All rights reserved.
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  * You should have received a copy of the GNU General Public License
20  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21  *
22  */
23
24 #ifndef _CURL_THREAD_H_
25 #define _CURL_THREAD_H_
26
27 typedef struct _ccurl_location_t {
28         char *uri; /* uri of location */
29         void *result; /* a pointer to some arbitrary data, will be freed by ccurl_free_info() if non-null */
30         timed_thread *p_timed_thread; /* internal thread pointer */
31         void (*process_function)(void *, const char *); /* function to call when data is ready to be processed, the first argument will be the result pointer, and the second argument is an internal buffer that shouldn't be mangled */
32         struct _ccurl_location_t *next; /* internal list pointer */
33 } ccurl_location_t;
34
35 /* find an existing location for the uri specified */
36 ccurl_location_t *ccurl_find_location(ccurl_location_t **locations_head, char *uri);
37 /* free all locations (as well as location->uri and location->result if
38  * non-null) */
39 void ccurl_free_locations(ccurl_location_t **locations_head);
40 /* initiates a thread at the location specified using the interval in seconds */
41 void ccurl_init_thread(ccurl_location_t *curloc, int interval);
42
43 /* for $curl, free internal list pointer */
44 void ccurl_free_info(void);
45 /* runs instance of $curl */
46 void ccurl_process_info(char *p, int p_max_size, char *uri, int interval);
47
48 #endif /* _CURL_THREAD_H_ */
49