mobile/android/thirdparty/ch/boye/httpclientandroidlib/conn/routing/RouteInfo.java

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

michael@0 1 /*
michael@0 2 * ====================================================================
michael@0 3 * Licensed to the Apache Software Foundation (ASF) under one
michael@0 4 * or more contributor license agreements. See the NOTICE file
michael@0 5 * distributed with this work for additional information
michael@0 6 * regarding copyright ownership. The ASF licenses this file
michael@0 7 * to you under the Apache License, Version 2.0 (the
michael@0 8 * "License"); you may not use this file except in compliance
michael@0 9 * with the License. You may obtain a copy of the License at
michael@0 10 *
michael@0 11 * http://www.apache.org/licenses/LICENSE-2.0
michael@0 12 *
michael@0 13 * Unless required by applicable law or agreed to in writing,
michael@0 14 * software distributed under the License is distributed on an
michael@0 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
michael@0 16 * KIND, either express or implied. See the License for the
michael@0 17 * specific language governing permissions and limitations
michael@0 18 * under the License.
michael@0 19 * ====================================================================
michael@0 20 *
michael@0 21 * This software consists of voluntary contributions made by many
michael@0 22 * individuals on behalf of the Apache Software Foundation. For more
michael@0 23 * information on the Apache Software Foundation, please see
michael@0 24 * <http://www.apache.org/>.
michael@0 25 *
michael@0 26 */
michael@0 27
michael@0 28 package ch.boye.httpclientandroidlib.conn.routing;
michael@0 29
michael@0 30 import java.net.InetAddress;
michael@0 31
michael@0 32 import ch.boye.httpclientandroidlib.HttpHost;
michael@0 33
michael@0 34 /**
michael@0 35 * Read-only interface for route information.
michael@0 36 *
michael@0 37 * @since 4.0
michael@0 38 */
michael@0 39 public interface RouteInfo {
michael@0 40
michael@0 41 /**
michael@0 42 * The tunnelling type of a route.
michael@0 43 * Plain routes are established by connecting to the target or
michael@0 44 * the first proxy.
michael@0 45 * Tunnelled routes are established by connecting to the first proxy
michael@0 46 * and tunnelling through all proxies to the target.
michael@0 47 * Routes without a proxy cannot be tunnelled.
michael@0 48 */
michael@0 49 public enum TunnelType { PLAIN, TUNNELLED }
michael@0 50
michael@0 51 /**
michael@0 52 * The layering type of a route.
michael@0 53 * Plain routes are established by connecting or tunnelling.
michael@0 54 * Layered routes are established by layering a protocol such as TLS/SSL
michael@0 55 * over an existing connection.
michael@0 56 * Protocols can only be layered over a tunnel to the target, or
michael@0 57 * or over a direct connection without proxies.
michael@0 58 * <br/>
michael@0 59 * Layering a protocol
michael@0 60 * over a direct connection makes little sense, since the connection
michael@0 61 * could be established with the new protocol in the first place.
michael@0 62 * But we don't want to exclude that use case.
michael@0 63 */
michael@0 64 public enum LayerType { PLAIN, LAYERED }
michael@0 65
michael@0 66 /**
michael@0 67 * Obtains the target host.
michael@0 68 *
michael@0 69 * @return the target host
michael@0 70 */
michael@0 71 HttpHost getTargetHost();
michael@0 72
michael@0 73 /**
michael@0 74 * Obtains the local address to connect from.
michael@0 75 *
michael@0 76 * @return the local address,
michael@0 77 * or <code>null</code>
michael@0 78 */
michael@0 79 InetAddress getLocalAddress();
michael@0 80
michael@0 81 /**
michael@0 82 * Obtains the number of hops in this route.
michael@0 83 * A direct route has one hop. A route through a proxy has two hops.
michael@0 84 * A route through a chain of <i>n</i> proxies has <i>n+1</i> hops.
michael@0 85 *
michael@0 86 * @return the number of hops in this route
michael@0 87 */
michael@0 88 int getHopCount();
michael@0 89
michael@0 90 /**
michael@0 91 * Obtains the target of a hop in this route.
michael@0 92 * The target of the last hop is the {@link #getTargetHost target host},
michael@0 93 * the target of previous hops is the respective proxy in the chain.
michael@0 94 * For a route through exactly one proxy, target of hop 0 is the proxy
michael@0 95 * and target of hop 1 is the target host.
michael@0 96 *
michael@0 97 * @param hop index of the hop for which to get the target,
michael@0 98 * 0 for first
michael@0 99 *
michael@0 100 * @return the target of the given hop
michael@0 101 *
michael@0 102 * @throws IllegalArgumentException
michael@0 103 * if the argument is negative or not less than
michael@0 104 * {@link #getHopCount getHopCount()}
michael@0 105 */
michael@0 106 HttpHost getHopTarget(int hop);
michael@0 107
michael@0 108 /**
michael@0 109 * Obtains the first proxy host.
michael@0 110 *
michael@0 111 * @return the first proxy in the proxy chain, or
michael@0 112 * <code>null</code> if this route is direct
michael@0 113 */
michael@0 114 HttpHost getProxyHost();
michael@0 115
michael@0 116 /**
michael@0 117 * Obtains the tunnel type of this route.
michael@0 118 * If there is a proxy chain, only end-to-end tunnels are considered.
michael@0 119 *
michael@0 120 * @return the tunnelling type
michael@0 121 */
michael@0 122 TunnelType getTunnelType();
michael@0 123
michael@0 124 /**
michael@0 125 * Checks whether this route is tunnelled through a proxy.
michael@0 126 * If there is a proxy chain, only end-to-end tunnels are considered.
michael@0 127 *
michael@0 128 * @return <code>true</code> if tunnelled end-to-end through at least
michael@0 129 * one proxy,
michael@0 130 * <code>false</code> otherwise
michael@0 131 */
michael@0 132 boolean isTunnelled();
michael@0 133
michael@0 134 /**
michael@0 135 * Obtains the layering type of this route.
michael@0 136 * In the presence of proxies, only layering over an end-to-end tunnel
michael@0 137 * is considered.
michael@0 138 *
michael@0 139 * @return the layering type
michael@0 140 */
michael@0 141 LayerType getLayerType();
michael@0 142
michael@0 143 /**
michael@0 144 * Checks whether this route includes a layered protocol.
michael@0 145 * In the presence of proxies, only layering over an end-to-end tunnel
michael@0 146 * is considered.
michael@0 147 *
michael@0 148 * @return <code>true</code> if layered,
michael@0 149 * <code>false</code> otherwise
michael@0 150 */
michael@0 151 boolean isLayered();
michael@0 152
michael@0 153 /**
michael@0 154 * Checks whether this route is secure.
michael@0 155 *
michael@0 156 * @return <code>true</code> if secure,
michael@0 157 * <code>false</code> otherwise
michael@0 158 */
michael@0 159 boolean isSecure();
michael@0 160
michael@0 161 }

mercurial