CMS 3D CMS Logo

Public Member Functions | Private Attributes

evf::SquidNet Class Reference

#include <SquidNet.h>

List of all members.

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_.

                                                                 : port_(proxyport), urlToGet_(url) 
  {
    std::ostringstream oproxy;
    oproxy << "localhost:" << port_;
    proxy_ = oproxy.str();
  }
virtual evf::SquidNet::~SquidNet ( ) [inline, virtual]

Definition at line 12 of file SquidNet.h.

{}

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().

                      {
    bool retVal = true;
    
    CURL* han = curl_easy_init();
    if(han==0)
      {
        XCEPT_RAISE(evf::Exception,"could not create handle for SquidNet fisher");
      }
    char error[CURL_ERROR_SIZE];
    std::string dummy;

    struct curl_slist *headers=NULL; /* init to NULL is important */

    headers = curl_slist_append(headers, "Pragma:");

    curl_easy_setopt(han, CURLOPT_HTTPHEADER, headers);
 
    curl_easy_setopt(han, CURLOPT_PROXY, proxy_.c_str());
    
    curl_easy_setopt(han, CURLOPT_URL, urlToGet_.c_str());
    
    curl_easy_setopt(han, CURLOPT_WRITEFUNCTION, &write_data);
    curl_easy_setopt(han, CURLOPT_WRITEDATA, &dummy);
    curl_easy_setopt(han, CURLOPT_ERRORBUFFER, error);
    int success = curl_easy_perform(han);

    curl_slist_free_all(headers); /* free the header list */

    curl_easy_cleanup(han);
    if(success != 0)
      retVal = false;
    return retVal;
  }

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().