KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > agent > client > tunneling > DefaultTunnel


1 /*
2  * SSL-Explorer
3  *
4  * Copyright (C) 2003-2006 3SP LTD. All Rights Reserved
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */

19             
20 package com.sslexplorer.agent.client.tunneling;
21
22 import com.sslexplorer.agent.client.util.TunnelConfiguration;
23
24 /**
25  * Defaul implementation of a {@link TunnelConfiguration}.
26  *
27  * @author Lee David Painter <a HREF="mailto: lee@3sp.com">&lt;lee@3sp.com&gt;</a>
28  * @author Brett Smith <a HREF="mailto: brett@3sp.com">&lt;brett@3sp.com&gt;</a>
29  * @version $Revision: 1.3 $
30  */

31 public class DefaultTunnel implements TunnelConfiguration {
32     
33     // Private instance variables
34

35     private int id, type;
36     private String JavaDoc name;
37     private String JavaDoc transport;
38     private String JavaDoc sourceInterface;
39     private int sourcePort;
40     private int destinationPort;
41     private String JavaDoc destinationHost;
42     private boolean permanent;
43     private boolean temporarySingleConnect;
44     private String JavaDoc launchId;
45
46     /**
47      * Constructor
48      *
49      * @param id tunnel id
50      * @param type type
51      * @param transport transport
52      * @param sourceInterface source interface
53      * @param sourcePort source port
54      * @param destinationPort destination port
55      * @param destinationHost destination host
56      * @param permanent permanent
57      * @param name tunnel name
58      * @param launchId id of launch session
59      */

60     public DefaultTunnel(int id, int type, String JavaDoc transport, String JavaDoc sourceInterface, int sourcePort,
61                          int destinationPort, String JavaDoc destinationHost, boolean permanent,
62                          boolean temporarySingleConnect, String JavaDoc name,
63                          String JavaDoc launchId) {
64         this.id = id;
65         this.type = type;
66         this.transport = transport;
67         this.permanent = permanent;
68         this.sourceInterface = sourceInterface;
69         this.sourcePort = sourcePort;
70         this.destinationPort = destinationPort;
71         this.destinationHost = destinationHost;
72         this.temporarySingleConnect = temporarySingleConnect;
73         this.name = name;
74         this.launchId = launchId;
75     }
76
77     /*
78      * (non-Javadoc)
79      *
80      * @see com.sslexplorer.forwarding.Tunnel#getId()
81      */

82     public int getId() {
83         return id;
84     }
85
86     public String JavaDoc getName() {
87         return name;
88     }
89
90     /*
91      * (non-Javadoc)
92      *
93      * @see com.sslexplorer.forwarding.Tunnel#getType()
94      */

95     public int getType() {
96         return type;
97     }
98
99     /*
100      * (non-Javadoc)
101      *
102      * @see com.sslexplorer.forwarding.Tunnel#isPermanent()
103      */

104     public boolean isPermanent() {
105         return permanent;
106     }
107
108     /*
109      * (non-Javadoc)
110      *
111      * @see com.sslexplorer.forwarding.Tunnel#getTransport()
112      */

113     public String JavaDoc getTransport() {
114         return transport;
115     }
116     
117     /*
118      * (non-Javadoc)
119      *
120      * @see com.sslexplorer.forwarding.Tunnel#getSourcePort()
121      */

122     public int getSourcePort() {
123         return sourcePort;
124     }
125
126     
127     /*
128      * (non-Javadoc)
129      *
130      * @see com.sslexplorer.forwarding.Tunnel#getSourceInterface()
131      */

132     public String JavaDoc getSourceInterface() {
133         return sourceInterface;
134     }
135
136     /*
137      * (non-Javadoc)
138      *
139      * @see com.sslexplorer.forwarding.Tunnel#getDestinationPort()
140      */

141     public int getDestinationPort() {
142         return destinationPort;
143     }
144
145     /*
146      * (non-Javadoc)
147      *
148      * @see com.sslexplorer.forwarding.Tunnel#getDestinationHost()
149      */

150     public String JavaDoc getDestinationHost() {
151         return destinationHost;
152     }
153
154     /*
155      * (non-Javadoc)
156      *
157      * @see com.sslexplorer.vpn.base.Tunnel#isTemporarySingleConnect()
158      */

159     public boolean isTemporarySingleConnect() {
160         return temporarySingleConnect;
161     }
162
163     /**
164      * Set the destination hostname of the tunnel.
165      *
166      * @param destinationHost destination hostname of tunnel
167      */

168     public void setDestinationHost(String JavaDoc destinationHost) {
169         this.destinationHost = destinationHost;
170     }
171
172     /**
173      * Set the destination port of the tunnel
174      *
175      * @param destinationPort destination port of tunnel
176      */

177     public void setDestinationPort(int destinationPort) {
178         this.destinationPort = destinationPort;
179     }
180
181     /**
182      * Set the SSL-Explorer resource id of the tunnel.
183      *
184      * @param id resource Id
185      */

186     public void setId(int id) {
187         this.id = id;
188     }
189
190     /**
191      * Set the source port of the tunnel.
192      *
193      * @param sourcePort tunnel source port.
194      */

195     public void setSourcePort(int sourcePort) {
196         this.sourcePort = sourcePort;
197     }
198
199     /**
200      * Set the source interface of the tunnel.
201      *
202      * @param sourceInterface tunnel source interface.
203      */

204     public void setSourcePort(String JavaDoc sourceInterface) {
205         this.sourceInterface = sourceInterface;
206     }
207
208     /**
209      * Set the transport type of the tunnel. This may be one of {@link TunnelConfiguration#TCP_TUNNEL}
210      * or {@link TunnelConfiguration#UDP_TUNNEL}.
211      *
212      * @param transport The transport to set.
213      */

214     public void setTransport(String JavaDoc transport) {
215         this.transport = transport;
216     }
217
218     /**
219      * Set the tunnel type. This may be one of {@link TunnelConfiguration#LOCAL_TUNNEL} or
220      * {@link TunnelConfiguration#REMOTE_TUNNEL}.
221      *
222      * @param type tunnel type.
223      */

224     public void setType(int type) {
225         this.type = type;
226     }
227
228     /* (non-Javadoc)
229      * @see com.sslexplorer.agent.util.ListeningSocketConfiguration#getLaunchId()
230      */

231     public String JavaDoc getLaunchId() {
232         return launchId;
233     }
234 }
235
Popular Tags