summaryrefslogtreecommitdiffstats
path: root/adb/transport.h
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2015-02-24 15:51:19 -0800
committerDan Albert <danalbert@google.com>2015-02-24 21:30:22 -0800
commit7664901a355b959f312e9acff5a0fd31b7139623 (patch)
tree4eae06ed28a7a20c454d9f4b59c6798a06644dad /adb/transport.h
parent5329d3fd54fa875bb7de78a8c40134cc63921c64 (diff)
downloadsystem_core-7664901a355b959f312e9acff5a0fd31b7139623.zip
system_core-7664901a355b959f312e9acff5a0fd31b7139623.tar.gz
system_core-7664901a355b959f312e9acff5a0fd31b7139623.tar.bz2
Move transport declarations into transport.h.
There are a few cloexec issues in here as an added bonus. Change-Id: I1699d719d733f47878bdba0454230cf5ab6a60b6
Diffstat (limited to 'adb/transport.h')
-rw-r--r--adb/transport.h55
1 files changed, 51 insertions, 4 deletions
diff --git a/adb/transport.h b/adb/transport.h
index d95ad32..9802b91 100644
--- a/adb/transport.h
+++ b/adb/transport.h
@@ -19,17 +19,64 @@
#include <sys/types.h>
+#include "adb.h"
+
#ifdef __cplusplus
extern "C" {
#endif
-/* convenience wrappers around read/write that will retry on
-** EINTR and/or short read/write. Returns 0 on success, -1
-** on error or EOF.
-*/
+/*
+ * Convenience wrappers around read/write that will retry on
+ * EINTR and/or short read/write. Returns 0 on success, -1
+ * on error or EOF.
+ */
int readx(int fd, void *ptr, size_t len);
int writex(int fd, const void *ptr, size_t len);
+/*
+ * Obtain a transport from the available transports.
+ * If state is != CS_ANY, only transports in that state are considered.
+ * If serial is non-NULL then only the device with that serial will be chosen.
+ * If no suitable transport is found, error is set.
+ */
+atransport* acquire_one_transport(int state, transport_type ttype,
+ const char* serial, char** error_out);
+void add_transport_disconnect(atransport* t, adisconnect* dis);
+void remove_transport_disconnect(atransport* t, adisconnect* dis);
+void kick_transport(atransport* t);
+void run_transport_disconnects(atransport* t);
+void update_transports(void);
+
+/* transports are ref-counted
+** get_device_transport does an acquire on your behalf before returning
+*/
+void init_transport_registration(void);
+int list_transports(char* buf, size_t bufsize, int long_listing);
+atransport* find_transport(const char* serial);
+
+void register_usb_transport(usb_handle* h, const char* serial,
+ const char* devpath, unsigned writeable);
+
+/* cause new transports to be init'd and added to the list */
+int register_socket_transport(int s, const char* serial, int port, int local);
+
+/* this should only be used for transports with connection_state == CS_NOPERM */
+void unregister_usb_transport(usb_handle* usb);
+
+/* these should only be used for the "adb disconnect" command */
+void unregister_transport(atransport* t);
+void unregister_all_tcp_transports();
+
+int check_header(apacket* p);
+int check_data(apacket* p);
+
+/* for MacOS X cleanup */
+void close_usb_devices();
+
+void send_packet(apacket* p, atransport* t);
+
+asocket* create_device_tracker(void);
+
#ifdef __cplusplus
}
#endif