diff options
author | Robert Greenwalt <rgreenwalt@google.com> | 2012-03-06 11:30:13 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-03-06 11:30:13 -0800 |
commit | 78f6bcf853db3dd9b9b37a0ca4d4ee0374f6835a (patch) | |
tree | c8b92d557e35b39bcccad77c12025d795d5b8757 /include/sysutils/SocketClient.h | |
parent | 397cf1986448cedde2a17093884a0ee8bf0d0b3f (diff) | |
parent | 8702bb17f40022e970e8acd40b348d074e39afc7 (diff) | |
download | core-78f6bcf853db3dd9b9b37a0ca4d4ee0374f6835a.tar.gz core-78f6bcf853db3dd9b9b37a0ca4d4ee0374f6835a.tar.bz2 core-78f6bcf853db3dd9b9b37a0ca4d4ee0374f6835a.zip |
Merge "New NativeDaemonConnector protocol adds a seqnum."
Diffstat (limited to 'include/sysutils/SocketClient.h')
-rw-r--r-- | include/sysutils/SocketClient.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/include/sysutils/SocketClient.h b/include/sysutils/SocketClient.h index cee863fd9..65a5b1b67 100644 --- a/include/sysutils/SocketClient.h +++ b/include/sysutils/SocketClient.h @@ -4,6 +4,7 @@ #include "List.h" #include <pthread.h> +#include <cutils/atomic.h> #include <sys/types.h> class SocketClient { @@ -24,20 +25,27 @@ class SocketClient { pthread_mutex_t mRefCountMutex; int mRefCount; + int mCmdNum; + + bool mUseCmdNum; + public: SocketClient(int sock, bool owned); + SocketClient(int sock, bool owned, bool useCmdNum); virtual ~SocketClient(); int getSocket() { return mSocket; } pid_t getPid() const { return mPid; } uid_t getUid() const { return mUid; } gid_t getGid() const { return mGid; } + void setCmdNum(int cmdNum) { android_atomic_release_store(cmdNum, &mCmdNum); } + int getCmdNum() { return mCmdNum; } // Send null-terminated C strings: int sendMsg(int code, const char *msg, bool addErrno); - int sendMsg(const char *msg); + int sendMsg(int code, const char *msg, bool addErrno, bool useCmdNum); - // Sending binary data: + //Sending binary data: int sendData(const void *data, int len); // Optional reference counting. Reference count starts at 1. If @@ -46,6 +54,11 @@ 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); + void init(int socket, bool owned, bool useCmdNum); }; typedef android::sysutils::List<SocketClient *> SocketClientCollection; |