diff options
author | Robert Greenwalt <rgreenwalt@google.com> | 2012-02-07 12:23:14 -0800 |
---|---|---|
committer | Robert Greenwalt <rgreenwalt@google.com> | 2012-02-07 16:00:07 -0800 |
commit | dc58e73071aa829a5038caf37211f6b3e2d7b275 (patch) | |
tree | 8a92d09200206a41977c40a7dfb8784c24f7118a /include/sysutils/SocketClient.h | |
parent | 6f53225ef9f60a18a69b4ad3ba920ada168b719e (diff) | |
download | system_core-dc58e73071aa829a5038caf37211f6b3e2d7b275.zip system_core-dc58e73071aa829a5038caf37211f6b3e2d7b275.tar.gz system_core-dc58e73071aa829a5038caf37211f6b3e2d7b275.tar.bz2 |
New NativeDaemonConnector protocol adds a seqnum.
Allows for one socket to be multiplexed for multiple requests.
bug:5864209
Change-Id: I934c88da25d95e093371f455442bdf2f0ed7a4f4
Diffstat (limited to 'include/sysutils/SocketClient.h')
-rw-r--r-- | include/sysutils/SocketClient.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/include/sysutils/SocketClient.h b/include/sysutils/SocketClient.h index 7d2b1d6..96323ac 100644 --- a/include/sysutils/SocketClient.h +++ b/include/sysutils/SocketClient.h @@ -24,6 +24,9 @@ class SocketClient { pthread_mutex_t mRefCountMutex; int mRefCount; + pthread_mutex_t mCmdNumMutex; + int mCmdNum; + public: SocketClient(int sock, bool owned); virtual ~SocketClient(); @@ -32,12 +35,13 @@ public: pid_t getPid() const { return mPid; } uid_t getUid() const { return mUid; } gid_t getGid() const { return mGid; } + void setCmdNum(int cmdNum); + int getCmdNum(); // Send null-terminated C strings: int sendMsg(int code, const char *msg, bool addErrno); - int sendMsg(const char *msg); - // Sending binary data: + //Sending binary data: int sendData(const void *data, int len); // Optional reference counting. Reference count starts at 1. If @@ -46,6 +50,10 @@ public: // decRef() when it's done with the client. void incRef(); bool decRef(); // returns true at 0 (but note: SocketClient already deleted) + +private: + // Send null-terminated C strings + int sendMsg(const char *msg); }; typedef android::List<SocketClient *> SocketClientCollection; |