FreeRDP
Loading...
Searching...
No Matches
com.freerdp.freerdpcore.services.LibFreeRDP Class Reference

Data Structures

interface  EventListener
 
interface  UIEventListener
 

Static Public Member Functions

static boolean hasH264Support ()
 
static void setEventListener (EventListener l)
 
static long newInstance (Context context)
 
static void freeInstance (long inst)
 
static boolean connect (long inst)
 
static boolean disconnect (long inst)
 
static boolean cancelConnection (long inst)
 
static boolean setConnectionInfo (Context context, long inst, BookmarkBase bookmark)
 
static boolean setConnectionInfo (Context context, long inst, Uri openUri)
 
static boolean updateGraphics (long inst, Bitmap bitmap, int x, int y, int width, int height)
 
static boolean sendCursorEvent (long inst, int x, int y, int flags)
 
static boolean sendKeyEvent (long inst, int keycode, boolean down)
 
static boolean sendUnicodeKeyEvent (long inst, int keycode, boolean down)
 
static boolean sendClipboardData (long inst, String data)
 
static String getVersion ()
 

Static Public Attributes

static final long VERIFY_CERT_FLAG_NONE = 0x00
 
static final long VERIFY_CERT_FLAG_LEGACY = 0x02
 
static final long VERIFY_CERT_FLAG_REDIRECT = 0x10
 
static final long VERIFY_CERT_FLAG_GATEWAY = 0x20
 
static final long VERIFY_CERT_FLAG_CHANGED = 0x40
 
static final long VERIFY_CERT_FLAG_MISMATCH = 0x80
 
static final long VERIFY_CERT_FLAG_MATCH_LEGACY_SHA1 = 0x100
 
static final long VERIFY_CERT_FLAG_FP_IS_PEM = 0x200
 

Detailed Description

Definition at line 31 of file LibFreeRDP.java.

Member Function Documentation

◆ cancelConnection()

static boolean com.freerdp.freerdpcore.services.LibFreeRDP.cancelConnection ( long  inst)
inlinestatic

Definition at line 215 of file LibFreeRDP.java.

216 {
217 return freerdp_disconnect(inst);
218 }

◆ connect()

static boolean com.freerdp.freerdpcore.services.LibFreeRDP.connect ( long  inst)
inlinestatic

Definition at line 191 of file LibFreeRDP.java.

192 {
193 synchronized (mInstanceState)
194 {
195 if (mInstanceState.get(inst, false))
196 {
197 throw new RuntimeException("instance already connected");
198 }
199 }
200 return freerdp_connect(inst);
201 }

◆ disconnect()

static boolean com.freerdp.freerdpcore.services.LibFreeRDP.disconnect ( long  inst)
inlinestatic

Definition at line 203 of file LibFreeRDP.java.

204 {
205 synchronized (mInstanceState)
206 {
207 if (mInstanceState.get(inst, false))
208 {
209 return freerdp_disconnect(inst);
210 }
211 return true;
212 }
213 }

◆ freeInstance()

static void com.freerdp.freerdpcore.services.LibFreeRDP.freeInstance ( long  inst)
inlinestatic

Definition at line 168 of file LibFreeRDP.java.

169 {
170 synchronized (mInstanceState)
171 {
172 if (mInstanceState.get(inst, false))
173 {
174 freerdp_disconnect(inst);
175 }
176 while (mInstanceState.get(inst, false))
177 {
178 try
179 {
180 mInstanceState.wait();
181 }
182 catch (InterruptedException e)
183 {
184 throw new RuntimeException();
185 }
186 }
187 }
188 freerdp_free(inst);
189 }

◆ getVersion()

static String com.freerdp.freerdpcore.services.LibFreeRDP.getVersion ( )
inlinestatic

Definition at line 659 of file LibFreeRDP.java.

660 {
661 return freerdp_get_version();
662 }

◆ hasH264Support()

static boolean com.freerdp.freerdpcore.services.LibFreeRDP.hasH264Support ( )
inlinestatic

Definition at line 119 of file LibFreeRDP.java.

120 {
121 return mHasH264;
122 }

◆ newInstance()

static long com.freerdp.freerdpcore.services.LibFreeRDP.newInstance ( Context  context)
inlinestatic

Definition at line 163 of file LibFreeRDP.java.

164 {
165 return freerdp_new(context);
166 }

◆ sendClipboardData()

static boolean com.freerdp.freerdpcore.services.LibFreeRDP.sendClipboardData ( long  inst,
String  data 
)
inlinestatic

Definition at line 514 of file LibFreeRDP.java.

515 {
516 return freerdp_send_clipboard_data(inst, data);
517 }

◆ sendCursorEvent()

static boolean com.freerdp.freerdpcore.services.LibFreeRDP.sendCursorEvent ( long  inst,
int  x,
int  y,
int  flags 
)
inlinestatic

Definition at line 499 of file LibFreeRDP.java.

500 {
501 return freerdp_send_cursor_event(inst, x, y, flags);
502 }

◆ sendKeyEvent()

static boolean com.freerdp.freerdpcore.services.LibFreeRDP.sendKeyEvent ( long  inst,
int  keycode,
boolean  down 
)
inlinestatic

Definition at line 504 of file LibFreeRDP.java.

505 {
506 return freerdp_send_key_event(inst, keycode, down);
507 }

◆ sendUnicodeKeyEvent()

static boolean com.freerdp.freerdpcore.services.LibFreeRDP.sendUnicodeKeyEvent ( long  inst,
int  keycode,
boolean  down 
)
inlinestatic

Definition at line 509 of file LibFreeRDP.java.

510 {
511 return freerdp_send_unicodekey_event(inst, keycode, down);
512 }

◆ setConnectionInfo() [1/2]

static boolean com.freerdp.freerdpcore.services.LibFreeRDP.setConnectionInfo ( Context  context,
long  inst,
BookmarkBase  bookmark 
)
inlinestatic

Definition at line 229 of file LibFreeRDP.java.

230 {
231 BookmarkBase.ScreenSettings screenSettings = bookmark.getActiveScreenSettings();
232 BookmarkBase.AdvancedSettings advanced = bookmark.getAdvancedSettings();
233 BookmarkBase.DebugSettings debug = bookmark.getDebugSettings();
234
235 String arg;
236 ArrayList<String> args = new ArrayList<>();
237
238 args.add(TAG);
239 args.add("/gdi:sw");
240
241 final String clientName = ApplicationSettingsActivity.getClientName(context);
242 if (!clientName.isEmpty())
243 {
244 args.add("/client-hostname:" + clientName);
245 }
246 String certName = "";
247 if (bookmark.getType() != BookmarkBase.TYPE_MANUAL)
248 {
249 return false;
250 }
251
252 int port = bookmark.getPort();
253 String hostname = bookmark.getHostname();
254
255 args.add("/v:" + hostname);
256 args.add("/port:" + port);
257
258 final int level = advanced.getTlsSecLevel();
259 List<String> tls = new ArrayList<>();
260
261 if (level >= 0)
262 {
263 tls.add("seclevel:" + level);
264 }
265
266 final int tlsMinLevel = advanced.getTlsMinLevel();
267 if (tlsMinLevel >= 0)
268 {
269 tls.add("enforce:" + tlsMinLevel);
270 }
271
272 if (!tls.isEmpty())
273 {
274 StringBuilder sb = new StringBuilder();
275 for (String s : tls)
276 {
277 if (sb.length() > 0)
278 {
279 sb.append(',');
280 }
281 sb.append(s);
282 }
283 args.add("/tls:" + sb);
284 }
285
286 arg = bookmark.getUsername();
287 if (!arg.isEmpty())
288 {
289 args.add("/u:" + arg);
290 }
291 arg = bookmark.getDomain();
292 if (!arg.isEmpty())
293 {
294 args.add("/d:" + arg);
295 }
296 arg = bookmark.getPassword();
297 if (!arg.isEmpty())
298 {
299 args.add("/p:" + arg);
300 }
301
302 args.add(
303 String.format("/size:%dx%d", screenSettings.getWidth(), screenSettings.getHeight()));
304 args.add("/bpp:" + screenSettings.getColors());
305
306 if (advanced.getConsoleMode())
307 {
308 args.add("/admin");
309 }
310
311 switch (advanced.getSecurity())
312 {
313 case 3: // NLA
314 args.add("/sec:nla");
315 break;
316 case 2: // TLS
317 args.add("/sec:tls");
318 break;
319 case 1: // RDP
320 args.add("/sec:rdp");
321 break;
322 default:
323 break;
324 }
325
326 if (!certName.isEmpty())
327 {
328 args.add("/cert-name:" + certName);
329 }
330
331 BookmarkBase.PerformanceFlags flags = bookmark.getActivePerformanceFlags();
332 if (flags.getRemoteFX())
333 {
334 args.add("/rfx");
335 args.add("/network:auto");
336 }
337
338 if (flags.getGfx())
339 {
340 args.add("/gfx");
341 args.add("/network:auto");
342 }
343
344 if (flags.getH264() && mHasH264)
345 {
346 args.add("/gfx:AVC444");
347 args.add("/network:auto");
348 }
349
350 args.add(addFlag("wallpaper", flags.getWallpaper()));
351 args.add(addFlag("window-drag", flags.getFullWindowDrag()));
352 args.add(addFlag("menu-anims", flags.getMenuAnimations()));
353 args.add(addFlag("themes", flags.getTheming()));
354 args.add(addFlag("fonts", flags.getFontSmoothing()));
355 args.add(addFlag("aero", flags.getDesktopComposition()));
356
357 if (!advanced.getRemoteProgram().isEmpty())
358 {
359 args.add("/shell:" + advanced.getRemoteProgram());
360 }
361
362 if (!advanced.getWorkDir().isEmpty())
363 {
364 args.add("/shell-dir:" + advanced.getWorkDir());
365 }
366
367 args.add(addFlag("async-channels", debug.getAsyncChannel()));
368 args.add(addFlag("async-update", debug.getAsyncUpdate()));
369
370 if (advanced.getRedirectSDCard())
371 {
372 String path = android.os.Environment.getExternalStorageDirectory().getPath();
373 args.add("/drive:sdcard," + path);
374 }
375
376 args.add("/clipboard");
377
378 // Gateway enabled?
379 if (bookmark.getType() == BookmarkBase.TYPE_MANUAL && bookmark.getEnableGatewaySettings())
380 {
381 BookmarkBase.GatewaySettings gateway = bookmark.getGatewaySettings();
382
383 StringBuilder carg = new StringBuilder();
384 carg.append(
385 String.format("/gateway:g:%s:%d", gateway.getHostname(), gateway.getPort()));
386
387 arg = gateway.getUsername();
388 if (!arg.isEmpty())
389 {
390 carg.append(",u:" + arg);
391 }
392 arg = gateway.getDomain();
393 if (!arg.isEmpty())
394 {
395 carg.append(",d:" + arg);
396 }
397 arg = gateway.getPassword();
398 if (!arg.isEmpty())
399 {
400 carg.append(",p:" + arg);
401 }
402 args.add(carg.toString());
403 }
404
405 /* 0 ... local
406 1 ... remote
407 2 ... disable */
408 args.add("/audio-mode:" + advanced.getRedirectSound());
409 if (advanced.getRedirectSound() == 0)
410 {
411 args.add("/sound");
412 }
413
414 if (advanced.getRedirectMicrophone())
415 {
416 args.add("/microphone");
417 }
418
419 args.add("/kbd:unicode:on");
420 args.add("/cert:ignore");
421 args.add("/log-level:" + debug.getDebugLevel());
422 String[] arrayArgs = args.toArray(new String[0]);
423 return freerdp_parse_arguments(inst, arrayArgs);
424 }

◆ setConnectionInfo() [2/2]

static boolean com.freerdp.freerdpcore.services.LibFreeRDP.setConnectionInfo ( Context  context,
long  inst,
Uri  openUri 
)
inlinestatic

Definition at line 426 of file LibFreeRDP.java.

427 {
428 ArrayList<String> args = new ArrayList<>();
429
430 // Parse URI from query string. Same key overwrite previous one
431 // freerdp://user@ip:port/connect?sound=&rfx=&p=password&clipboard=%2b&themes=-
432
433 // Now we only support Software GDI
434 args.add(TAG);
435 args.add("/gdi:sw");
436
437 final String clientName = ApplicationSettingsActivity.getClientName(context);
438 if (!clientName.isEmpty())
439 {
440 args.add("/client-hostname:" + clientName);
441 }
442
443 // Parse hostname and port. Set to 'v' argument
444 String hostname = openUri.getHost();
445 int port = openUri.getPort();
446 if (hostname != null)
447 {
448 hostname = hostname + ((port == -1) ? "" : (":" + port));
449 args.add("/v:" + hostname);
450 }
451
452 String user = openUri.getUserInfo();
453 if (user != null)
454 {
455 args.add("/u:" + user);
456 }
457
458 for (String key : openUri.getQueryParameterNames())
459 {
460 String value = openUri.getQueryParameter(key);
461
462 if (value.isEmpty())
463 {
464 // Query: key=
465 // To freerdp argument: /key
466 args.add("/" + key);
467 }
468 else if (value.equals("-") || value.equals("+"))
469 {
470 // Query: key=- or key=+
471 // To freerdp argument: -key or +key
472 args.add(value + key);
473 }
474 else
475 {
476 // Query: key=value
477 // To freerdp argument: /key:value
478 if (key.equals("drive") && value.equals("sdcard"))
479 {
480 // Special for sdcard redirect
481 String path = android.os.Environment.getExternalStorageDirectory().getPath();
482 value = "sdcard," + path;
483 }
484
485 args.add("/" + key + ":" + value);
486 }
487 }
488
489 String[] arrayArgs = args.toArray(new String[0]);
490 return freerdp_parse_arguments(inst, arrayArgs);
491 }

◆ setEventListener()

static void com.freerdp.freerdpcore.services.LibFreeRDP.setEventListener ( EventListener  l)
inlinestatic

Definition at line 158 of file LibFreeRDP.java.

159 {
160 listener = l;
161 }

◆ updateGraphics()

static boolean com.freerdp.freerdpcore.services.LibFreeRDP.updateGraphics ( long  inst,
Bitmap  bitmap,
int  x,
int  y,
int  width,
int  height 
)
inlinestatic

Definition at line 493 of file LibFreeRDP.java.

495 {
496 return freerdp_update_graphics(inst, bitmap, x, y, width, height);
497 }

Field Documentation

◆ VERIFY_CERT_FLAG_CHANGED

final long com.freerdp.freerdpcore.services.LibFreeRDP.VERIFY_CERT_FLAG_CHANGED = 0x40
static

Definition at line 43 of file LibFreeRDP.java.

◆ VERIFY_CERT_FLAG_FP_IS_PEM

final long com.freerdp.freerdpcore.services.LibFreeRDP.VERIFY_CERT_FLAG_FP_IS_PEM = 0x200
static

Definition at line 46 of file LibFreeRDP.java.

◆ VERIFY_CERT_FLAG_GATEWAY

final long com.freerdp.freerdpcore.services.LibFreeRDP.VERIFY_CERT_FLAG_GATEWAY = 0x20
static

Definition at line 42 of file LibFreeRDP.java.

◆ VERIFY_CERT_FLAG_LEGACY

final long com.freerdp.freerdpcore.services.LibFreeRDP.VERIFY_CERT_FLAG_LEGACY = 0x02
static

Definition at line 40 of file LibFreeRDP.java.

◆ VERIFY_CERT_FLAG_MATCH_LEGACY_SHA1

final long com.freerdp.freerdpcore.services.LibFreeRDP.VERIFY_CERT_FLAG_MATCH_LEGACY_SHA1 = 0x100
static

Definition at line 45 of file LibFreeRDP.java.

◆ VERIFY_CERT_FLAG_MISMATCH

final long com.freerdp.freerdpcore.services.LibFreeRDP.VERIFY_CERT_FLAG_MISMATCH = 0x80
static

Definition at line 44 of file LibFreeRDP.java.

◆ VERIFY_CERT_FLAG_NONE

final long com.freerdp.freerdpcore.services.LibFreeRDP.VERIFY_CERT_FLAG_NONE = 0x00
static

Definition at line 39 of file LibFreeRDP.java.

◆ VERIFY_CERT_FLAG_REDIRECT

final long com.freerdp.freerdpcore.services.LibFreeRDP.VERIFY_CERT_FLAG_REDIRECT = 0x10
static

Definition at line 41 of file LibFreeRDP.java.


The documentation for this class was generated from the following file: