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 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
 

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

223 {
224 return freerdp_disconnect(inst);
225 }

◆ connect()

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

Definition at line 198 of file LibFreeRDP.java.

199 {
200 synchronized (mInstanceState)
201 {
202 if (mInstanceState.get(inst, false))
203 {
204 throw new RuntimeException("instance already connected");
205 }
206 }
207 return freerdp_connect(inst);
208 }

◆ disconnect()

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

Definition at line 210 of file LibFreeRDP.java.

211 {
212 synchronized (mInstanceState)
213 {
214 if (mInstanceState.get(inst, false))
215 {
216 return freerdp_disconnect(inst);
217 }
218 return true;
219 }
220 }

◆ freeInstance()

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

Definition at line 175 of file LibFreeRDP.java.

176 {
177 synchronized (mInstanceState)
178 {
179 if (mInstanceState.get(inst, false))
180 {
181 freerdp_disconnect(inst);
182 }
183 while (mInstanceState.get(inst, false))
184 {
185 try
186 {
187 mInstanceState.wait();
188 }
189 catch (InterruptedException e)
190 {
191 throw new RuntimeException();
192 }
193 }
194 }
195 freerdp_free(inst);
196 }

◆ getVersion()

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

Definition at line 750 of file LibFreeRDP.java.

751 {
752 return freerdp_get_version();
753 }

◆ hasH264Support()

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

Definition at line 119 of file LibFreeRDP.java.

120 {
121 return mHasH264;
122 }

◆ isUnicodeInputSupported()

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

Definition at line 549 of file LibFreeRDP.java.

550 {
551 return freerdp_is_unicode_input_supported(inst);
552 }

◆ newInstance()

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

Definition at line 170 of file LibFreeRDP.java.

171 {
172 return freerdp_new(context);
173 }

◆ sendClipboardData()

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

Definition at line 554 of file LibFreeRDP.java.

555 {
556 return freerdp_send_clipboard_data(inst, data);
557 }

◆ sendClipboardImageData()

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

Definition at line 559 of file LibFreeRDP.java.

560 {
561 return freerdp_send_clipboard_image_data(inst, data, mimeType);
562 }

◆ sendCursorEvent()

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

Definition at line 534 of file LibFreeRDP.java.

535 {
536 return freerdp_send_cursor_event(inst, x, y, flags);
537 }

◆ sendKeyEvent()

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

Definition at line 539 of file LibFreeRDP.java.

540 {
541 return freerdp_send_key_event(inst, keycode, down);
542 }

◆ sendMonitorLayout()

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

Definition at line 564 of file LibFreeRDP.java.

565 {
566 return freerdp_send_monitor_layout(inst, width, height);
567 }

◆ sendUnicodeKeyEvent()

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

Definition at line 544 of file LibFreeRDP.java.

545 {
546 return freerdp_send_unicodekey_event(inst, keycode, down);
547 }

◆ setConnectionInfo() [1/2]

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

Definition at line 236 of file LibFreeRDP.java.

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

◆ setConnectionInfo() [2/2]

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

Definition at line 461 of file LibFreeRDP.java.

462 {
463 ArrayList<String> args = new ArrayList<>();
464
465 // Parse URI from query string. Same key overwrite previous one
466 // freerdp://user@ip:port/connect?sound=&rfx=&p=password&clipboard=%2b&themes=-
467
468 // Now we only support Software GDI
469 args.add(TAG);
470 args.add("/gdi:sw");
471
472 final String clientName = ApplicationSettingsActivity.getClientName(context);
473 if (!clientName.isEmpty())
474 {
475 args.add("/client-hostname:" + clientName);
476 }
477
478 // Parse hostname and port. Set to 'v' argument
479 String hostname = openUri.getHost();
480 int port = openUri.getPort();
481 if (hostname != null)
482 {
483 hostname = hostname + ((port == -1) ? "" : (":" + port));
484 args.add("/v:" + hostname);
485 }
486
487 String user = openUri.getUserInfo();
488 if (user != null)
489 {
490 args.add("/u:" + user);
491 }
492
493 for (String key : openUri.getQueryParameterNames())
494 {
495 String value = openUri.getQueryParameter(key);
496
497 if (value.isEmpty())
498 {
499 // Query: key=
500 // To freerdp argument: /key
501 args.add("/" + key);
502 }
503 else if (value.equals("-") || value.equals("+"))
504 {
505 // Query: key=- or key=+
506 // To freerdp argument: -key or +key
507 args.add(value + key);
508 }
509 else
510 {
511 // Query: key=value
512 // To freerdp argument: /key:value
513 if (key.equals("drive") && value.equals("sdcard"))
514 {
515 // Special for sdcard redirect
516 String path = android.os.Environment.getExternalStorageDirectory().getPath();
517 value = "sdcard," + path;
518 }
519
520 args.add("/" + key + ":" + value);
521 }
522 }
523
524 String[] arrayArgs = args.toArray(new String[0]);
525 return freerdp_parse_arguments(inst, arrayArgs);
526 }

◆ setEventListener()

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

Definition at line 165 of file LibFreeRDP.java.

166 {
167 listener = l;
168 }

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

530 {
531 return freerdp_update_graphics(inst, bitmap, x, y, width, height);
532 }

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: