android_system_core/adb
David 'Digit' Turner 2525869419 adb: implement "adb reverse <local> <remote>"
This implements the logical opposite of 'adb forward', i.e.
the ability to reverse network connections from the device
to the host.

This feature is very useful for testing various programs
running on an Android device without root or poking at the
host's routing table.

Options and parameters are exactly the same as those for
'adb forward', except that the direction is reversed.

Examples:

  adb reverse tcp:5000 tcp:6000
    connections to localhost:5000 on the device will be
    forwarded to localhost:6000 on the host.

  adb reverse --no-rebind tcp:5000 tcp:6000
    same as above, but fails if the socket is already
    bound through a previous 'adb reverse tcp:5000 ...'
    command.

  adb reverse --list
    list all active reversed connections for the target
    device. Note: there is no command to list all
    reversed connections for all devices at once.

  adb reverse --remove tcp:5000
    remove any reversed connection on the device from
    localhost:5000

  adb reverse --remove-all
    remove all reversed connections form the current
    device.

Reversed connections are tied to a transport, in other
words, they disappear as soon as a device is disconnected.

Simple testing protocol:

  adb forward tcp:5000 tcp:6000
  adb reverse tcp:6000 tcp:7000
  nc -l localhost 7000

in another terminal:
  echo "Hello" | nc localhost 5000

Will print "Hello" on the first terminal.

Change-Id: I761af790cdb06829b68430afa4145a919fa0e6d5
2014-05-27 16:42:13 +02:00
..
adb.c adb: implement "adb reverse <local> <remote>" 2014-05-27 16:42:13 +02:00
adb.h adb: implement "adb reverse <local> <remote>" 2014-05-27 16:42:13 +02:00
adb_auth.h adb: Fix secure adb when booting with usb attached 2013-02-02 01:19:06 +00:00
adb_auth_client.c mincrypt: support SHA-256 hash algorithm 2013-09-25 09:26:34 -07:00
adb_auth_host.c adb: avoid compilation errors for unused results 2014-05-13 09:12:54 -07:00
adb_client.c Fix adb forward --list when forwarding a lot 2014-02-21 14:57:02 +01:00
adb_client.h Support adb client connect to remote server 2013-01-04 11:00:38 -08:00
Android.mk Merge changes Idfd1a114,If725a1cb,I61211165,If9a05ccb 2014-05-07 23:10:40 +00:00
backup_service.c adb: turn on -Werror 2014-05-05 10:30:06 -07:00
commandline.c adb: implement "adb reverse <local> <remote>" 2014-05-27 16:42:13 +02:00
console.c auto import from //depot/cupcake/@135843 2009-03-03 19:32:55 -08:00
fdevent.c adb: keep mac build happy 2011-03-29 12:36:22 -07:00
fdevent.h adb: fix subprocess exit handling, oom adjust fixes, extra debugging. 2011-03-28 14:12:22 -07:00
file_sync_client.c adb: turn on -Werror 2014-05-05 10:30:06 -07:00
file_sync_service.c adb: Don't unlink special files on sync failure. 2014-03-07 17:31:25 -08:00
file_sync_service.h Added transfer progress reporting for push and pull commands. 2014-03-11 19:31:26 -07:00
framebuffer_service.c Handle screendumps for all framebuffer sizes 2013-09-25 02:43:45 -07:00
get_my_path_darwin.c eclair snapshot 2009-11-12 18:46:23 -08:00
get_my_path_freebsd.c FreeBSD support for usb-connected devices in adb 2009-10-25 01:56:35 +11:00
get_my_path_linux.c Make get_my_path() safer 2009-10-22 02:55:00 +11:00
get_my_path_windows.c Make get_my_path() safer 2009-10-22 02:55:00 +11:00
jdwp_service.c Fix adb leaking file descriptors to forked processes 2011-02-03 15:26:45 -05:00
MODULE_LICENSE_APACHE2 eclair snapshot 2009-11-12 18:46:23 -08:00
mutex_list.h adb: Cleanup dead code 2013-04-24 21:31:45 -07:00
NOTICE eclair snapshot 2009-11-12 18:46:23 -08:00
OVERVIEW.TXT Fixing spelling errors in adb docs 2010-04-28 11:38:39 -04:00
protocol.txt adb: Add public key authentification 2012-08-23 00:20:06 -07:00
remount_service.c adb: turn on -Werror 2014-05-05 10:30:06 -07:00
services.c adb: implement "adb reverse <local> <remote>" 2014-05-27 16:42:13 +02:00
SERVICES.TXT adb: implement "adb reverse <local> <remote>" 2014-05-27 16:42:13 +02:00
sockets.c system/core 64-bit cleanup. 2014-01-16 12:54:18 -08:00
sockets.dia auto import from //depot/cupcake/@135843 2009-03-03 19:32:55 -08:00
SYNC.TXT Adding documentation on the sync part of the adb protocol previously missing. 2014-03-20 20:36:46 +01:00
sysdeps.h Fix win32 implicit declaration of function socket_network_client_timeout. 2014-05-20 08:51:15 -07:00
sysdeps_win32.c Fix win32 undefined reference to `_socket_network_client_timeout'. 2014-05-20 12:13:29 -07:00
test_track_devices.c auto import from //depot/cupcake/@135843 2009-03-03 19:32:55 -08:00
test_track_jdwp.c auto import from //depot/cupcake/@135843 2009-03-03 19:32:55 -08:00
transport.c adb: fix windows build after "forward --list" fix. 2014-03-06 19:40:45 -08:00
transport.h adb: fix subprocess exit handling, oom adjust fixes, extra debugging. 2011-03-28 14:12:22 -07:00
transport_local.c adb: Increase the max number of emulator instances to 64 2014-03-13 11:21:58 +01:00
transport_usb.c adb: Improved detection of big endian architecture 2010-10-16 14:35:28 +02:00
usb_libusb.c adb: Add ability to specify device path 2012-04-20 11:21:14 -07:00
usb_linux.c system/core 64-bit cleanup. 2014-01-16 12:54:18 -08:00
usb_linux_client.c Merge "adbd: Don't close/reopen FFS ep0 on disconnect" 2014-01-28 00:07:15 +00:00
usb_osx.c adb: Add ability to specify device path 2012-04-20 11:21:14 -07:00
usb_vendors.c Modify VID for Compal 2014-05-05 03:43:20 +08:00
usb_vendors.h adb: Add vendor IDs for iRiver, Compal and T & A Mobile Phones 2011-07-11 09:39:39 -04:00
usb_windows.c adb: turn on -Werror 2014-05-05 10:30:06 -07:00