blob: e7fb17756feec3e176dc8338163961b968d2a19a [file] [log] [blame]
San Mehatfa644ff2009-05-08 11:15:53 -07001#ifndef _SOCKET_CLIENT_H
2#define _SOCKET_CLIENT_H
3
4#include "../../../frameworks/base/include/utils/List.h"
5
6#include <pthread.h>
Kenny Root30abb722010-09-14 14:26:12 -07007#include <sys/types.h>
San Mehatfa644ff2009-05-08 11:15:53 -07008
9class SocketClient {
10 int mSocket;
11 pthread_mutex_t mWriteMutex;
12
Kenny Root30abb722010-09-14 14:26:12 -070013 /* Peer process ID */
14 pid_t mPid;
15
16 /* Peer user ID */
17 uid_t mUid;
18
19 /* Peer group ID */
20 gid_t mGid;
21
San Mehatfa644ff2009-05-08 11:15:53 -070022public:
23 SocketClient(int sock);
24 virtual ~SocketClient() {}
25
26 int getSocket() { return mSocket; }
Kenny Root30abb722010-09-14 14:26:12 -070027 pid_t getPid() const { return mPid; }
28 uid_t getUid() const { return mUid; }
29 gid_t getGid() const { return mGid; }
San Mehatfa644ff2009-05-08 11:15:53 -070030
San Mehatdb017542009-05-20 15:27:14 -070031 int sendMsg(int code, const char *msg, bool addErrno);
32 int sendMsg(const char *msg);
San Mehatfa644ff2009-05-08 11:15:53 -070033};
34
35typedef android::List<SocketClient *> SocketClientCollection;
36#endif