FreeRDP
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
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 634 of file LibFreeRDP.java.

635 {
636 return freerdp_get_version();
637 }

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

490 {
491 return freerdp_send_clipboard_data(inst, data);
492 }

◆ sendCursorEvent()

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

Definition at line 474 of file LibFreeRDP.java.

475 {
476 return freerdp_send_cursor_event(inst, x, y, flags);
477 }

◆ sendKeyEvent()

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

Definition at line 479 of file LibFreeRDP.java.

480 {
481 return freerdp_send_key_event(inst, keycode, down);
482 }

◆ sendUnicodeKeyEvent()

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

Definition at line 484 of file LibFreeRDP.java.

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

◆ 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 }
315
316 if (flags.getGfx())
317 {
318 args.add("/gfx");
319 }
320
321 if (flags.getH264() && mHasH264)
322 {
323 args.add("/gfx:AVC444");
324 }
325
326 args.add(addFlag("wallpaper", flags.getWallpaper()));
327 args.add(addFlag("window-drag", flags.getFullWindowDrag()));
328 args.add(addFlag("menu-anims", flags.getMenuAnimations()));
329 args.add(addFlag("themes", flags.getTheming()));
330 args.add(addFlag("fonts", flags.getFontSmoothing()));
331 args.add(addFlag("aero", flags.getDesktopComposition()));
332
333 if (!advanced.getRemoteProgram().isEmpty())
334 {
335 args.add("/shell:" + advanced.getRemoteProgram());
336 }
337
338 if (!advanced.getWorkDir().isEmpty())
339 {
340 args.add("/shell-dir:" + advanced.getWorkDir());
341 }
342
343 args.add(addFlag("async-channels", debug.getAsyncChannel()));
344 args.add(addFlag("async-update", debug.getAsyncUpdate()));
345
346 if (advanced.getRedirectSDCard())
347 {
348 String path = android.os.Environment.getExternalStorageDirectory().getPath();
349 args.add("/drive:sdcard," + path);
350 }
351
352 args.add("/clipboard");
353
354 // Gateway enabled?
355 if (bookmark.getType() == BookmarkBase.TYPE_MANUAL &&
356 bookmark.<ManualBookmark>get().getEnableGatewaySettings())
357 {
358 ManualBookmark.GatewaySettings gateway =
359 bookmark.<ManualBookmark>get().getGatewaySettings();
360
361 args.add(String.format("/g:%s:%d", gateway.getHostname(), gateway.getPort()));
362
363 arg = gateway.getUsername();
364 if (!arg.isEmpty())
365 {
366 args.add("/gu:" + arg);
367 }
368 arg = gateway.getDomain();
369 if (!arg.isEmpty())
370 {
371 args.add("/gd:" + arg);
372 }
373 arg = gateway.getPassword();
374 if (!arg.isEmpty())
375 {
376 args.add("/gp:" + arg);
377 }
378 }
379
380 /* 0 ... local
381 1 ... remote
382 2 ... disable */
383 args.add("/audio-mode:" + advanced.getRedirectSound());
384 if (advanced.getRedirectSound() == 0)
385 {
386 args.add("/sound");
387 }
388
389 if (advanced.getRedirectMicrophone())
390 {
391 args.add("/microphone");
392 }
393
394 args.add("/kbd:unicode:on");
395 args.add("/cert:ignore");
396 args.add("/log-level:" + debug.getDebugLevel());
397 String[] arrayArgs = args.toArray(new String[0]);
398 return freerdp_parse_arguments(inst, arrayArgs);
399 }

◆ setConnectionInfo() [2/2]

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

Definition at line 401 of file LibFreeRDP.java.

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

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

470 {
471 return freerdp_update_graphics(inst, bitmap, x, y, width, height);
472 }

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: