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 boolean hasCameraRedirectionSupport ()
 
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 isUnicodeInputSupported (long inst)
 
static boolean sendClipboardData (long inst, String data)
 
static boolean sendClipboardImageData (long inst, byte[] data, String mimeType)
 
static boolean sendMonitorLayout (long inst, int width, int height)
 
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
 
static final int EXPERIMENTAL_REMOTEAPP = 0
 
static final int EXPERIMENTAL_CAMERA = 1
 

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 236 of file LibFreeRDP.java.

237 {
238 return freerdp_disconnect(inst);
239 }

◆ connect()

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

Definition at line 212 of file LibFreeRDP.java.

213 {
214 synchronized (mInstanceState)
215 {
216 if (mInstanceState.get(inst, false))
217 {
218 throw new RuntimeException("instance already connected");
219 }
220 }
221 return freerdp_connect(inst);
222 }

◆ disconnect()

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

Definition at line 224 of file LibFreeRDP.java.

225 {
226 synchronized (mInstanceState)
227 {
228 if (mInstanceState.get(inst, false))
229 {
230 return freerdp_disconnect(inst);
231 }
232 return true;
233 }
234 }

◆ freeInstance()

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

Definition at line 189 of file LibFreeRDP.java.

190 {
191 synchronized (mInstanceState)
192 {
193 if (mInstanceState.get(inst, false))
194 {
195 freerdp_disconnect(inst);
196 }
197 while (mInstanceState.get(inst, false))
198 {
199 try
200 {
201 mInstanceState.wait();
202 }
203 catch (InterruptedException e)
204 {
205 throw new RuntimeException();
206 }
207 }
208 }
209 freerdp_free(inst);
210 }

◆ getVersion()

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

Definition at line 845 of file LibFreeRDP.java.

846 {
847 return freerdp_get_version();
848 }

◆ hasCameraRedirectionSupport()

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

Definition at line 131 of file LibFreeRDP.java.

132 {
133 return mHasCameraRedirection;
134 }

◆ hasH264Support()

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

Definition at line 126 of file LibFreeRDP.java.

127 {
128 return mHasH264;
129 }

◆ isUnicodeInputSupported()

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

Definition at line 572 of file LibFreeRDP.java.

573 {
574 return freerdp_is_unicode_input_supported(inst);
575 }

◆ newInstance()

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

Definition at line 184 of file LibFreeRDP.java.

185 {
186 return freerdp_new(context);
187 }

◆ sendClipboardData()

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

Definition at line 577 of file LibFreeRDP.java.

578 {
579 return freerdp_send_clipboard_data(inst, data);
580 }

◆ sendClipboardImageData()

static boolean com.freerdp.freerdpcore.services.LibFreeRDP.sendClipboardImageData ( long  inst,
byte[]  data,
String  mimeType 
)
inlinestatic

Definition at line 582 of file LibFreeRDP.java.

583 {
584 return freerdp_send_clipboard_image_data(inst, data, mimeType);
585 }

◆ sendCursorEvent()

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

Definition at line 557 of file LibFreeRDP.java.

558 {
559 return freerdp_send_cursor_event(inst, x, y, flags);
560 }

◆ sendKeyEvent()

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

Definition at line 562 of file LibFreeRDP.java.

563 {
564 return freerdp_send_key_event(inst, keycode, down);
565 }

◆ sendMonitorLayout()

static boolean com.freerdp.freerdpcore.services.LibFreeRDP.sendMonitorLayout ( long  inst,
int  width,
int  height 
)
inlinestatic

Definition at line 587 of file LibFreeRDP.java.

588 {
589 return freerdp_send_monitor_layout(inst, width, height);
590 }

◆ sendUnicodeKeyEvent()

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

Definition at line 567 of file LibFreeRDP.java.

568 {
569 return freerdp_send_unicodekey_event(inst, keycode, down);
570 }

◆ setConnectionInfo() [1/2]

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

Definition at line 250 of file LibFreeRDP.java.

251 {
252 BookmarkBase.ScreenSettings screenSettings = bookmark.getActiveScreenSettings();
253 BookmarkBase.AdvancedSettings advanced = bookmark.getAdvancedSettings();
254 BookmarkBase.DebugSettings debug = bookmark.getDebugSettings();
255
256 String arg;
257 ArrayList<String> args = new ArrayList<>();
258
259 args.add(TAG);
260 args.add("/gdi:sw");
261
262 final String clientName = ApplicationSettingsActivity.getClientName(context);
263 if (!clientName.isEmpty())
264 {
265 args.add("/client-hostname:" + clientName);
266 }
267 String certName = "";
268 if (bookmark.getType() != BookmarkBase.TYPE_MANUAL)
269 {
270 return false;
271 }
272
273 int port = bookmark.getPort();
274 String hostname = bookmark.getHostname();
275
276 args.add("/v:" + hostname);
277 args.add("/port:" + port);
278
279 final int level = advanced.getTlsSecLevel();
280 List<String> tls = new ArrayList<>();
281
282 if (level >= 0)
283 {
284 tls.add("seclevel:" + level);
285 }
286
287 final int tlsMinLevel = advanced.getTlsMinLevel();
288 if (tlsMinLevel >= 0)
289 {
290 tls.add("enforce:" + tlsMinLevel);
291 }
292
293 if (!tls.isEmpty())
294 {
295 StringBuilder sb = new StringBuilder();
296 for (String s : tls)
297 {
298 if (sb.length() > 0)
299 {
300 sb.append(',');
301 }
302 sb.append(s);
303 }
304 args.add("/tls:" + sb);
305 }
306
307 arg = bookmark.getUsername();
308 if (!arg.isEmpty())
309 {
310 args.add("/u:" + arg);
311 }
312 arg = bookmark.getDomain();
313 if (!arg.isEmpty())
314 {
315 args.add("/d:" + arg);
316 }
317 arg = bookmark.getPassword();
318 if (!arg.isEmpty())
319 {
320 args.add("/p:" + arg);
321 }
322
323 args.add(String.format(java.util.Locale.US, "/size:%dx%d", screenSettings.getWidth(),
324 screenSettings.getHeight()));
325 args.add("/bpp:" + screenSettings.getColors());
326
327 if (screenSettings.isCustomScale())
328 {
329 args.add("/scale-desktop:" + screenSettings.getScaleDesktop());
330 args.add("/scale-device:" + screenSettings.getScaleDevice());
331 }
332 else
333 {
334 args.add("/scale:" + screenSettings.getScalePreset());
335 }
336
337 if (advanced.getConsoleMode())
338 {
339 args.add("/admin");
340 }
341
342 if (advanced.getVmConnectMode())
343 {
344 String guid = advanced.getVmConnectGuid();
345 if (!guid.isEmpty())
346 args.add("/vmconnect:" + guid);
347 else
348 args.add("/vmconnect");
349 }
350
351 switch (advanced.getSecurity())
352 {
353 case 3: // NLA
354 args.add("/sec:nla");
355 break;
356 case 2: // TLS
357 args.add("/sec:tls");
358 break;
359 case 1: // RDP
360 args.add("/sec:rdp");
361 break;
362 default:
363 break;
364 }
365
366 if (!certName.isEmpty())
367 {
368 args.add("/cert-name:" + certName);
369 }
370
371 BookmarkBase.PerformanceFlags flags = bookmark.getActivePerformanceFlags();
372 if (flags.getRemoteFX())
373 {
374 args.add("/rfx");
375 args.add("/network:auto");
376 }
377
378 if (flags.getGfx())
379 {
380 args.add("/gfx");
381 args.add("/network:auto");
382 }
383
384 if (flags.getH264() && mHasH264)
385 {
386 args.add("/gfx:AVC444");
387 args.add("/network:auto");
388 }
389
390 args.add(addFlag("wallpaper", flags.getWallpaper()));
391 args.add(addFlag("window-drag", flags.getFullWindowDrag()));
392 args.add(addFlag("menu-anims", flags.getMenuAnimations()));
393 args.add(addFlag("themes", flags.getTheming()));
394 args.add(addFlag("fonts", flags.getFontSmoothing()));
395 args.add(addFlag("aero", flags.getDesktopComposition()));
396
397 if (!advanced.getRemoteProgram().isEmpty())
398 {
399 args.add("/app:program:" + advanced.getRemoteProgram());
400 if (!advanced.getWorkDir().isEmpty())
401 args.add("/app:workdir:" + advanced.getWorkDir());
402 }
403 else
404 {
405 if (!advanced.getAlternateShell().isEmpty())
406 args.add("/shell:" + advanced.getAlternateShell());
407 if (!advanced.getWorkDir().isEmpty())
408 args.add("/shell-dir:" + advanced.getWorkDir());
409 }
410
411 args.add(addFlag("async-channels", debug.getAsyncChannel()));
412 args.add(addFlag("async-update", debug.getAsyncUpdate()));
413
414 if (advanced.getRedirectSDCard())
415 {
416 String path = android.os.Environment.getExternalStorageDirectory().getPath();
417 args.add("/drive:sdcard," + path);
418 }
419
420 String info = advanced.getLoadBalanceInfo();
421 if (!info.isEmpty())
422 {
423 args.add("/load-balance-info:" + info);
424 }
425 args.add("/clipboard");
426 args.add("/disp");
427
428 if (advanced.getRedirectPrinter())
429 args.add("/printer:aFreeRDP Print,Microsoft Print to PDF,default");
430
431 // Gateway enabled?
432 if (bookmark.getType() == BookmarkBase.TYPE_MANUAL && bookmark.getEnableGatewaySettings())
433 {
434 BookmarkBase.GatewaySettings gateway = bookmark.getGatewaySettings();
435
436 StringBuilder carg = new StringBuilder();
437 carg.append(String.format(java.util.Locale.US, "/gateway:g:%s:%d",
438 gateway.getHostname(), gateway.getPort()));
439
440 arg = gateway.getUsername();
441 if (!arg.isEmpty())
442 {
443 carg.append(",u:" + arg);
444 }
445 arg = gateway.getDomain();
446 if (!arg.isEmpty())
447 {
448 carg.append(",d:" + arg);
449 }
450 arg = gateway.getPassword();
451 if (!arg.isEmpty())
452 {
453 carg.append(",p:" + arg);
454 }
455 args.add(carg.toString());
456 }
457
458 /* 0 ... local
459 1 ... remote
460 2 ... disable */
461 args.add("/audio-mode:" + advanced.getRedirectSound());
462 if (advanced.getRedirectSound() == 0)
463 {
464 args.add("/sound");
465 }
466
467 if (advanced.getRedirectMicrophone())
468 {
469 args.add("/microphone");
470 }
471
472 if (advanced.getRedirectCamera() && mHasCameraRedirection)
473 {
474 args.add("/dvc:rdpecam");
475 }
476
477 args.add("/kbd:unicode:on");
478 args.add("/cert:ignore");
479 args.add("/log-level:" + debug.getDebugLevel());
480 String[] arrayArgs = args.toArray(new String[0]);
481 return freerdp_parse_arguments(inst, arrayArgs);
482 }

◆ setConnectionInfo() [2/2]

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

Definition at line 484 of file LibFreeRDP.java.

485 {
486 ArrayList<String> args = new ArrayList<>();
487
488 // Parse URI from query string. Same key overwrite previous one
489 // freerdp://user@ip:port/connect?sound=&rfx=&p=password&clipboard=%2b&themes=-
490
491 // Now we only support Software GDI
492 args.add(TAG);
493 args.add("/gdi:sw");
494
495 final String clientName = ApplicationSettingsActivity.getClientName(context);
496 if (!clientName.isEmpty())
497 {
498 args.add("/client-hostname:" + clientName);
499 }
500
501 // Parse hostname and port. Set to 'v' argument
502 String hostname = openUri.getHost();
503 int port = openUri.getPort();
504 if (hostname != null)
505 {
506 hostname = hostname + ((port == -1) ? "" : (":" + port));
507 args.add("/v:" + hostname);
508 }
509
510 String user = openUri.getUserInfo();
511 if (user != null)
512 {
513 args.add("/u:" + user);
514 }
515
516 for (String key : openUri.getQueryParameterNames())
517 {
518 String value = openUri.getQueryParameter(key);
519
520 if (value.isEmpty())
521 {
522 // Query: key=
523 // To freerdp argument: /key
524 args.add("/" + key);
525 }
526 else if (value.equals("-") || value.equals("+"))
527 {
528 // Query: key=- or key=+
529 // To freerdp argument: -key or +key
530 args.add(value + key);
531 }
532 else
533 {
534 // Query: key=value
535 // To freerdp argument: /key:value
536 if (key.equals("drive") && value.equals("sdcard"))
537 {
538 // Special for sdcard redirect
539 String path = android.os.Environment.getExternalStorageDirectory().getPath();
540 value = "sdcard," + path;
541 }
542
543 args.add("/" + key + ":" + value);
544 }
545 }
546
547 String[] arrayArgs = args.toArray(new String[0]);
548 return freerdp_parse_arguments(inst, arrayArgs);
549 }

◆ setEventListener()

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

Definition at line 179 of file LibFreeRDP.java.

180 {
181 listener = l;
182 }

◆ 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 551 of file LibFreeRDP.java.

553 {
554 return freerdp_update_graphics(inst, bitmap, x, y, width, height);
555 }

Field Documentation

◆ EXPERIMENTAL_CAMERA

final int com.freerdp.freerdpcore.services.LibFreeRDP.EXPERIMENTAL_CAMERA = 1
static

Definition at line 51 of file LibFreeRDP.java.

◆ EXPERIMENTAL_REMOTEAPP

final int com.freerdp.freerdpcore.services.LibFreeRDP.EXPERIMENTAL_REMOTEAPP = 0
static

Definition at line 50 of file LibFreeRDP.java.

◆ VERIFY_CERT_FLAG_CHANGED

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

Definition at line 44 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 47 of file LibFreeRDP.java.

◆ VERIFY_CERT_FLAG_GATEWAY

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

Definition at line 43 of file LibFreeRDP.java.

◆ VERIFY_CERT_FLAG_LEGACY

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

Definition at line 41 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 46 of file LibFreeRDP.java.

◆ VERIFY_CERT_FLAG_MISMATCH

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

Definition at line 45 of file LibFreeRDP.java.

◆ VERIFY_CERT_FLAG_NONE

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

Definition at line 40 of file LibFreeRDP.java.

◆ VERIFY_CERT_FLAG_REDIRECT

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

Definition at line 42 of file LibFreeRDP.java.


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