com.github.markusbernhardt.proxy.jna.win.WinHttpProxyInfo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of proxy-vole Show documentation
Show all versions of proxy-vole Show documentation
Proxy Vole is a Java library to auto detect the platform network proxy settings.
package com.github.markusbernhardt.proxy.jna.win;
import java.util.Arrays;
import java.util.List;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import com.sun.jna.platform.win32.WTypes;
import com.sun.jna.platform.win32.WinDef;
/**
* The WINHTTP_PROXY_INFO structure contains the session or default proxy
* configuration.
*
* @author Markus Bernhardt, Copyright 2016
*/
public class WinHttpProxyInfo extends Structure {
/**
* Unsigned long integer value that contains the access type. This can be
* one of the following values:
*
* - WINHTTP_ACCESS_TYPE_NO_PROXY
* - WINHTTP_ACCESS_TYPE_DEFAULT_PROXY
* - WINHTTP_ACCESS_TYPE_NAMED_PROXY
*
*/
public WinDef.DWORD dwAccessType;
/**
* Pointer to a string value that contains the proxy server list.
*/
public WTypes.LPWSTR lpszProxy;
/**
* Pointer to a string value that contains the proxy bypass list.
*/
public WTypes.LPWSTR lpszProxyBypass;
/**
* Create WinHttpProxyInfo structure.
*/
public WinHttpProxyInfo() {
super();
}
/**
* Create WinHttpProxyInfo structure cast onto pre-allocated memory.
*
* @param pointer
* pointer to pre-allocated memory
*/
public WinHttpProxyInfo(Pointer pointer) {
super(pointer);
read();
}
/**
* Return this Structure's field names in their proper order. For example,
*
*
*
* protected List getFieldOrder() {
* return Arrays.asList(new String[] { ... });
* }
*
*
*
* IMPORTANT When deriving from an existing Structure
* subclass, ensure that you augment the list provided by the superclass,
* e.g.
*
*
*
* protected List getFieldOrder() {
* List fields = new ArrayList(super.getFieldOrder());
* fields.addAll(Arrays.asList(new String[] { ... }));
* return fields;
* }
*
*
*
* Field order must be explicitly indicated, since the field order as
* returned by {@link Class#getFields()} is not guaranteed to be
* predictable.
*
* @return ordered list of field names
*/
@Override
protected List getFieldOrder() {
return Arrays.asList("dwAccessType", "lpszProxy", "lpszProxyBypass");
}
/**
* Tagging interface to indicate the address of an instance of the Structure
* type is to be used within a Structure
definition rather than
* nesting the full Structure contents. The default behavior is to inline
* Structure
fields.
*/
public static class ByReference extends WinHttpProxyInfo implements Structure.ByReference {
}
/**
* Tagging interface to indicate the value of an instance of the
* Structure
type is to be used in function invocations rather
* than its address. The default behavior is to treat Structure
* function parameters and return values as by reference, meaning the
* address of the structure is used.
*/
public static class ByValue extends WinHttpProxyInfo implements Structure.ByValue {
}
}