summaryrefslogtreecommitdiffstats
path: root/adb/commandline.c
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2014-05-27 16:43:45 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-05-27 16:43:45 +0000
commit7291ac60822c8b84e423de4f4abec6663d0e8f50 (patch)
tree763063e561c78d54b6b55c0243f354df803ee7d5 /adb/commandline.c
parentef386b3fb01b7458f2dcf11c9be7bd099f0ea2ed (diff)
parent972677557bd2c3a0678a945765783e85c7ec7b9c (diff)
downloadcore-7291ac60822c8b84e423de4f4abec6663d0e8f50.tar.gz
core-7291ac60822c8b84e423de4f4abec6663d0e8f50.tar.bz2
core-7291ac60822c8b84e423de4f4abec6663d0e8f50.zip
am 97267755: am c3358875: am 6e7343b8: Merge "adb: implement "adb reverse <local> <remote>""
* commit '972677557bd2c3a0678a945765783e85c7ec7b9c': adb: implement "adb reverse <local> <remote>"
Diffstat (limited to 'adb/commandline.c')
-rw-r--r--adb/commandline.c38
1 files changed, 29 insertions, 9 deletions
diff --git a/adb/commandline.c b/adb/commandline.c
index a3eaf43c2..70bf641d0 100644
--- a/adb/commandline.c
+++ b/adb/commandline.c
@@ -137,6 +137,19 @@ void help()
" if <local> is already forwarded\n"
" adb forward --remove <local> - remove a specific forward socket connection\n"
" adb forward --remove-all - remove all forward socket connections\n"
+ " adb reverse --list - list all reverse socket connections from device\n"
+ " adb reverse <remote> <local> - reverse socket connections\n"
+ " reverse specs are one of:\n"
+ " tcp:<port>\n"
+ " localabstract:<unix domain socket name>\n"
+ " localreserved:<unix domain socket name>\n"
+ " localfilesystem:<unix domain socket name>\n"
+ " adb reverse --norebind <remote> <local>\n"
+ " - same as 'adb reverse <remote> <local>' but fails\n"
+ " if <remote> is already reversed.\n"
+ " adb reverse --remove <remote>\n"
+ " - remove a specific reversed socket connection\n"
+ " adb reverse --remove-all - remove all reversed socket connections from device\n"
" adb jdwp - list PIDs of processes hosting a JDWP transport\n"
" adb install [-l] [-r] [-d] [-s] [--algo <algorithm name> --key <hex-encoded key> --iv <hex-encoded iv>] <file>\n"
" - push this package file to the device and install it\n"
@@ -1308,8 +1321,11 @@ top:
return 0;
}
- if(!strcmp(argv[0], "forward")) {
+ if(!strcmp(argv[0], "forward") ||
+ !strcmp(argv[0], "reverse"))
+ {
char host_prefix[64];
+ char reverse = (char) !strcmp(argv[0], "reverse");
char remove = 0;
char remove_all = 0;
char list = 0;
@@ -1338,15 +1354,19 @@ top:
}
// Determine the <host-prefix> for this command.
- if (serial) {
- snprintf(host_prefix, sizeof host_prefix, "host-serial:%s",
- serial);
- } else if (ttype == kTransportUsb) {
- snprintf(host_prefix, sizeof host_prefix, "host-usb");
- } else if (ttype == kTransportLocal) {
- snprintf(host_prefix, sizeof host_prefix, "host-local");
+ if (reverse) {
+ snprintf(host_prefix, sizeof host_prefix, "reverse");
} else {
- snprintf(host_prefix, sizeof host_prefix, "host");
+ if (serial) {
+ snprintf(host_prefix, sizeof host_prefix, "host-serial:%s",
+ serial);
+ } else if (ttype == kTransportUsb) {
+ snprintf(host_prefix, sizeof host_prefix, "host-usb");
+ } else if (ttype == kTransportLocal) {
+ snprintf(host_prefix, sizeof host_prefix, "host-local");
+ } else {
+ snprintf(host_prefix, sizeof host_prefix, "host");
+ }
}
// Implement forward --list