Jason Monk 602b232a06 Add PAC File support for proxy configuration
PAC (Proxy auto-config) files contain a single javascript function,
FindProxyForURL(url, host).  It gets called to determine what proxy should be
used for a specific request.

This adds PAC support to the system.  The ProxyProperties has been modified
to hold the PAC file when one is present.  The Proxy method
setHttpProxySystemProperty has been modified to insert a PacProxySelector
as the default ProxySelector when it is required.  This new ProxySelector
makes calls to the ConnectivityService to parse the PAC file.

The ConnectivityService and the WifiConfigStore have been modified to support
saving the extra PAC file data.

The ConnectivityService now has a class attached (PacProxyNative) that
interfaces to the native calls for PAC files.  The parsing of the PAC file
is handled by libpac (which is being added to external/) which utilizes
libv8 to parse the javascript.

As a fallback to applications that don't use the java ProxySelector,  the proxy
is setup to point to a local proxy server that will handle the pac parsing.

bug:10182711
Change-Id: I5eb8df893c632fd3e1b732385cb7720ad646f401
2013-08-07 21:01:39 -04:00

60 lines
1.3 KiB
C++

#ifndef IPROXY_SERVICE_H
#define IPROXY_SERVICE_H
#include <binder/IInterface.h>
#include <binder/IBinder.h>
namespace android {
class IProxyService : public IInterface {
public:
/**
* Keep up-to-date with
* frameworks/base/packages/services/Proxy/com/android/net/IProxyService.aidl
*/
enum {
RESOLVE_PROXIES = IBinder::FIRST_CALL_TRANSACTION,
SET_PAC,
START_PAC,
STOP_PAC,
};
public:
DECLARE_META_INTERFACE(ProxyService);
public:
virtual String16 resolveProxies(String16 host, String16 url) = 0;
virtual void setPacFile(String16& scriptContents) = 0;
virtual void startPacSystem() = 0;
virtual void stopPacSystem() = 0;
private:
};
class BpProxyService : public BpInterface<IProxyService> {
public:
BpProxyService(const sp<IBinder>& impl) : BpInterface<IProxyService>(impl) {}
virtual String16 resolveProxies(String16 host, String16 url);
virtual void setPacFile(String16& scriptContents);
virtual void startPacSystem();
virtual void stopPacSystem();
};
class BnProxyService : public BnInterface<IProxyService> {
public:
virtual status_t onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0);
private:
int getCallingUid();
bool notSystemUid();
};
}
#endif //IPROXY_SERVICE_H