comparison src/ch/ethz/ssh2/Connection.java @ 290:9ae4ed7bb523 ganymed

start conversion from trilead to ganymed
author Carl Byington <carl@five-ten-sg.com>
date Fri, 18 Jul 2014 20:34:21 -0700
parents d2ee20d9dff1
children beaccc9df37b
comparison
equal deleted inserted replaced
289:d2ee20d9dff1 290:9ae4ed7bb523
930 930
931 return new LocalStreamForwarder(cm, host_to_connect, port_to_connect); 931 return new LocalStreamForwarder(cm, host_to_connect, port_to_connect);
932 } 932 }
933 933
934 /** 934 /**
935 * Creates a new {@link DynamicPortForwarder}. A
936 * <code>DynamicPortForwarder</code> forwards TCP/IP connections that arrive
937 * at a local port via the secure tunnel to another host that is chosen via
938 * the SOCKS protocol.
939 * <p>
940 * This method must only be called after one has passed successfully the
941 * authentication step. There is no limit on the number of concurrent
942 * forwardings.
943 *
944 * @param local_port
945 * @return A {@link DynamicPortForwarder} object.
946 * @throws IOException
947 */
948
949 public synchronized DynamicPortForwarder createDynamicPortForwarder(int local_port) throws IOException {
950 if (tm == null)
951 throw new IllegalStateException("Cannot forward ports, you need to establish a connection first.");
952
953 if (!authenticated)
954 throw new IllegalStateException("Cannot forward ports, connection is not authenticated.");
955
956 return new DynamicPortForwarder(cm, local_port);
957 }
958
959 /**
960 * Creates a new {@link DynamicPortForwarder}. A
961 * <code>DynamicPortForwarder</code> forwards TCP/IP connections that arrive
962 * at a local port via the secure tunnel to another host that is chosen via
963 * the SOCKS protocol.
964 * <p>
965 * This method must only be called after one has passed successfully the
966 * authentication step. There is no limit on the number of concurrent
967 * forwardings.
968 *
969 * @param addr
970 * specifies the InetSocketAddress where the local socket shall
971 * be bound to.
972 * @return A {@link DynamicPortForwarder} object.
973 * @throws IOException
974 */
975
976 public synchronized DynamicPortForwarder createDynamicPortForwarder(InetSocketAddress addr) throws IOException {
977 if (tm == null)
978 throw new IllegalStateException("Cannot forward ports, you need to establish a connection first.");
979
980 if (!authenticated)
981 throw new IllegalStateException("Cannot forward ports, connection is not authenticated.");
982
983 return new DynamicPortForwarder(cm, addr);
984 }
985
986 /**
935 * Create a very basic {@link SCPClient} that can be used to copy 987 * Create a very basic {@link SCPClient} that can be used to copy
936 * files from/to the SSH-2 server. 988 * files from/to the SSH-2 server.
937 * <p/> 989 * <p/>
938 * Works only after one has passed successfully the authentication step. 990 * Works only after one has passed successfully the authentication step.
939 * There is no limit on the number of concurrent SCP clients. 991 * There is no limit on the number of concurrent SCP clients.