OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2014 Eyeo GmbH |
| 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. |
| 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. |
| 13 * |
| 14 * You should have received a copy of the GNU General Public License |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 16 */ |
| 17 |
| 18 package org.adblockplus.android.configurators; |
| 19 |
| 20 import java.net.InetAddress; |
| 21 |
| 22 /** |
| 23 * Interface for different proxy registration types. Constructor must always suc
ceed, do any work that may fail in |
| 24 * {@link ProxyConfigurator#initialize()}. |
| 25 */ |
| 26 public interface ProxyConfigurator |
| 27 { |
| 28 /** |
| 29 * Initializes this {@code ProxyConfigurator}. This function will normally get
called only once. |
| 30 * |
| 31 * @return {@code true} if initialization succeeded |
| 32 */ |
| 33 public boolean initialize(); |
| 34 |
| 35 /** |
| 36 * Registers the proxy. May get called multiple times (e.g. for enable/disable
). |
| 37 * |
| 38 * @param address |
| 39 * The address ... |
| 40 * @param port |
| 41 * ... and port to bind to |
| 42 * @return {@code true} if registration succeeded |
| 43 */ |
| 44 public boolean registerProxy(InetAddress address, int port); |
| 45 |
| 46 /** |
| 47 * Unregisters the proxy. May get called multiple times (e.g. for enable/disab
le). |
| 48 */ |
| 49 public void unregisterProxy(); |
| 50 |
| 51 /** |
| 52 * Shuts down this configurator, normally called on application exit to perfor
m any clean up. |
| 53 * |
| 54 * @param context |
| 55 * Service/Application context |
| 56 */ |
| 57 public void shutdown(); |
| 58 |
| 59 /** |
| 60 * @return {@code true} if we actually registered the proxy |
| 61 */ |
| 62 public boolean isRegistered(); |
| 63 |
| 64 /** |
| 65 * Returning {@code true} here will allow the configurator to succeed on {@lin
k #initialize()} and fail on {@link #registerProxy(InetAddress, int)}. |
| 66 * This situation could arise for the CyanogenMod and iptables case. |
| 67 * |
| 68 * @return {@code true} to disable auto-advancing in configurator list |
| 69 */ |
| 70 public boolean isSticky(); |
| 71 |
| 72 /** |
| 73 * @return the registration type of this configurator. |
| 74 */ |
| 75 public ProxyRegistrationType getType(); |
| 76 } |
OLD | NEW |