My Project
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros Pages
CurlUtils.h
Go to the documentation of this file.
1 // $Id: CurlUtils.h,v 1.1 2009/11/12 23:56:50 eml Exp $
2 
3 #ifndef GCP_UTIL_CURLUTILS_H
4 #define GCP_UTIL_CURLUTILS_H
5 
15 #include <sstream>
16 #include <curl/curl.h>
17 
18 namespace gcp {
19  namespace util {
20 
21  class CurlUtils {
22  public:
23 
27  CurlUtils();
28 
32  virtual ~CurlUtils();
33 
34  std::string getUrl(std::string url, bool printStats=false);
35 
36  std::string postUserPass(std::string url, std::string user, std::string pass, std::string challenge);
37 
38  protected:
39 
40  enum {
41  OPTION_FALSE = 0,
42  OPTION_TRUE = 1
43  };
44 
45  // A stream containing the last read information returned from
46  // the URL fetch
47 
48  std::ostringstream lastRead_;
49 
50  // A function that will be called to handle data from a call to
51  // 'perform'
52 
53  static size_t handleData(void* buffer, size_t size, size_t nmemb, void* userp);
54 
55 
56  // Initialize the CURL interface
57 
58  CURL* initCurl();
59 
60  // Cleanup the CURL interface
61 
62  void cleanUp(CURL* ctx);
63 
64  // Perform the request specified, and return stats about it, if
65  // printStats=true
66 
67  const CURLcode performRequest(CURL* ctx, bool printStats);
68 
69  // Set up a URL to fetch
70 
71  void setUrl(CURL* ctx, std::string url);
72 
73  }; // End class CurlUtils
74 
75  } // End namespace util
76 } // End namespace gcp
77 
78 
79 
80 #endif // End #ifndef GCP_UTIL_CURLUTILS_H
CurlUtils()
Definition: CurlUtils.cc:10
virtual ~CurlUtils()
Definition: CurlUtils.cc:15
void setUrl(CURL *ctx, std::string url)
Definition: CurlUtils.cc:120
const CURLcode performRequest(CURL *ctx, bool printStats)
Definition: CurlUtils.cc:76
void cleanUp(CURL *ctx)
Definition: CurlUtils.cc:64
Definition: CurlUtils.h:21
Definition: tVideoCapabilitiesEml.cc:67
CURL * initCurl()
Definition: CurlUtils.cc:21