/*! @file @id $Id$ */ // 1 2 3 4 5 6 7 8 // 45678901234567890123456789012345678901234567890123456789012345678901234567890 #ifndef PROXYFACE_HXX #define PROXYFACE_HXX #include #include //! auto proxy configuration namespace proxy { //! exceptions namespace exc { //! unspecific error class error: std::exception { public: virtual const char* what() const throw() { return "Auto Proxy Detection Error"; } }; } //! Proxy types enum Type { DIRECT, //< direct connection, no proxy DEFAULT, //< default proxy HTTP, //< HTTP proxy host SOCKS // url and port typedef std::list< std::pair > > List; //! Unified Interface for accessing proxy::Face /*! Abstract interface, impementation for Unix and Windoze differs. Instanciate proxy::Face, which is a typedef to your platform's implementation. @code proxy::Auto pf; // keep for program life time (because of caching) proxy::List pf.proxies("http://swisssign.com"); [...] // set proxy, read from http://swisssign.com @endcode */ class Interface { public: //! Keep your instance as long as possible, because of caching. Interface() {} virtual ~Interface() {} //! Get list of proxies for a given URL. /*! @throw a child of std::exception if anything fails */ virtual List proxies(const std::string& url) = 0; }; } #ifdef WIN32 // use windoze proprietary winhttp #include namespace proxy { typedef Windoze Face; } #else // normal operating systems: use http://code.google.com/p/libproxy #include namespace proxy { typedef Unix Face; } #endif #endif