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 * @author rjeschke |
| 27 */ |
| 28 public interface ProxyConfigurator |
| 29 { |
| 30 /** |
| 31 * Initializes this {@code ProxyConfigurator}. This function will normally get
called only once. |
| 32 * |
| 33 * @return {@code true} if initialization succeeded |
| 34 */ |
| 35 public boolean initialize(); |
| 36 |
| 37 /** |
| 38 * Registers the proxy. May get called multiple times (e.g. for enable/disable
). |
| 39 * |
| 40 * @param address |
| 41 * The address ... |
| 42 * @param port |
| 43 * ... and port to bind to |
| 44 * @return {@code true} if registration succeeded |
| 45 */ |
| 46 public boolean registerProxy(InetAddress address, int port); |
| 47 |
| 48 /** |
| 49 * Unregisters the proxy. May get called multiple times (e.g. for enable/disab
le). |
| 50 */ |
| 51 public void unregisterProxy(); |
| 52 |
| 53 /** |
| 54 * Shuts down this configurator, normally called on application exit to perfor
m any clean up. |
| 55 * |
| 56 * @param context |
| 57 * Service/Application context |
| 58 */ |
| 59 public void shutdown(); |
| 60 |
| 61 /** |
| 62 * @return {@code true} if we actually registered the proxy |
| 63 */ |
| 64 public boolean isRegistered(); |
| 65 |
| 66 /** |
| 67 * Returning {@code true} here will allow the configurator to succeed on {@lin
k #initialize()} and fail on {@link #registerProxy(InetAddress, int)}. |
| 68 * This situation could arise for the CyanogenMod and iptables case. |
| 69 * |
| 70 * @return {@code true} to disable auto-advancing in configurator list |
| 71 */ |
| 72 public boolean isSticky(); |
| 73 |
| 74 /** |
| 75 * @return the registration type of this configurator. |
| 76 */ |
| 77 public ProxyRegistrationType getType(); |
| 78 } |
OLD | NEW |