adb: switch asocket::enqueue to std::string.
Switch asocket over to taking a std::string instead of apacket* for
data. This allows us to remove asocket specific fields from apacket*.
Test: python test_device.py with x86_64 emulator, walleye
Test: adb_test on host
Change-Id: I9d157ff331a75ba49a54fdd4194e3f6cdff722f4
diff --git a/socket.h b/socket.h
index 563e2c7..a1b52b3 100644
--- a/socket.h
+++ b/socket.h
@@ -19,9 +19,12 @@
#include <stddef.h>
+#include <deque>
#include <memory>
+#include <string>
#include "fdevent.h"
+#include "range.h"
struct apacket;
class atransport;
@@ -59,9 +62,10 @@
fdevent fde;
int fd;
- // queue of apackets waiting to be written
- apacket* pkt_first;
- apacket* pkt_last;
+ // queue of data waiting to be written
+ std::deque<Range> packet_queue;
+
+ std::string smart_socket_data;
/* enqueue is called by our peer when it has data
* for us. It should return 0 if we can accept more
@@ -69,7 +73,7 @@
* peer->ready() when we once again are ready to
* receive data.
*/
- int (*enqueue)(asocket* s, apacket* pkt);
+ int (*enqueue)(asocket* s, std::string data);
/* ready is called by the peer when it is ready for
* us to send data via enqueue again