#ifndef _ADB_PACKET_H_ #define _ADB_PACKET_H_ #define A_VERSION 0x01000000 // ADB protocol version #define ADB_CLASS 0xff #define ADB_SUBCLASS 0x42 #define ADB_PROTOCOL 0x1 #define A_SYNC 0x434e5953 #define A_CNXN 0x4e584e43 #define A_AUTH 0x48545541 #define A_OPEN 0x4e45504f #define A_OKAY 0x59414b4f #define A_CLSE 0x45534c43 #define A_WRTE 0x45545257 typedef struct amessage { unsigned command; /* command identifier constant */ unsigned arg0; /* first argument */ unsigned arg1; /* second argument */ unsigned data_length; /* length of payload (0 is allowed) */ unsigned data_check; /* checksum of data payload */ unsigned magic; /* command ^ 0xffffffff */ } amessage; #define MAX_PAYLOAD 4096 typedef struct apacket { amessage msg; unsigned char data[MAX_PAYLOAD]; } apacket; /* AUTH packets first argument */ /* Request */ #define ADB_AUTH_TOKEN 1 /* Response */ #define ADB_AUTH_SIGNATURE 2 #define ADB_AUTH_RSAPUBLICKEY 3 #endif