PageRenderTime 39ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/lib/src/org/apache/http/conn/routing/RouteInfo.java

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