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 synchronized (mInstanceState)
218 {
219 if (mInstanceState.get(inst, false))
220 {
221 return freerdp_disconnect(inst);
222 }
223 return true;
224 }
225 }

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

640 {
641 return freerdp_get_version();
642 }

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

495 {
496 return freerdp_send_clipboard_data(inst, data);
497 }

◆ sendCursorEvent()

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

Definition at line 479 of file LibFreeRDP.java.

480 {
481 return freerdp_send_cursor_event(inst, x, y, flags);
482 }

◆ sendKeyEvent()

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

Definition at line 484 of file LibFreeRDP.java.

485 {
486 return freerdp_send_key_event(inst, keycode, down);
487 }

◆ sendUnicodeKeyEvent()

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

Definition at line 489 of file LibFreeRDP.java.

490 {
491 return freerdp_send_unicodekey_event(inst, keycode, down);
492 }

◆ 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.<ManualBookmark>get().getPort();
260 String hostname = bookmark.<ManualBookmark>get().getHostname();
261
262 args.add("/v:" + hostname);
263 args.add("/port:" + port);
264
265 arg = bookmark.getUsername();
266 if (!arg.isEmpty())
267 {
268 args.add("/u:" + arg);
269 }
270 arg = bookmark.getDomain();
271 if (!arg.isEmpty())
272 {
273 args.add("/d:" + arg);
274 }
275 arg = bookmark.getPassword();
276 if (!arg.isEmpty())
277 {
278 args.add("/p:" + arg);
279 }
280
281 args.add(
282 String.format("/size:%dx%d", screenSettings.getWidth(), screenSettings.getHeight()));
283 args.add("/bpp:" + screenSettings.getColors());
284
285 if (advanced.getConsoleMode())
286 {
287 args.add("/admin");
288 }
289
290 switch (advanced.getSecurity())
291 {
292 case 3: // NLA
293 args.add("/sec:nla");
294 break;
295 case 2: // TLS
296 args.add("/sec:tls");
297 break;
298 case 1: // RDP
299 args.add("/sec:rdp");
300 break;
301 default:
302 break;
303 }
304
305 if (!certName.isEmpty())
306 {
307 args.add("/cert-name:" + certName);
308 }
309
310 BookmarkBase.PerformanceFlags flags = bookmark.getActivePerformanceFlags();
311 if (flags.getRemoteFX())
312 {
313 args.add("/rfx");
314 args.add("/network:auto");
315 }
316
317 if (flags.getGfx())
318 {
319 args.add("/gfx");
320 args.add("/network:auto");
321 }
322
323 if (flags.getH264() && mHasH264)
324 {
325 args.add("/gfx:AVC444");
326 args.add("/network:auto");
327 }
328
329 args.add(addFlag("wallpaper", flags.getWallpaper()));
330 args.add(addFlag("window-drag", flags.getFullWindowDrag()));
331 args.add(addFlag("menu-anims", flags.getMenuAnimations()));
332 args.add(addFlag("themes", flags.getTheming()));
333 args.add(addFlag("fonts", flags.getFontSmoothing()));
334 args.add(addFlag("aero", flags.getDesktopComposition()));
335
336 if (!advanced.getRemoteProgram().isEmpty())
337 {
338 args.add("/shell:" + advanced.getRemoteProgram());
339 }
340
341 if (!advanced.getWorkDir().isEmpty())
342 {
343 args.add("/shell-dir:" + advanced.getWorkDir());
344 }
345
346 args.add(addFlag("async-channels", debug.getAsyncChannel()));
347 args.add(addFlag("async-update", debug.getAsyncUpdate()));
348
349 if (advanced.getRedirectSDCard())
350 {
351 String path = android.os.Environment.getExternalStorageDirectory().getPath();
352 args.add("/drive:sdcard," + path);
353 }
354
355 args.add("/clipboard");
356
357 // Gateway enabled?
358 if (bookmark.getType() == BookmarkBase.TYPE_MANUAL &&
359 bookmark.<ManualBookmark>get().getEnableGatewaySettings())
360 {
361 ManualBookmark.GatewaySettings gateway =
362 bookmark.<ManualBookmark>get().getGatewaySettings();
363
364 String carg =
365 String.format("/gateway:g:%s:%d", gateway.getHostname(), gateway.getPort());
366
367 arg = gateway.getUsername();
368 if (!arg.isEmpty())
369 {
370 carg.append(",u:" + arg);
371 }
372 arg = gateway.getDomain();
373 if (!arg.isEmpty())
374 {
375 carg.append(",d:" + arg);
376 }
377 arg = gateway.getPassword();
378 if (!arg.isEmpty())
379 {
380 cargs.append(",p:" + arg);
381 }
382 args.add(String.format("/gateway:g:%s:%d", gateway.getHostname(), gateway.getPort()));
383 }
384
385 /* 0 ... local
386 1 ... remote
387 2 ... disable */
388 args.add("/audio-mode:" + advanced.getRedirectSound());
389 if (advanced.getRedirectSound() == 0)
390 {
391 args.add("/sound");
392 }
393
394 if (advanced.getRedirectMicrophone())
395 {
396 args.add("/microphone");
397 }
398
399 args.add("/kbd:unicode:on");
400 args.add("/cert:ignore");
401 args.add("/log-level:" + debug.getDebugLevel());
402 String[] arrayArgs = args.toArray(new String[0]);
403 return freerdp_parse_arguments(inst, arrayArgs);
404 }

◆ setConnectionInfo() [2/2]

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

Definition at line 406 of file LibFreeRDP.java.

407 {
408 ArrayList<String> args = new ArrayList<>();
409
410 // Parse URI from query string. Same key overwrite previous one
411 // freerdp://user@ip:port/connect?sound=&rfx=&p=password&clipboard=%2b&themes=-
412
413 // Now we only support Software GDI
414 args.add(TAG);
415 args.add("/gdi:sw");
416
417 final String clientName = ApplicationSettingsActivity.getClientName(context);
418 if (!clientName.isEmpty())
419 {
420 args.add("/client-hostname:" + clientName);
421 }
422
423 // Parse hostname and port. Set to 'v' argument
424 String hostname = openUri.getHost();
425 int port = openUri.getPort();
426 if (hostname != null)
427 {
428 hostname = hostname + ((port == -1) ? "" : (":" + port));
429 args.add("/v:" + hostname);
430 }
431
432 String user = openUri.getUserInfo();
433 if (user != null)
434 {
435 args.add("/u:" + user);
436 }
437
438 for (String key : openUri.getQueryParameterNames())
439 {
440 String value = openUri.getQueryParameter(key);
441
442 if (value.isEmpty())
443 {
444 // Query: key=
445 // To freerdp argument: /key
446 args.add("/" + key);
447 }
448 else if (value.equals("-") || value.equals("+"))
449 {
450 // Query: key=- or key=+
451 // To freerdp argument: -key or +key
452 args.add(value + key);
453 }
454 else
455 {
456 // Query: key=value
457 // To freerdp argument: /key:value
458 if (key.equals("drive") && value.equals("sdcard"))
459 {
460 // Special for sdcard redirect
461 String path = android.os.Environment.getExternalStorageDirectory().getPath();
462 value = "sdcard," + path;
463 }
464
465 args.add("/" + key + ":" + value);
466 }
467 }
468
469 String[] arrayArgs = args.toArray(new String[0]);
470 return freerdp_parse_arguments(inst, arrayArgs);
471 }

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

475 {
476 return freerdp_update_graphics(inst, bitmap, x, y, width, height);
477 }

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: