CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/src/EventFilter/Utilities/interface/CurlPoster.h

Go to the documentation of this file.
00001 #ifndef CURLPOSTER_H
00002 #define CURLPOSTER_H
00003 
00004 #include <sys/utsname.h>
00005 #include <string>
00006 
00007 namespace evf {
00008 
00009 
00010   class CurlPoster
00011   {
00012   public:
00013 
00014     enum mode{text,stack,leg,legaux,bin};  
00015 
00016     CurlPoster(const std::string& url) : url_(url), active_(true){
00017       buf_=(struct utsname*)new char[sizeof(struct utsname)];
00018       uname(buf_);
00019       //      check();
00020     }
00021     virtual ~CurlPoster(){delete [] buf_;}
00022     bool check(int);
00023     void postBinary(const unsigned char *, size_t, unsigned int
00024                     , const std::string& = standard_post_method_); 
00025     void postString(const char *, size_t, unsigned int 
00026                     , mode, const std::string& = standard_post_method_); 
00027   private:
00028     void post(const unsigned char *, size_t, unsigned int, mode, const std::string&);
00029     std::string url_;
00030     bool active_;
00031     struct utsname* buf_; 
00032     static const std::string standard_post_method_;
00033   };
00034 
00035 } // evf
00036 
00037 #endif