summaryrefslogtreecommitdiffstats
path: root/adb/adb.h
diff options
context:
space:
mode:
Diffstat (limited to 'adb/adb.h')
-rw-r--r--adb/adb.h90
1 files changed, 27 insertions, 63 deletions
diff --git a/adb/adb.h b/adb/adb.h
index 44e5981..cb2cf60 100644
--- a/adb/adb.h
+++ b/adb/adb.h
@@ -18,9 +18,10 @@
#define __ADB_H
#include <limits.h>
+#include <sys/types.h>
#include "adb_trace.h"
-#include "transport.h" /* readx(), writex() */
+#include "fdevent.h"
#define MAX_PAYLOAD 4096
@@ -32,21 +33,18 @@
#define A_WRTE 0x45545257
#define A_AUTH 0x48545541
-#define A_VERSION 0x01000000 // ADB protocol version
+// ADB protocol version.
+#define A_VERSION 0x01000000
-#define ADB_VERSION_MAJOR 1 // Used for help/version information
-#define ADB_VERSION_MINOR 0 // Used for help/version information
+// Used for help/version information.
+#define ADB_VERSION_MAJOR 1
+#define ADB_VERSION_MINOR 0
-#define ADB_SERVER_VERSION 32 // Increment this when we want to force users to start a new adb server
+// Increment this when we want to force users to start a new adb server.
+#define ADB_SERVER_VERSION 32
-typedef struct amessage amessage;
-typedef struct apacket apacket;
-typedef struct asocket asocket;
-typedef struct alistener alistener;
-typedef struct aservice aservice;
-typedef struct atransport atransport;
-typedef struct adisconnect adisconnect;
-typedef struct usb_handle usb_handle;
+struct atransport;
+struct usb_handle;
struct amessage {
unsigned command; /* command identifier constant */
@@ -163,12 +161,12 @@ struct adisconnect
** object, it's a special value used to indicate that a client wants to
** connect to a service implemented within the ADB server itself.
*/
-typedef enum transport_type {
+enum transport_type {
kTransportUsb,
kTransportLocal,
kTransportAny,
kTransportHost,
-} transport_type;
+};
#define TOKEN_SIZE 20
@@ -231,8 +229,8 @@ struct alistener
fdevent fde;
int fd;
- const char *local_name;
- const char *connect_to;
+ char *local_name;
+ char *connect_to;
atransport *transport;
adisconnect disconnect;
};
@@ -258,33 +256,11 @@ void fatal(const char *fmt, ...);
void fatal_errno(const char *fmt, ...);
void handle_packet(apacket *p, atransport *t);
-void send_packet(apacket *p, atransport *t);
void get_my_path(char *s, size_t maxLen);
int launch_server(int server_port);
int adb_main(int is_daemon, int server_port);
-
-/* 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);
-void update_transports(void);
-
-asocket* create_device_tracker(void);
-
-/* 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 run_transport_disconnects( atransport* t );
-void kick_transport( atransport* t );
-
/* initialize a transport object's func pointers and state */
#if ADB_HOST
int get_available_local_transport_index();
@@ -292,22 +268,6 @@ int get_available_local_transport_index();
int init_socket_transport(atransport *t, int s, int port, int local);
void init_usb_transport(atransport *t, usb_handle *usb, int state);
-/* for MacOS X cleanup */
-void close_usb_devices();
-
-/* 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);
-
-/* these should only be used for the "adb disconnect" command */
-void unregister_transport(atransport *t);
-void unregister_all_tcp_transports();
-
-void register_usb_transport(usb_handle *h, const char *serial, const char *devpath, unsigned writeable);
-
-/* this should only be used for transports with connection_state == CS_NOPERM */
-void unregister_usb_transport(usb_handle *usb);
-
-atransport *find_transport(const char *serial);
#if ADB_HOST
atransport* find_emulator_transport_by_adb_port(int adb_port);
#endif
@@ -328,16 +288,15 @@ int handle_forward_request(const char* service, transport_type ttype, char* seri
#if !ADB_HOST
void framebuffer_service(int fd, void *cookie);
-void remount_service(int fd, void *cookie);
-void disable_verity_service(int fd, void* cookie);
+void set_verity_enabled_state_service(int fd, void* cookie);
#endif
/* packet allocator */
apacket *get_apacket(void);
void put_apacket(apacket *p);
-int check_header(apacket *p);
-int check_data(apacket *p);
+// Define it if you want to dump packets.
+#define DEBUG_PACKETS 0
#if !DEBUG_PACKETS
#define print_packet(tag,p) do {} while (0)
@@ -376,8 +335,7 @@ void usb_kick(usb_handle *h);
int is_adb_interface(int vid, int pid, int usb_class, int usb_subclass, int usb_protocol);
#endif
-unsigned host_to_le32(unsigned n);
-int adb_commandline(int argc, char **argv);
+int adb_commandline(int argc, const char **argv);
int connection_state(atransport *t);
@@ -391,13 +349,14 @@ int connection_state(atransport *t);
#define CS_SIDELOAD 6
#define CS_UNAUTHORIZED 7
+extern const char *adb_device_banner;
extern int HOST;
extern int SHELL_EXIT_NOTIFY_FD;
-typedef enum {
+enum subproc_mode {
SUBPROC_PTY = 0,
SUBPROC_RAW = 1,
-} subproc_mode;
+} ;
#define CHUNK_SIZE (64*1024)
@@ -415,4 +374,9 @@ typedef enum {
int sendfailmsg(int fd, const char *reason);
int handle_host_request(char *service, transport_type ttype, char* serial, int reply_fd, asocket *s);
+void handle_online(atransport *t);
+void handle_offline(atransport *t);
+
+void send_connect(atransport *t);
+
#endif