1069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project/*
2069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * $HeadURL: http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/routing/RouteInfo.java $
3069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * $Revision: 652200 $
4069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * $Date: 2008-04-29 17:22:43 -0700 (Tue, 29 Apr 2008) $
5069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project *
6069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * ====================================================================
7069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * Licensed to the Apache Software Foundation (ASF) under one
8069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * or more contributor license agreements.  See the NOTICE file
9069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * distributed with this work for additional information
10069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * regarding copyright ownership.  The ASF licenses this file
11069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * to you under the Apache License, Version 2.0 (the
12069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * "License"); you may not use this file except in compliance
13069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * with the License.  You may obtain a copy of the License at
14069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project *
15069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project *   http://www.apache.org/licenses/LICENSE-2.0
16069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project *
17069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * Unless required by applicable law or agreed to in writing,
18069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * software distributed under the License is distributed on an
19069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
20069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * KIND, either express or implied.  See the License for the
21069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * specific language governing permissions and limitations
22069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * under the License.
23069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * ====================================================================
24069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project *
25069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * This software consists of voluntary contributions made by many
26069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * individuals on behalf of the Apache Software Foundation.  For more
27069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * information on the Apache Software Foundation, please see
28069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * <http://www.apache.org/>.
29069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project *
30069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project */
31069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project
32069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Projectpackage org.apache.http.conn.routing;
33069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project
34069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Projectimport java.net.InetAddress;
35069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project
36069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Projectimport org.apache.http.HttpHost;
37069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project
38069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project
39069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project/**
40069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * Read-only interface for route information.
41069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project *
42069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * @author <a href="mailto:rolandw at apache.org">Roland Weber</a>
43069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project *
44069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project *
45069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * <!-- empty lines to avoid svn diff problems -->
46069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * @version $Revision: 652200 $
47069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project *
48069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * @since 4.0
49d42abb2fd917184764daf22f5f299e848b8701d7Narayan Kamath *
50d42abb2fd917184764daf22f5f299e848b8701d7Narayan Kamath * @deprecated Please use {@link java.net.URL#openConnection} instead.
51d42abb2fd917184764daf22f5f299e848b8701d7Narayan Kamath *     Please visit <a href="http://android-developers.blogspot.com/2011/09/androids-http-clients.html">this webpage</a>
52d42abb2fd917184764daf22f5f299e848b8701d7Narayan Kamath *     for further details.
53069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project */
54d42abb2fd917184764daf22f5f299e848b8701d7Narayan Kamath@Deprecated
55069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Projectpublic interface RouteInfo {
56069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project
57069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project    /**
58069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * The tunnelling type of a route.
59069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * Plain routes are established by connecting to the target or
60069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * the first proxy.
61069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * Tunnelled routes are established by connecting to the first proxy
62069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * and tunnelling through all proxies to the target.
63069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * Routes without a proxy cannot be tunnelled.
64069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     */
65069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project    public enum TunnelType { PLAIN, TUNNELLED }
66069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project
67069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project    /**
68069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * The layering type of a route.
69069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * Plain routes are established by connecting or tunnelling.
70069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * Layered routes are established by layering a protocol such as TLS/SSL
71069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * over an existing connection.
72069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * Protocols can only be layered over a tunnel to the target, or
73069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * or over a direct connection without proxies.
74069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * <br/>
75069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * Layering a protocol
76069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * over a direct connection makes little sense, since the connection
77069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * could be established with the new protocol in the first place.
78069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * But we don't want to exclude that use case.
79069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     */
80069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project    public enum LayerType  { PLAIN, LAYERED }
81069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project
82069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project
83069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project
84069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project    /**
85069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * Obtains the target host.
86069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     *
87069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * @return the target host
88069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     */
89069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project    HttpHost getTargetHost()
90069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project        ;
91069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project
92069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project
93069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project    /**
94069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * Obtains the local address to connect from.
95069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     *
96069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * @return  the local address,
97069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     *          or <code>null</code>
98069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     */
99069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project    InetAddress getLocalAddress()
100069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project        ;
101069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project
102069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project
103069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project    /**
104069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * Obtains the number of hops in this route.
105069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * A direct route has one hop. A route through a proxy has two hops.
106069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * A route through a chain of <i>n</i> proxies has <i>n+1</i> hops.
107069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     *
108069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * @return  the number of hops in this route
109069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     */
110069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project    int getHopCount()
111069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project        ;
112069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project
113069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project
114069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project    /**
115069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * Obtains the target of a hop in this route.
116069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * The target of the last hop is the {@link #getTargetHost target host},
117069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * the target of previous hops is the respective proxy in the chain.
118069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * For a route through exactly one proxy, target of hop 0 is the proxy
119069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * and target of hop 1 is the target host.
120069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     *
121069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * @param hop       index of the hop for which to get the target,
122069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     *                  0 for first
123069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     *
124069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * @return  the target of the given hop
125069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     *
126069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * @throws IllegalArgumentException
127069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     *  if the argument is negative or not less than
128069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     *  {@link #getHopCount getHopCount()}
129069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     */
130069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project    HttpHost getHopTarget(int hop)
131069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project        ;
132069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project
133069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project
134069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project    /**
135069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * Obtains the first proxy host.
136069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     *
137069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * @return the first proxy in the proxy chain, or
138069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     *         <code>null</code> if this route is direct
139069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     */
140069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project    HttpHost getProxyHost()
141069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project        ;
142069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project
143069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project
144069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project    /**
145069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * Obtains the tunnel type of this route.
146069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * If there is a proxy chain, only end-to-end tunnels are considered.
147069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     *
148069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * @return  the tunnelling type
149069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     */
150069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project    TunnelType getTunnelType()
151069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project        ;
152069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project
153069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project
154069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project    /**
155069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * Checks whether this route is tunnelled through a proxy.
156069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * If there is a proxy chain, only end-to-end tunnels are considered.
157069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     *
158069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * @return  <code>true</code> if tunnelled end-to-end through at least
159069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     *          one proxy,
160069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     *          <code>false</code> otherwise
161069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     */
162069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project    boolean isTunnelled()
163069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project        ;
164069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project
165069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project
166069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project    /**
167069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * Obtains the layering type of this route.
168069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * In the presence of proxies, only layering over an end-to-end tunnel
169069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * is considered.
170069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     *
171069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * @return  the layering type
172069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     */
173069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project    LayerType getLayerType()
174069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project        ;
175069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project
176069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project
177069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project    /**
178069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * Checks whether this route includes a layered protocol.
179069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * In the presence of proxies, only layering over an end-to-end tunnel
180069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * is considered.
181069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     *
182069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * @return  <code>true</code> if layered,
183069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     *          <code>false</code> otherwise
184069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     */
185069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project    boolean isLayered()
186069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project        ;
187069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project
188069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project
189069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project    /**
190069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * Checks whether this route is secure.
191069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     *
192069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     * @return  <code>true</code> if secure,
193069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     *          <code>false</code> otherwise
194069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project     */
195069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project    boolean isSecure()
196069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project        ;
197069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project
198069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project
199069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project} // interface RouteInfo
200