Merge pull request #2874 from elfiesmelfie/feat_virt_block_info
[collectd.git] / src / utils / curl_stats / curl_stats.h
1 /**
2  * collectd - src/utils_curl_stats.h
3  * Copyright (C) 2015       Sebastian 'tokkee' Harl
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in
13  * all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21  * DEALINGS IN THE SOFTWARE.
22  *
23  * Authors:
24  *   Sebastian Harl <sh@tokkee.org>
25  **/
26
27 #ifndef UTILS_CURL_STATS_H
28 #define UTILS_CURL_STATS_H 1
29
30 #include "plugin.h"
31
32 #include <curl/curl.h>
33
34 struct curl_stats_s;
35 typedef struct curl_stats_s curl_stats_t;
36
37 /*
38  * curl_stats_from_config allocates and constructs a cURL statistics object
39  * from the specified configuration which is expected to be a single block of
40  * boolean options named after cURL information fields. The boolean value
41  * indicates whether to collect the respective information.
42  *
43  * See http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html
44  */
45 curl_stats_t *curl_stats_from_config(oconfig_item_t *ci);
46
47 void curl_stats_destroy(curl_stats_t *s);
48
49 /*
50  * curl_stats_dispatch dispatches performance values from the the specified
51  * cURL session to the daemon.
52  */
53 int curl_stats_dispatch(curl_stats_t *s, CURL *curl, const char *hostname,
54                         const char *plugin, const char *plugin_instance);
55
56 #endif /* UTILS_CURL_STATS_H */