No need to initialize strings with "".
[bpdyndnsd] / src / httphelper.h
CommitLineData
efbde536
BS
1/** @file
2 * @brief HTTPHelper class header. This class represents a Helper to perform HTTP operations easily.
3 *
4 *
5 *
6 * @copyright Intra2net AG
7 * @license GPLv2
8*/
9
10#ifndef HTTPHELPER_H
11#define HTTPHELPER_H
12
13#include "logger.h"
14
15#include <boost/shared_ptr.hpp>
16#include <curl/curl.h>
17
18
19class HTTPHelper
20{
21private:
22
23 std::string Proxy;
24 int ProxyPort;
25 CURL* CurlEasyHandle;
26 std::string CurlWritedataBuff;
27 char* CurlErrBuff;
28
29 Logger::Ptr Log;
30
2dd2db3e
BS
31 void set_curl_url(const std::string& url);
32
33 void set_curl_auth(const std::string& username, const std::string& password);
34
efbde536
BS
35public:
36
37 typedef boost::shared_ptr<HTTPHelper> Ptr;
38
39 HTTPHelper();
40
2dd2db3e 41 HTTPHelper(Logger::Ptr _log, const std::string& _proxy, const int _proxy_port, const std::string& _username, const std::string& _password);
efbde536 42
7de01277
BS
43 HTTPHelper(Logger::Ptr _log, const std::string& _proxy, const int _proxy_port);
44
efbde536
BS
45 ~HTTPHelper();
46
47 CURL* init_curl(std::string& curl_writedata_buff, char* curl_err_buff) const;
48
d5a516ba 49 long http_get(const std::string& ip);
efbde536 50
b6228761
BS
51 std::string get_curl_data() const;
52
efbde536
BS
53 // libcurl is a C library, so we have to make the callback member function static :-(
54 static int http_receive(char *inBuffer, size_t size, size_t nmemb, std::string *outBuffer);
efbde536
BS
55};
56
57#endif