1 | /******************************************************************************
|
---|
2 | *
|
---|
3 | * Copyright (c) 1998,99 by Mindbright Technology AB, Stockholm, Sweden.
|
---|
4 | * www.mindbright.se, [email protected]
|
---|
5 | *
|
---|
6 | * This program is free software; you can redistribute it and/or modify
|
---|
7 | * it under the terms of the GNU General Public License as published by
|
---|
8 | * the Free Software Foundation; either version 2 of the License, or
|
---|
9 | * (at your option) any later version.
|
---|
10 | *
|
---|
11 | * This program is distributed in the hope that it will be useful,
|
---|
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
14 | * GNU General Public License for more details.
|
---|
15 | *
|
---|
16 | *****************************************************************************
|
---|
17 | * $Author: mats $
|
---|
18 | * $Date: 1999/09/06 18:54:30 $
|
---|
19 | * $Name: rel1-2-1 $
|
---|
20 | *****************************************************************************/
|
---|
21 | package mindbright.ssh;
|
---|
22 |
|
---|
23 | import java.io.IOException;
|
---|
24 | import java.util.Hashtable;
|
---|
25 | import java.util.Enumeration;
|
---|
26 |
|
---|
27 | public class SSHProtocolPlugin {
|
---|
28 |
|
---|
29 | static Hashtable plugins = new Hashtable();
|
---|
30 |
|
---|
31 | static {
|
---|
32 | SSHProtocolPlugin.addPlugin("general", new SSHProtocolPlugin());
|
---|
33 | try {
|
---|
34 | SSHProtocolPlugin.addPlugin("ftp", new SSHFtpPlugin());
|
---|
35 | } catch (Throwable e) {
|
---|
36 | System.out.println("FTP plugin not found, disabled");
|
---|
37 | }
|
---|
38 | }
|
---|
39 |
|
---|
40 | public static SSHProtocolPlugin getPlugin(String name) {
|
---|
41 | SSHProtocolPlugin plugin = (SSHProtocolPlugin)plugins.get(name);
|
---|
42 | return (SSHProtocolPlugin)plugins.get(name);
|
---|
43 | }
|
---|
44 |
|
---|
45 | public static void addPlugin(String name, SSHProtocolPlugin plugin) {
|
---|
46 | plugins.put(name, plugin);
|
---|
47 | }
|
---|
48 |
|
---|
49 | public static void initiateAll(SSHClient client) {
|
---|
50 | SSHProtocolPlugin plugin;
|
---|
51 | Enumeration e = plugins.elements();
|
---|
52 | while(e.hasMoreElements()) {
|
---|
53 | plugin = (SSHProtocolPlugin)e.nextElement();
|
---|
54 | plugin.initiate(client);
|
---|
55 | }
|
---|
56 | }
|
---|
57 |
|
---|
58 | public void initiate(SSHClient client) {
|
---|
59 | }
|
---|
60 |
|
---|
61 | public SSHListenChannel localListener(String localHost, int localPort,
|
---|
62 | String remoteHost, int remotePort,
|
---|
63 | SSHChannelController controller) throws IOException {
|
---|
64 | return new SSHListenChannel(localHost, localPort, remoteHost, remotePort, controller);
|
---|
65 | }
|
---|
66 |
|
---|
67 | public void remoteListener(int remotePort, String localHost, int localPort,
|
---|
68 | SSHChannelController controller) {
|
---|
69 | }
|
---|
70 |
|
---|
71 | }
|
---|