Mercurial > hg > Applications > TreeVNC
annotate src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java @ 201:ced24de3f2c5
get network interfaces.
author | oc |
---|---|
date | Fri, 27 Jun 2014 18:50:49 +0900 |
parents | b038aafeb2b0 |
children | 22676ca0dd97 |
rev | line source |
---|---|
32 | 1 package jp.ac.u_ryukyu.treevnc; |
28 | 2 |
3 import java.io.IOException; | |
118
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
4 import java.net.BindException; |
201 | 5 import java.net.InetAddress; |
6 import java.net.InterfaceAddress; | |
7 import java.net.NetworkInterface; | |
118
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
8 import java.net.ServerSocket; |
28 | 9 import java.net.Socket; |
201 | 10 import java.net.SocketAddress; |
11 import java.net.SocketException; | |
174 | 12 import java.net.UnknownHostException; |
28 | 13 import java.nio.ByteBuffer; |
109 | 14 import java.nio.ByteOrder; |
201 | 15 import java.util.Enumeration; |
16 import java.util.HashMap; | |
28 | 17 import java.util.LinkedList; |
18 import java.util.concurrent.atomic.AtomicInteger; | |
118
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
19 import java.util.zip.DataFormatException; |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
20 import java.util.zip.Deflater; |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
21 import java.util.zip.Inflater; |
150 | 22 |
28 | 23 import jp.ac.u_ryukyu.treevnc.server.RequestScreenThread; |
174 | 24 import jp.ac.u_ryukyu.treevnc.server.TreeManagement; |
25 import jp.ac.u_ryukyu.treevnc.server.TreeRootFinderListener; | |
150 | 26 |
28 | 27 import com.glavsoft.exceptions.TransportException; |
107 | 28 import com.glavsoft.rfb.client.ClientToServerMessage; |
96 | 29 import com.glavsoft.rfb.encoding.EncodingType; |
28 | 30 import com.glavsoft.rfb.protocol.Protocol; |
31 import com.glavsoft.rfb.protocol.ProtocolContext; | |
32 import com.glavsoft.transport.Reader; | |
33 import com.glavsoft.transport.Writer; | |
153 | 34 import com.glavsoft.viewer.ViewerInterface; |
174 | 35 import com.glavsoft.viewer.swing.ConnectionParams; |
28 | 36 |
124 | 37 |
120 | 38 public abstract class MyRfbProto { |
33
9d3478d11d3b
Add the processing of client
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
39 final static int FramebufferUpdateRequest = 3; |
28 | 40 final static int CheckDelay = 11; |
103 | 41 protected final static int FramebufferUpdate = 0; |
153 | 42 protected ProtocolContext context; |
43 private int clients = 0; | |
98 | 44 public MulticastQueue<LinkedList<ByteBuffer>> multicastqueue = new MulticastQueue<LinkedList<ByteBuffer>>(); |
28 | 45 private RequestScreenThread rThread; |
118
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
46 public int acceptPort = 0; |
174 | 47 private String myAddress; |
94
75879c316796
synchronized wait for Rfb initialization in change server.
oc
parents:
89
diff
changeset
|
48 protected boolean readyReconnect = false; |
98 | 49 private boolean cuiVersion; |
107 | 50 private long counter = 0; // packet serial number |
118
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
51 public ServerSocket servSock; |
123 | 52 private boolean permitChangeScreen = true; |
118
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
53 private static final int INFLATE_BUFSIZE = 1024 * 100; |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
54 |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
55 private Inflater inflater = new Inflater(); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
56 private Deflater deflater = new Deflater(); |
174 | 57 ViewerInterface viewer; |
187 | 58 private short id; // my tree node id ( = 0 in root ) |
174 | 59 private boolean leader; |
179 | 60 public TreeManagement treeManager; |
174 | 61 private TreeVncCommandChannelListener acceptThread; |
177 | 62 private boolean firstTime = true; |
174 | 63 private TreeRootFinderListener getCast; |
176 | 64 private CreateConnectionParam cp; |
178
34b7558aeffa
remove TreeTask, StartTreeHandling
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
177
diff
changeset
|
65 private boolean hasViewer = false; |
186
f76ee760c2d2
dead lock on command line root
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
185
diff
changeset
|
66 private boolean reconnecting; |
187 | 67 private short reconnectingId; // Change Server Request to id's node VNC server |
201 | 68 private HashMap<NetworkInterface, TreeManagement> interfaces = new HashMap<NetworkInterface, TreeManagement>(); |
118
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
69 |
107 | 70 |
33
9d3478d11d3b
Add the processing of client
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
71 public MyRfbProto() { |
9d3478d11d3b
Add the processing of client
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
72 rThread = new RequestScreenThread(this); |
9d3478d11d3b
Add the processing of client
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
73 } |
107 | 74 |
120 | 75 abstract public boolean isRoot() ; |
28 | 76 |
164 | 77 public ProtocolContext getContext() { |
78 return context; | |
79 } | |
80 | |
130 | 81 /** |
82 * handle new client accept | |
83 * it also handle TreeVNC Command | |
84 * @param acceptThread | |
85 * @param newCli | |
86 * @param os | |
87 * @param is | |
88 * @throws IOException | |
89 * @throws TransportException | |
90 */ | |
157
7cea8789387b
thread base command listening loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
153
diff
changeset
|
91 public void newClient(final Socket newCli,final Writer os, final Reader is) { |
124 | 92 |
28 | 93 final int myId = clients; |
94 final MulticastQueue.Client<LinkedList<ByteBuffer>> c = multicastqueue.newClient(); | |
95 final AtomicInteger writerRunning = new AtomicInteger(); | |
96 writerRunning.set(1); | |
97 /** | |
98 * Timeout thread. If a client is suspended, it has top of queue | |
99 * indefinitely, which caused memory overflow. After the timeout, we | |
100 * poll the queue and discard it. Start long wait if writer is running. | |
101 */ | |
102 final Runnable timer = new Runnable() { | |
103 public void run() { | |
104 int count = 0; | |
105 for (;;) { | |
106 long timeout = 50000 / 8; | |
107 try { | |
108 synchronized (this) { | |
109 int state, flag; | |
110 writerRunning.set(0); | |
111 wait(timeout); | |
112 flag = 0; | |
113 while ((state = writerRunning.get()) == 0) { | |
114 c.poll(); // discard, should be timeout | |
115 count++; | |
116 if (flag == 0) { | |
117 System.out.println("Discarding " + myId | |
118 + " count=" + count); | |
119 flag = 1; | |
120 } | |
121 wait(10); // if this is too short, writer cannot | |
122 // take the poll, if this is too | |
123 // long, memory will overflow... | |
124 } | |
125 if (flag == 1) | |
126 System.out.println("Resuming " + myId | |
127 + " count=" + count); | |
128 if (state != 1) { | |
129 System.out.println("Client died " + myId); | |
130 break; | |
131 } | |
132 } | |
133 } catch (InterruptedException e) { | |
134 } | |
135 } | |
136 } | |
137 }; | |
88 | 138 new Thread(timer, "timer-discard-multicastqueue").start(); |
28 | 139 /** |
135
ada4d850a820
lostParent and notFoundParenet
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
134
diff
changeset
|
140 * handle command from lower node |
28 | 141 */ |
142 final Runnable reader = new Runnable() { | |
135
ada4d850a820
lostParent and notFoundParenet
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
134
diff
changeset
|
143 |
122
e2416a246c95
noScreenChange flag on command line ( should be on panel also )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
120
diff
changeset
|
144 public void run() { |
28 | 145 for (;;) { |
146 try { | |
113
bce2ef0a2e79
use ProtocolContext.sendMessage for upward command
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
112
diff
changeset
|
147 final byte b[] = new byte[4096]; |
bce2ef0a2e79
use ProtocolContext.sendMessage for upward command
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
112
diff
changeset
|
148 final int c = is.readByte(b); |
28 | 149 if (c <= 0) |
150 throw new IOException(); | |
107 | 151 if (isRoot()) { |
152 if (b[0] == ClientToServerMessage.SERVER_CHANGE_REQUEST) { | |
153 if (permitChangeScreen()) { | |
109 | 154 ByteBuffer buf = ByteBuffer.wrap(b); |
155 buf.order(ByteOrder.BIG_ENDIAN); | |
170 | 156 short id = buf.getShort(2); |
109 | 157 int length = buf.getInt(4); |
107 | 158 if (length == 0) |
159 continue; | |
160 String newHostName = new String(b, 8, length); | |
111 | 161 System.out.println("Root server change request :" + newHostName); |
107 | 162 // please remove these numbers. |
163 if (viewer != null) { | |
177 | 164 changeVNCServer(viewer, newHostName, 3200, 1980, id); |
107 | 165 } |
166 } else { | |
167 continue; | |
168 } | |
169 } | |
110 | 170 } else if (b[0] == ClientToServerMessage.SERVER_CHANGE_REQUEST) { |
113
bce2ef0a2e79
use ProtocolContext.sendMessage for upward command
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
112
diff
changeset
|
171 ClientToServerMessage sc = new ClientToServerMessage() { |
bce2ef0a2e79
use ProtocolContext.sendMessage for upward command
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
112
diff
changeset
|
172 @Override |
bce2ef0a2e79
use ProtocolContext.sendMessage for upward command
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
112
diff
changeset
|
173 public void send(Writer writer) |
bce2ef0a2e79
use ProtocolContext.sendMessage for upward command
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
112
diff
changeset
|
174 throws TransportException { |
bce2ef0a2e79
use ProtocolContext.sendMessage for upward command
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
112
diff
changeset
|
175 writer.write(b,0,c); |
bce2ef0a2e79
use ProtocolContext.sendMessage for upward command
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
112
diff
changeset
|
176 } |
bce2ef0a2e79
use ProtocolContext.sendMessage for upward command
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
112
diff
changeset
|
177 }; |
bce2ef0a2e79
use ProtocolContext.sendMessage for upward command
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
112
diff
changeset
|
178 context.sendMessage(sc); |
107 | 179 } |
28 | 180 // System.out.println("client read "+c); |
89 | 181 } catch (Exception e) { |
28 | 182 try { |
183 writerRunning.set(2); | |
184 os.close(); | |
185 is.close(); | |
36 | 186 break; |
28 | 187 } catch (IOException e1) { |
188 } catch (TransportException e1) { | |
189 e1.printStackTrace(); | |
190 } | |
191 return; | |
192 } | |
193 } | |
194 } | |
107 | 195 |
28 | 196 }; |
197 /** | |
135
ada4d850a820
lostParent and notFoundParenet
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
134
diff
changeset
|
198 * send packets to a client (one thread for each client ) |
28 | 199 */ |
200 Runnable sender = new Runnable() { | |
201 public void run() { | |
202 writerRunning.set(1); | |
203 try { | |
204 requestThreadNotify(); | |
205 | |
88 | 206 // after this, we discard upward packet. |
131
95f53663295c
lost host and parent not found
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
130
diff
changeset
|
207 new Thread(reader, "upward-packet-processing").start(); |
135
ada4d850a820
lostParent and notFoundParenet
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
134
diff
changeset
|
208 |
28 | 209 for (;;) { |
210 LinkedList<ByteBuffer> bufs = c.poll(); | |
211 int inputIndex = 0; | |
212 ByteBuffer header = bufs.get(inputIndex); | |
213 if (header == null) | |
214 continue; | |
215 else if (header.get(0) == CheckDelay) { | |
216 writeToClient(os, bufs, inputIndex); | |
217 continue; | |
218 } else if (header.get(0) == FramebufferUpdate) { | |
63 | 219 //System.out.println("client "+ myId); |
28 | 220 } |
221 /* | |
222 * if(i%20==0){ sendDataCheckDelay(); } i++; | |
223 */ | |
224 writeToClient(os, bufs, inputIndex); | |
225 writerRunning.set(1); // yes my client is awaking. | |
226 } | |
89 | 227 } catch (Exception e) { |
28 | 228 try { |
229 writerRunning.set(2); | |
230 os.close(); | |
231 } catch (IOException e1) { | |
160 | 232 System.out.println("root writer close faild :" + e1); |
28 | 233 } |
160 | 234 System.out.println("root writer faild :" + e); |
28 | 235 /* if socket closed cliList.remove(newCli); */ |
236 } | |
237 } | |
238 | |
239 public void writeToClient(final Writer os, | |
240 LinkedList<ByteBuffer> bufs, int inputIndex) | |
241 throws TransportException { | |
242 while (inputIndex < bufs.size()) { | |
243 ByteBuffer b = bufs.get(inputIndex++); | |
244 os.write(b.array(), b.position(), b.limit()); | |
245 } | |
246 os.flush(); | |
74 | 247 bufs = null; |
248 multicastqueue.heapAvailable(); | |
28 | 249 } |
250 }; | |
251 clients++; | |
88 | 252 new Thread(sender, "writer-to-lower-node").start(); |
28 | 253 |
254 } | |
157
7cea8789387b
thread base command listening loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
153
diff
changeset
|
255 |
28 | 256 |
122
e2416a246c95
noScreenChange flag on command line ( should be on panel also )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
120
diff
changeset
|
257 |
e2416a246c95
noScreenChange flag on command line ( should be on panel also )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
120
diff
changeset
|
258 public boolean permitChangeScreen() { |
e2416a246c95
noScreenChange flag on command line ( should be on panel also )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
120
diff
changeset
|
259 return permitChangeScreen; |
e2416a246c95
noScreenChange flag on command line ( should be on panel also )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
120
diff
changeset
|
260 } |
e2416a246c95
noScreenChange flag on command line ( should be on panel also )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
120
diff
changeset
|
261 |
e2416a246c95
noScreenChange flag on command line ( should be on panel also )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
120
diff
changeset
|
262 |
e2416a246c95
noScreenChange flag on command line ( should be on panel also )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
120
diff
changeset
|
263 public void setPermitChangeScreen(boolean v) { |
e2416a246c95
noScreenChange flag on command line ( should be on panel also )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
120
diff
changeset
|
264 permitChangeScreen = v; |
e2416a246c95
noScreenChange flag on command line ( should be on panel also )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
120
diff
changeset
|
265 } |
e2416a246c95
noScreenChange flag on command line ( should be on panel also )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
120
diff
changeset
|
266 |
88 | 267 public void requestThreadNotify() { |
28 | 268 rThread.reStart(); |
269 } | |
270 | |
271 | |
272 public void setProtocolContext(Protocol workingProtocol) { | |
273 context = workingProtocol; | |
274 } | |
29 | 275 |
134
128cce60c43c
where to connect command
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
133
diff
changeset
|
276 public Socket accept() throws IOException { |
128cce60c43c
where to connect command
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
133
diff
changeset
|
277 return servSock.accept(); |
128cce60c43c
where to connect command
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
133
diff
changeset
|
278 } |
31 | 279 |
118
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
280 public int selectPort(int p) { |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
281 int port = p; |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
282 while (true) { |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
283 try { |
134
128cce60c43c
where to connect command
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
133
diff
changeset
|
284 servSock = new ServerSocket(port); |
128cce60c43c
where to connect command
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
133
diff
changeset
|
285 acceptPort = port; |
181 | 286 myAddress = "127.0.0.1"; |
201 | 287 getNetworkInterfaces(); |
118
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
288 break; |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
289 } catch (BindException e) { |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
290 port++; |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
291 continue; |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
292 } catch (IOException e) { |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
293 |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
294 } |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
295 } |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
296 System.out.println("accept port = " + port); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
297 return port; |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
298 } |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
299 |
33
9d3478d11d3b
Add the processing of client
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
300 |
9d3478d11d3b
Add the processing of client
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
301 |
9d3478d11d3b
Add the processing of client
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
302 public void writeFramebufferUpdateRequest(int x, int y, int w, int h, |
9d3478d11d3b
Add the processing of client
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
303 boolean incremental) throws TransportException { |
9d3478d11d3b
Add the processing of client
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
304 byte[] b = new byte[10]; |
9d3478d11d3b
Add the processing of client
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
305 |
9d3478d11d3b
Add the processing of client
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
306 b[0] = (byte) FramebufferUpdateRequest; // 3 is FrameBufferUpdateRequest |
9d3478d11d3b
Add the processing of client
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
307 b[1] = (byte) (incremental ? 1 : 0); |
9d3478d11d3b
Add the processing of client
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
308 b[2] = (byte) ((x >> 8) & 0xff); |
9d3478d11d3b
Add the processing of client
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
309 b[3] = (byte) (x & 0xff); |
9d3478d11d3b
Add the processing of client
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
310 b[4] = (byte) ((y >> 8) & 0xff); |
9d3478d11d3b
Add the processing of client
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
311 b[5] = (byte) (y & 0xff); |
9d3478d11d3b
Add the processing of client
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
312 b[6] = (byte) ((w >> 8) & 0xff); |
9d3478d11d3b
Add the processing of client
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
313 b[7] = (byte) (w & 0xff); |
9d3478d11d3b
Add the processing of client
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
314 b[8] = (byte) ((h >> 8) & 0xff); |
9d3478d11d3b
Add the processing of client
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
32
diff
changeset
|
315 b[9] = (byte) (h & 0xff); |
35 | 316 } |
317 | |
153 | 318 public void setViewer(ViewerInterface v) { |
174 | 319 viewer = v; |
36 | 320 } |
321 | |
153 | 322 public ViewerInterface getViewer() { |
174 | 323 return viewer; |
65 | 324 } |
43 | 325 |
326 public void setTerminationType(boolean setType) { | |
327 /*nop*/ | |
328 } | |
329 | |
330 public boolean getTerminationType() { | |
331 /*nop*/ | |
332 return true; | |
333 } | |
45 | 334 |
134
128cce60c43c
where to connect command
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
133
diff
changeset
|
335 public void close() { |
102
1f7ee648e1f6
inflator in MyRfbProtoProxy should be renew to accept new VNC server socket.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
336 // none |
52 | 337 } |
45 | 338 |
60 | 339 public int getAcceptPort() { |
118
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
340 return acceptPort; |
60 | 341 } |
342 | |
61
d9cf08c6415c
During implementation change screen.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
60
diff
changeset
|
343 public boolean getReadyReconnect() { |
d9cf08c6415c
During implementation change screen.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
60
diff
changeset
|
344 return readyReconnect; |
d9cf08c6415c
During implementation change screen.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
60
diff
changeset
|
345 } |
65 | 346 |
347 | |
348 public boolean getCuiVersion() { | |
349 return cuiVersion; | |
61
d9cf08c6415c
During implementation change screen.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
60
diff
changeset
|
350 } |
65 | 351 |
352 public void setCuiVersion(boolean flag) { | |
353 cuiVersion = flag; | |
354 } | |
66 | 355 |
356 public void readCheckDelay(Reader reader) throws TransportException { | |
357 | |
358 } | |
134
128cce60c43c
where to connect command
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
133
diff
changeset
|
359 |
187 | 360 public synchronized void setReadyReconnect(boolean ready) { |
191 | 361 if (ready && reconnecting) { |
187 | 362 sendDesktopSizeChange(reconnectingId); |
186
f76ee760c2d2
dead lock on command line root
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
185
diff
changeset
|
363 reconnecting = false; |
192 | 364 if (reconnectingId == 0) { |
365 viewer.setVisible(false); | |
366 } | |
187 | 367 } |
368 if (reconnectingId!=0) { | |
186
f76ee760c2d2
dead lock on command line root
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
185
diff
changeset
|
369 readyReconnect = ready; |
f76ee760c2d2
dead lock on command line root
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
185
diff
changeset
|
370 if (ready) { |
f76ee760c2d2
dead lock on command line root
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
185
diff
changeset
|
371 notifyAll(); |
f76ee760c2d2
dead lock on command line root
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
185
diff
changeset
|
372 } |
f76ee760c2d2
dead lock on command line root
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
185
diff
changeset
|
373 } |
94
75879c316796
synchronized wait for Rfb initialization in change server.
oc
parents:
89
diff
changeset
|
374 } |
75879c316796
synchronized wait for Rfb initialization in change server.
oc
parents:
89
diff
changeset
|
375 |
186
f76ee760c2d2
dead lock on command line root
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
185
diff
changeset
|
376 public synchronized void waitForReady() throws InterruptedException { |
187 | 377 if (reconnectingId!=0) { |
378 while (!readyReconnect) { | |
379 wait(); | |
380 } | |
381 } | |
94
75879c316796
synchronized wait for Rfb initialization in change server.
oc
parents:
89
diff
changeset
|
382 } |
96 | 383 |
384 | |
170 | 385 public void sendDesktopSizeChange(short id) { |
96 | 386 LinkedList<ByteBuffer> desktopSize = new LinkedList<ByteBuffer>(); |
97 | 387 int width = context.getFbWidth(); |
388 int height = context.getFbHeight(); | |
169 | 389 desktopSize.add(new UpdateRectangleMessage(width, height, EncodingType.INIT_DATA, context.getInitData(),id).getMessage()); |
99 | 390 addSerialNumber(desktopSize); |
96 | 391 multicastqueue.put(desktopSize); |
392 } | |
98 | 393 |
394 | |
395 public void addSerialNumber(LinkedList<ByteBuffer> bufs) { | |
396 ByteBuffer serialNum = multicastqueue.allocate(8); | |
397 serialNum.putLong(counter++); | |
398 serialNum.flip(); | |
399 bufs.addFirst(serialNum); | |
400 } | |
102
1f7ee648e1f6
inflator in MyRfbProtoProxy should be renew to accept new VNC server socket.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
401 |
1f7ee648e1f6
inflator in MyRfbProtoProxy should be renew to accept new VNC server socket.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
402 |
1f7ee648e1f6
inflator in MyRfbProtoProxy should be renew to accept new VNC server socket.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
403 public void resetDecoder() { |
1f7ee648e1f6
inflator in MyRfbProtoProxy should be renew to accept new VNC server socket.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
404 context.resetDecoder(); |
1f7ee648e1f6
inflator in MyRfbProtoProxy should be renew to accept new VNC server socket.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
405 } |
1f7ee648e1f6
inflator in MyRfbProtoProxy should be renew to accept new VNC server socket.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
406 |
1f7ee648e1f6
inflator in MyRfbProtoProxy should be renew to accept new VNC server socket.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
407 public void stopReceiverTask() { |
1f7ee648e1f6
inflator in MyRfbProtoProxy should be renew to accept new VNC server socket.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
408 if (context!=null) |
1f7ee648e1f6
inflator in MyRfbProtoProxy should be renew to accept new VNC server socket.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
409 context.cleanUpSession(null); |
118
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
410 // cleanup zlib decoder for new VNCServer |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
411 if (isRoot()) |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
412 inflater = new Inflater(); |
102
1f7ee648e1f6
inflator in MyRfbProtoProxy should be renew to accept new VNC server socket.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
413 } |
113
bce2ef0a2e79
use ProtocolContext.sendMessage for upward command
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
112
diff
changeset
|
414 |
bce2ef0a2e79
use ProtocolContext.sendMessage for upward command
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
112
diff
changeset
|
415 public String getMyAddress() { |
174 | 416 return myAddress; |
113
bce2ef0a2e79
use ProtocolContext.sendMessage for upward command
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
112
diff
changeset
|
417 } |
118
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
418 |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
419 /** |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
420 * gzip byte arrays |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
421 * |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
422 * @param deflater |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
423 * @param inputs |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
424 * byte data[] |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
425 * @param inputIndex |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
426 * @param outputs |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
427 * byte data[] |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
428 * @return byte length in last byte array |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
429 * @throws IOException |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
430 */ |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
431 public int zip(Deflater deflater, LinkedList<ByteBuffer> inputs, |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
432 int inputIndex, LinkedList<ByteBuffer> outputs) throws IOException { |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
433 int len = 0; |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
434 ByteBuffer c1 = multicastqueue.allocate(INFLATE_BUFSIZE); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
435 while (inputIndex < inputs.size()) { |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
436 ByteBuffer b1 = inputs.get(inputIndex++); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
437 deflater.setInput(b1.array(), b1.position(), b1.remaining()); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
438 /** |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
439 * If we finish() stream and reset() it, Deflater start new gzip |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
440 * stream, this makes continuous zlib reader unhappy. if we remove |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
441 * finish(), Deflater.deflate() never flushes its output. The |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
442 * original zlib deflate has flush flag. I'm pretty sure this a kind |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
443 * of bug of Java library. |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
444 */ |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
445 if (inputIndex == inputs.size()) |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
446 deflater.finish(); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
447 int len1 = 0; |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
448 do { |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
449 len1 = deflater.deflate(c1.array(), c1.position(), |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
450 c1.remaining()); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
451 if (len1 > 0) { |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
452 len += len1; |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
453 c1.position(c1.position() + len1); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
454 if (c1.remaining() == 0) { |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
455 c1.flip(); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
456 outputs.addLast(c1); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
457 c1 = multicastqueue.allocate(INFLATE_BUFSIZE); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
458 } |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
459 } |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
460 } while (len1 > 0 || !deflater.needsInput()); // &&!deflater.finished()); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
461 } |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
462 if (c1.position() != 0) { |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
463 c1.flip(); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
464 outputs.addLast(c1); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
465 } |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
466 deflater.reset(); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
467 return len; |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
468 } |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
469 |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
470 /** |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
471 * gunzip byte arrays |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
472 * |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
473 * @param inflater |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
474 * @param inputs |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
475 * byte data[] |
182 | 476 * @param bytes |
118
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
477 * byte data[] |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
478 * @return number of total bytes |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
479 * @throws IOException |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
480 */ |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
481 public int unzip(Inflater inflater, LinkedList<ByteBuffer> inputs, |
182 | 482 int inputIndex, byte[] bytes, int bufSize) |
118
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
483 throws DataFormatException { |
182 | 484 int position = 0; |
485 int limit = bytes.length; | |
118
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
486 while (inputIndex < inputs.size()) { |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
487 ByteBuffer input = inputs.get(inputIndex++); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
488 inflater.setInput(input.array(), input.position(), input.limit()); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
489 // if (inputIndex==inputs.size()) if inflater/deflater has symmetry, |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
490 // we need this |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
491 // inflater.end(); but this won't work |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
492 do { |
182 | 493 int len0 = inflater.inflate(bytes, position, |
494 limit-position); | |
118
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
495 if (len0 > 0) { |
182 | 496 position += len0; |
497 if (position > limit) { | |
498 throw new DataFormatException(); | |
118
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
499 } |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
500 } |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
501 } while (!inflater.needsInput()); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
502 } |
182 | 503 return position; |
118
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
504 } |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
505 |
135
ada4d850a820
lostParent and notFoundParenet
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
134
diff
changeset
|
506 /** |
ada4d850a820
lostParent and notFoundParenet
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
134
diff
changeset
|
507 * read FrameBuffferUpdate. If it is ZLE, make it ZLEE which is self contained compressed packet. |
ada4d850a820
lostParent and notFoundParenet
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
134
diff
changeset
|
508 * put the packet to the multicastqueue. Then normal rendering engine read the same stream using is.reset(). |
ada4d850a820
lostParent and notFoundParenet
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
134
diff
changeset
|
509 * @param dataLen |
ada4d850a820
lostParent and notFoundParenet
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
134
diff
changeset
|
510 * @param reader |
ada4d850a820
lostParent and notFoundParenet
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
134
diff
changeset
|
511 * @throws TransportException |
ada4d850a820
lostParent and notFoundParenet
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
134
diff
changeset
|
512 */ |
182 | 513 public void readSendData(int dataLen, Reader reader, byte[] bytes) |
118
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
514 throws TransportException { |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
515 LinkedList<ByteBuffer> bufs = new LinkedList<ByteBuffer>(); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
516 ByteBuffer header = multicastqueue.allocate(16); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
517 ByteBuffer serial = multicastqueue.allocate(8); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
518 if (!isRoot()) { |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
519 reader.readBytes(serial.array(),0,8); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
520 serial.limit(8); |
182 | 521 } |
185 | 522 reader.mark(dataLen); |
118
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
523 reader.readBytes(header.array(), 0, 16); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
524 header.limit(16); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
525 if (header.get(0) == FramebufferUpdate) { |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
526 int encoding = header.getInt(12); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
527 if (encoding == EncodingType.ZRLE.getId() |
186
f76ee760c2d2
dead lock on command line root
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
185
diff
changeset
|
528 || encoding == EncodingType.ZLIB.getId()) { |
f76ee760c2d2
dead lock on command line root
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
185
diff
changeset
|
529 // recompress into ZREE |
f76ee760c2d2
dead lock on command line root
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
185
diff
changeset
|
530 // uncompressed result is remain in bytes |
118
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
531 ByteBuffer len = multicastqueue.allocate(4); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
532 reader.readBytes(len.array(), 0, 4); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
533 len.limit(4); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
534 ByteBuffer inputData = multicastqueue.allocate(dataLen - 20); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
535 reader.readBytes(inputData.array(), 0, inputData.capacity()); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
536 inputData.limit(dataLen - 20); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
537 LinkedList<ByteBuffer> inputs = new LinkedList<ByteBuffer>(); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
538 inputs.add(inputData); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
539 |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
540 header.putInt(12, EncodingType.ZRLEE.getId()); // means |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
541 // recompress |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
542 // every time |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
543 // using new Deflecter every time is incompatible with the |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
544 // protocol, clients have to be modified. |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
545 Deflater nDeflater = deflater; // new Deflater(); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
546 LinkedList<ByteBuffer> out = new LinkedList<ByteBuffer>(); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
547 try { |
182 | 548 unzip(inflater, inputs, 0, bytes, INFLATE_BUFSIZE); |
118
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
549 // dump32(inputs); |
182 | 550 out.add(ByteBuffer.wrap(bytes)); |
118
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
551 int len2 = zip(nDeflater, out, 0, bufs); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
552 ByteBuffer blen = multicastqueue.allocate(4); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
553 blen.putInt(len2); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
554 blen.flip(); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
555 bufs.addFirst(blen); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
556 bufs.addFirst(header); |
146 | 557 addSerialNumber(bufs); |
118
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
558 multicastqueue.put(bufs); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
559 } catch (DataFormatException e) { |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
560 throw new TransportException(e); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
561 } catch (IOException e) { |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
562 throw new TransportException(e); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
563 } |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
564 return; |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
565 } |
186
f76ee760c2d2
dead lock on command line root
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
185
diff
changeset
|
566 // ZRLEE is already compressed |
118
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
567 bufs.add(header); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
568 if (dataLen > 16) { |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
569 ByteBuffer b = multicastqueue.allocate(dataLen - 16); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
570 reader.readBytes(b.array(), 0, dataLen - 16); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
571 b.limit(dataLen - 16); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
572 bufs.add(b); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
573 } |
120 | 574 this.addSerialNumber(bufs); |
118
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
575 multicastqueue.put(bufs); |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
576 return; |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
577 } |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
578 // It may be compressed. We can inflate here to avoid repeating clients |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
579 // decompressing here, |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
580 // but it may generate too many large data. It is better to do it in |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
581 // each client. |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
582 // But we have do inflation for all input data, so we have to do it |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
583 // here. |
38e461e9b9c9
remove duplicated code in MyRfbProto*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
113
diff
changeset
|
584 } |
124 | 585 |
145
649794dfb9d5
add my hostname to handle multiple network
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
144
diff
changeset
|
586 public abstract void addHostToSelectionPanel(int port, String hostname,String myHostName) ; |
143 | 587 |
144 | 588 public void createRootSelectionPanel(CreateConnectionParam createConnectionParam) { |
143 | 589 |
590 } | |
591 | |
169 | 592 public void setId(short id) { |
593 this.id = id; | |
594 } | |
595 | |
596 public short getId() { | |
597 return id; | |
598 } | |
599 | |
174 | 600 public void setMyAddress(String myHostName) { |
601 this.myAddress = myHostName; | |
602 | |
603 } | |
604 | |
605 public void setLeader(boolean leader) { | |
606 this.leader = leader; | |
607 } | |
608 | |
609 public boolean isLeader() { | |
610 return leader; | |
611 } | |
612 | |
613 public void setTreeManager(TreeManagement clients) { | |
614 treeManager = clients; | |
615 } | |
616 | |
188 | 617 public TreeManagement getTreeManager() { |
174 | 618 return treeManager; |
619 } | |
620 | |
621 /** | |
622 * chnageVNCServer is called when host change. | |
623 * | |
624 * @param vncProxyService | |
625 * @param hostName | |
626 * HostAddress | |
627 * @param width | |
628 * FrameWidth | |
629 * @param height | |
630 * FrameHeight | |
631 * @param id | |
632 * @throws InterruptedException | |
633 */ | |
634 public void changeVNCServer(ViewerInterface vncProxyService, String hostName, int width, int height, short id) | |
635 throws UnknownHostException, IOException, InterruptedException { | |
636 // stop reader stop | |
637 stopReceiverTask(); | |
192 | 638 reconnectingId = id; |
174 | 639 vncProxyService.inhelitClients(vncProxyService, hostName); |
187 | 640 // after connecting VNC server, rfb send SEND_INIT_DATA command and wakes me up if necessary |
186
f76ee760c2d2
dead lock on command line root
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
185
diff
changeset
|
641 reconnecting = true; |
187 | 642 if (reconnectingId!=0) { |
643 waitForReady(); | |
644 } | |
174 | 645 } |
646 | |
647 /** | |
648 * start accepting children | |
649 * run rootFinderListener if necessary | |
650 */ | |
176 | 651 public void createConnectionAndStart(ViewerInterface v) { |
174 | 652 selectPort(ConnectionParams.DEFAULT_VNC_ROOT); |
653 if (treeManager!=null) { | |
654 treeManager.getList().getFirst().setPort(getAcceptPort()); | |
655 } | |
176 | 656 startTreeVncCommandListener(); |
657 if(isRoot() && firstTime) { | |
658 getCast = new TreeRootFinderListener(v); | |
659 Thread thread = new Thread(getCast, "tree-root-find-listener"); | |
174 | 660 thread.start(); |
661 firstTime = false; | |
662 } | |
663 } | |
664 | |
176 | 665 public void startTreeVncCommandListener() { |
666 acceptThread = new TreeVncCommandChannelListener(this, getAcceptPort()); | |
667 Thread thread = new Thread(acceptThread, "TreeVNC-accept"); | |
668 thread.start(); | |
669 } | |
670 | |
174 | 671 public TreeVncCommandChannelListener getAcceptThread() { |
672 return acceptThread; | |
673 } | |
674 | |
176 | 675 public void setConnectionParam(CreateConnectionParam createConnectionParam) { |
676 cp = createConnectionParam; | |
677 } | |
678 | |
679 public CreateConnectionParam getConnectionParam() { | |
680 return cp; | |
681 } | |
682 | |
178
34b7558aeffa
remove TreeTask, StartTreeHandling
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
177
diff
changeset
|
683 public boolean hasViewer() { |
34b7558aeffa
remove TreeTask, StartTreeHandling
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
177
diff
changeset
|
684 return hasViewer; |
34b7558aeffa
remove TreeTask, StartTreeHandling
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
177
diff
changeset
|
685 } |
34b7558aeffa
remove TreeTask, StartTreeHandling
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
177
diff
changeset
|
686 |
34b7558aeffa
remove TreeTask, StartTreeHandling
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
177
diff
changeset
|
687 public void setHasViewer(boolean b) { |
34b7558aeffa
remove TreeTask, StartTreeHandling
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
177
diff
changeset
|
688 hasViewer = b; |
34b7558aeffa
remove TreeTask, StartTreeHandling
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
177
diff
changeset
|
689 } |
34b7558aeffa
remove TreeTask, StartTreeHandling
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
177
diff
changeset
|
690 |
186
f76ee760c2d2
dead lock on command line root
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
185
diff
changeset
|
691 public void setReconnecting(boolean b) { |
f76ee760c2d2
dead lock on command line root
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
185
diff
changeset
|
692 reconnecting = b; |
f76ee760c2d2
dead lock on command line root
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
185
diff
changeset
|
693 } |
f76ee760c2d2
dead lock on command line root
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
185
diff
changeset
|
694 |
194 | 695 public int getReconnectingId() { |
696 return reconnectingId; | |
697 } | |
698 | |
201 | 699 public void getNetworkInterfaces() throws SocketException { |
700 for (Enumeration<NetworkInterface> e = NetworkInterface.getNetworkInterfaces(); e.hasMoreElements();) { | |
701 NetworkInterface ni; | |
702 ni = e.nextElement(); | |
703 if (ni.isUp() && ni.supportsMulticast() && !ni.isLoopback()) { | |
704 addNetworkInterface(ni, null); | |
705 System.out.println("Interfaces :" + ni.getName()); | |
706 } | |
707 } | |
708 } | |
709 | |
710 private void addNetworkInterface(NetworkInterface ni, TreeManagement treeManager) { | |
711 interfaces.put(ni, treeManager); | |
712 } | |
713 | |
164 | 714 |
28 | 715 } |