CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
evf::SquidNet Class Reference

#include <SquidNet.h>

Public Member Functions

bool check ()
 
 SquidNet (unsigned int, std::string const &)
 
virtual ~SquidNet ()
 

Private Attributes

unsigned int port_
 
std::string proxy_
 
std::string urlToGet_
 

Detailed Description

Definition at line 8 of file SquidNet.h.

Constructor & Destructor Documentation

evf::SquidNet::SquidNet ( unsigned int  proxyport,
std::string const &  url 
)

Definition at line 15 of file SquidNet.cc.

References port_, and proxy_.

15  : port_(proxyport), urlToGet_(url)
16  {
17  std::ostringstream oproxy;
18  oproxy << "localhost:" << port_;
19  proxy_ = oproxy.str();
20  }
unsigned int port_
Definition: SquidNet.h:15
std::string proxy_
Definition: SquidNet.h:16
std::string urlToGet_
Definition: SquidNet.h:17
virtual evf::SquidNet::~SquidNet ( )
inlinevirtual

Definition at line 12 of file SquidNet.h.

12 {}

Member Function Documentation

bool evf::SquidNet::check ( void  )

Definition at line 21 of file SquidNet.cc.

References error, NULL, proxy_, summarizeEdmComparisonLogfiles::success, urlToGet_, and evf::write_data().

Referenced by evf::FUEventProcessor::FUEventProcessor(), and evf::ParameterSetRetriever::ParameterSetRetriever().

21  {
22  bool retVal = true;
23 
24  CURL* han = curl_easy_init();
25  if(han==0)
26  {
27  XCEPT_RAISE(evf::Exception,"could not create handle for SquidNet fisher");
28  }
29  char error[CURL_ERROR_SIZE];
30  std::string dummy;
31 
32  struct curl_slist *headers=NULL; /* init to NULL is important */
33 
34  headers = curl_slist_append(headers, "Pragma:");
35 
36  curl_easy_setopt(han, CURLOPT_HTTPHEADER, headers);
37 
38  curl_easy_setopt(han, CURLOPT_PROXY, proxy_.c_str());
39 
40  curl_easy_setopt(han, CURLOPT_URL, urlToGet_.c_str());
41 
42  curl_easy_setopt(han, CURLOPT_WRITEFUNCTION, &write_data);
43  curl_easy_setopt(han, CURLOPT_WRITEDATA, &dummy);
44  curl_easy_setopt(han, CURLOPT_ERRORBUFFER, error);
45  int success = curl_easy_perform(han);
46 
47  curl_slist_free_all(headers); /* free the header list */
48 
49  curl_easy_cleanup(han);
50  if(success != 0)
51  retVal = false;
52  return retVal;
53  }
#define NULL
Definition: scimark2.h:8
std::string proxy_
Definition: SquidNet.h:16
static size_t write_data(void *ptr, size_t size, size_t nmemb, void *pointer)
Definition: CurlUtils.h:12
std::string urlToGet_
Definition: SquidNet.h:17

Member Data Documentation

unsigned int evf::SquidNet::port_
private

Definition at line 15 of file SquidNet.h.

Referenced by SquidNet().

std::string evf::SquidNet::proxy_
private

Definition at line 16 of file SquidNet.h.

Referenced by check(), and SquidNet().

std::string evf::SquidNet::urlToGet_
private

Definition at line 17 of file SquidNet.h.

Referenced by check().