summaryrefslogtreecommitdiffstats
path: root/include/sysutils/SocketClient.h
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2010-09-14 14:26:12 -0700
committerKenny Root <kroot@google.com>2010-09-14 14:35:10 -0700
commit30abb7234de2a9caa1add4b00a189436f0b24560 (patch)
tree7920d9c39658ef8a7dc10e3ba825857597953912 /include/sysutils/SocketClient.h
parent40c2b7cbedff612ce8bc7a51589a952cc1d047b6 (diff)
downloadsystem_core-30abb7234de2a9caa1add4b00a189436f0b24560.zip
system_core-30abb7234de2a9caa1add4b00a189436f0b24560.tar.gz
system_core-30abb7234de2a9caa1add4b00a189436f0b24560.tar.bz2
Fetch peer credentials for local sockets
Fetch the PID, UID, and GID of the remote side of a local socket connection in case any users of this library class want to check it. Change-Id: Ia3230e6bc68ab6f93160df9f5996d2bf744b872c
Diffstat (limited to 'include/sysutils/SocketClient.h')
-rw-r--r--include/sysutils/SocketClient.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/sysutils/SocketClient.h b/include/sysutils/SocketClient.h
index 469dd9d..e7fb177 100644
--- a/include/sysutils/SocketClient.h
+++ b/include/sysutils/SocketClient.h
@@ -4,16 +4,29 @@
#include "../../../frameworks/base/include/utils/List.h"
#include <pthread.h>
+#include <sys/types.h>
class SocketClient {
int mSocket;
pthread_mutex_t mWriteMutex;
+ /* Peer process ID */
+ pid_t mPid;
+
+ /* Peer user ID */
+ uid_t mUid;
+
+ /* Peer group ID */
+ gid_t mGid;
+
public:
SocketClient(int sock);
virtual ~SocketClient() {}
int getSocket() { return mSocket; }
+ pid_t getPid() const { return mPid; }
+ uid_t getUid() const { return mUid; }
+ gid_t getGid() const { return mGid; }
int sendMsg(int code, const char *msg, bool addErrno);
int sendMsg(const char *msg);