00001 #ifndef HEADER_CURL_CONNCACHE_H 00002 #define HEADER_CURL_CONNCACHE_H 00003 /*************************************************************************** 00004 * _ _ ____ _ 00005 * Project ___| | | | _ \| | 00006 * / __| | | | |_) | | 00007 * | (__| |_| | _ <| |___ 00008 * \___|\___/|_| \_\_____| 00009 * 00010 * Copyright (C) 2015, Daniel Stenberg, <daniel@haxx.se>, et al. 00011 * Copyright (C) 2012 - 2014, Linus Nielsen Feltzing, <linus@haxx.se> 00012 * 00013 * This software is licensed as described in the file COPYING, which 00014 * you should have received as part of this distribution. The terms 00015 * are also available at https://curl.haxx.se/docs/copyright.html. 00016 * 00017 * You may opt to use, copy, modify, merge, publish, distribute and/or sell 00018 * copies of the Software, and permit persons to whom the Software is 00019 * furnished to do so, under the terms of the COPYING file. 00020 * 00021 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 00022 * KIND, either express or implied. 00023 * 00024 ***************************************************************************/ 00025 00026 struct conncache { 00027 struct curl_hash hash; 00028 size_t num_connections; 00029 long next_connection_id; 00030 struct timeval last_cleanup; 00031 }; 00032 00033 #define BUNDLE_NO_MULTIUSE -1 00034 #define BUNDLE_UNKNOWN 0 /* initial value */ 00035 #define BUNDLE_PIPELINING 1 00036 #define BUNDLE_MULTIPLEX 2 00037 00038 struct connectbundle { 00039 int multiuse; /* supports multi-use */ 00040 size_t num_connections; /* Number of connections in the bundle */ 00041 struct curl_llist *conn_list; /* The connectdata members of the bundle */ 00042 }; 00043 00044 int Curl_conncache_init(struct conncache *, int size); 00045 00046 void Curl_conncache_destroy(struct conncache *connc); 00047 00048 /* return the correct bundle, to a host or a proxy */ 00049 struct connectbundle *Curl_conncache_find_bundle(struct connectdata *conn, 00050 struct conncache *connc); 00051 00052 CURLcode Curl_conncache_add_conn(struct conncache *connc, 00053 struct connectdata *conn); 00054 00055 void Curl_conncache_remove_conn(struct conncache *connc, 00056 struct connectdata *conn); 00057 00058 void Curl_conncache_foreach(struct conncache *connc, 00059 void *param, 00060 int (*func)(struct connectdata *conn, 00061 void *param)); 00062 00063 struct connectdata * 00064 Curl_conncache_find_first_connection(struct conncache *connc); 00065 00066 void Curl_conncache_print(struct conncache *connc); 00067 00068 #endif /* HEADER_CURL_CONNCACHE_H */