]> rtime.felk.cvut.cz Git - hornmich/skoda-qr-demo.git/blob - QRScanner/mobile/jni/thirdparty/curl/lib/multihandle.h
Add MuPDF native source codes
[hornmich/skoda-qr-demo.git] / QRScanner / mobile / jni / thirdparty / curl / lib / multihandle.h
1 #ifndef HEADER_CURL_MULTIHANDLE_H
2 #define HEADER_CURL_MULTIHANDLE_H
3 /***************************************************************************
4  *                                  _   _ ____  _
5  *  Project                     ___| | | |  _ \| |
6  *                             / __| | | | |_) | |
7  *                            | (__| |_| |  _ <| |___
8  *                             \___|\___/|_| \_\_____|
9  *
10  * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
11  *
12  * This software is licensed as described in the file COPYING, which
13  * you should have received as part of this distribution. The terms
14  * are also available at http://curl.haxx.se/docs/copyright.html.
15  *
16  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17  * copies of the Software, and permit persons to whom the Software is
18  * furnished to do so, under the terms of the COPYING file.
19  *
20  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21  * KIND, either express or implied.
22  *
23  ***************************************************************************/
24
25 struct Curl_message {
26   /* the 'CURLMsg' is the part that is visible to the external user */
27   struct CURLMsg extmsg;
28 };
29
30 /* NOTE: if you add a state here, add the name to the statename[] array as
31    well!
32 */
33 typedef enum {
34   CURLM_STATE_INIT,         /* 0 - start in this state */
35   CURLM_STATE_CONNECT_PEND, /* 1 - no connections, waiting for one */
36   CURLM_STATE_CONNECT,      /* 2 - resolve/connect has been sent off */
37   CURLM_STATE_WAITRESOLVE,  /* 3 - awaiting the resolve to finalize */
38   CURLM_STATE_WAITCONNECT,  /* 4 - awaiting the connect to finalize */
39   CURLM_STATE_WAITPROXYCONNECT, /* 5 - awaiting proxy CONNECT to finalize */
40   CURLM_STATE_PROTOCONNECT, /* 6 - completing the protocol-specific connect
41                                    phase */
42   CURLM_STATE_WAITDO,       /* 7 - wait for our turn to send the request */
43   CURLM_STATE_DO,           /* 8 - start send off the request (part 1) */
44   CURLM_STATE_DOING,        /* 9 - sending off the request (part 1) */
45   CURLM_STATE_DO_MORE,      /* 10 - send off the request (part 2) */
46   CURLM_STATE_DO_DONE,      /* 11 - done sending off request */
47   CURLM_STATE_WAITPERFORM,  /* 12 - wait for our turn to read the response */
48   CURLM_STATE_PERFORM,      /* 13 - transfer data */
49   CURLM_STATE_TOOFAST,      /* 14 - wait because limit-rate exceeded */
50   CURLM_STATE_DONE,         /* 15 - post data transfer operation */
51   CURLM_STATE_COMPLETED,    /* 16 - operation complete */
52   CURLM_STATE_MSGSENT,      /* 17 - the operation complete message is sent */
53   CURLM_STATE_LAST          /* 18 - not a true state, never use this */
54 } CURLMstate;
55
56 /* we support N sockets per easy handle. Set the corresponding bit to what
57    action we should wait for */
58 #define MAX_SOCKSPEREASYHANDLE 5
59 #define GETSOCK_READABLE (0x00ff)
60 #define GETSOCK_WRITABLE (0xff00)
61
62 struct Curl_one_easy {
63   /* first, two fields for the linked list of these */
64   struct Curl_one_easy *next;
65   struct Curl_one_easy *prev;
66
67   struct SessionHandle *easy_handle; /* the easy handle for this unit */
68   struct connectdata *easy_conn;     /* the "unit's" connection */
69
70   CURLMstate state;  /* the handle's state */
71   CURLcode result;   /* previous result */
72
73   struct Curl_message msg; /* A single posted message. */
74
75   /* Array with the plain socket numbers this handle takes care of, in no
76      particular order. Note that all sockets are added to the sockhash, where
77      the state etc are also kept. This array is mostly used to detect when a
78      socket is to be removed from the hash. See singlesocket(). */
79   curl_socket_t sockets[MAX_SOCKSPEREASYHANDLE];
80   int numsocks;
81 };
82
83 /* This is the struct known as CURLM on the outside */
84 struct Curl_multi {
85   /* First a simple identifier to easier detect if a user mix up
86      this multi handle with an easy handle. Set this to CURL_MULTI_HANDLE. */
87   long type;
88
89   /* We have a doubly-linked circular list with easy handles */
90   struct Curl_one_easy easy;
91
92   int num_easy; /* amount of entries in the linked list above. */
93   int num_alive; /* amount of easy handles that are added but have not yet
94                     reached COMPLETE state */
95
96   struct curl_llist *msglist; /* a list of messages from completed transfers */
97
98   /* callback function and user data pointer for the *socket() API */
99   curl_socket_callback socket_cb;
100   void *socket_userp;
101
102   /* Hostname cache */
103   struct curl_hash *hostcache;
104
105   /* timetree points to the splay-tree of time nodes to figure out expire
106      times of all currently set timers */
107   struct Curl_tree *timetree;
108
109   /* 'sockhash' is the lookup hash for socket descriptor => easy handles (note
110      the pluralis form, there can be more than one easy handle waiting on the
111      same actual socket) */
112   struct curl_hash *sockhash;
113
114   /* Whether pipelining is enabled for this multi handle */
115   bool pipelining_enabled;
116
117   /* Shared connection cache (bundles)*/
118   struct conncache *conn_cache;
119
120   /* This handle will be used for closing the cached connections in
121      curl_multi_cleanup() */
122   struct SessionHandle *closure_handle;
123
124   long maxconnects; /* if >0, a fixed limit of the maximum number of entries
125                        we're allowed to grow the connection cache to */
126
127   long max_host_connections; /* if >0, a fixed limit of the maximum number
128                                 of connections per host */
129
130   long max_total_connections; /* if >0, a fixed limit of the maximum number
131                                  of connections in total */
132
133   long max_pipeline_length; /* if >0, maximum number of requests in a
134                                pipeline */
135
136   long content_length_penalty_size; /* a connection with a
137                                        content-length bigger than
138                                        this is not considered
139                                        for pipelining */
140
141   long chunk_length_penalty_size; /* a connection with a chunk length
142                                      bigger than this is not
143                                      considered for pipelining */
144
145   struct curl_llist *pipelining_site_bl; /* List of sites that are blacklisted
146                                             from pipelining */
147
148   struct curl_llist *pipelining_server_bl; /* List of server types that are
149                                               blacklisted from pipelining */
150
151   /* timer callback and user data pointer for the *socket() API */
152   curl_multi_timer_callback timer_cb;
153   void *timer_userp;
154   struct timeval timer_lastcall; /* the fixed time for the timeout for the
155                                     previous callback */
156 };
157
158 #endif /* HEADER_CURL_MULTIHANDLE_H */
159