Implements a Proxy detection (WPAD) interface for Linux, Mac OSX and Windows. Offers a GUI for manual proxy settings and automatic WPAD detection. The GUI is based on QT.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

78 lines
1.9 KiB

/*! @file
@id $Id$
*/
// 1 2 3 4 5 6 7 8
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
#ifndef PROXYFACE_HXX
#define PROXYFACE_HXX
#include <list>
#include <string>
//! 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 //<SOCKS5 proxy
};
//! List of proxies, type -> url and port
typedef std::list< std::pair<Type, std::pair<std::string, std::string> > >
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 <proxyface/windoze.hxx>
namespace proxy {
typedef Windoze Face;
}
#else
// normal operating systems: use http://code.google.com/p/libproxy
#include <proxyface/unix.hxx>
namespace proxy {
typedef Unix Face;
}
#endif
#endif