Contents of /trunk/src/gcvote.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 158 - (hide annotations)
Wed Nov 4 14:54:52 2009 UTC (14 years, 6 months ago) by harbaum
File MIME type: text/plain
File size: 1810 byte(s)
Async gcvote
1 harbaum 157 /*
2     * Copyright (C) 2009 Till Harbaum <till@harbaum.org>.
3     *
4     * This file is part of GPXView.
5     *
6     * GPXView 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, either version 3 of the License, or
9     * (at your option) any later version.
10     *
11     * GPXView is distributed in the hope that it will be useful,
12     * but WITHOUT ANY WARRANTY; without even the implied warranty of
13     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14     * GNU General Public License for more details.
15     *
16     * You should have received a copy of the GNU General Public License
17     * along with GPXView. If not, see <http://www.gnu.org/licenses/>.
18     */
19    
20     #ifndef GCVOTE_H
21     #define GCVOTE_H
22    
23     #define GCVOTE_NONE -1
24    
25 harbaum 158 #include "gconf.h"
26 harbaum 157
27 harbaum 158 #include <curl/curl.h>
28     #include <curl/types.h>
29    
30     /* the full vote structure used during parsing */
31     typedef struct gcvote_s {
32     int quality;
33     int votes;
34     char *id;
35     struct gcvote_s *next;
36     } gcvote_t;
37    
38     /* a simple single vote */
39     typedef struct {
40     int quality;
41     int votes;
42     } vote_t;
43    
44     typedef struct {
45     char *ptr;
46     int len;
47     } curl_mem_t;
48    
49     typedef void (*gcvote_cb)(vote_t *, gpointer data);
50    
51     /* structure shared between worker and master thread */
52     typedef struct {
53     gint refcount; /* reference counter for master and worker thread */
54    
55     char *url, *id;
56    
57     /* curl/http related stuff: */
58     CURLcode res;
59     long response;
60     char buffer[CURL_ERROR_SIZE];
61    
62     curl_mem_t mem; /* used for NET_IO_DL_MEM */
63    
64     gcvote_cb cb;
65     gpointer userdata;
66    
67     /* system proxy settings if present */
68     proxy_t *proxy;
69    
70     } gcvote_request_t;
71    
72     gcvote_request_t *gcvote_request(appdata_t *appdata, gcvote_cb,
73     char *url, gpointer);
74     void gcvote_request_free(gcvote_request_t *request);
75    
76 harbaum 157 #endif // GCVOTE_H