2009-05-08 20:15:53 +02:00
|
|
|
#ifndef _SOCKET_CLIENT_H
|
|
|
|
#define _SOCKET_CLIENT_H
|
|
|
|
|
|
|
|
#include "../../../frameworks/base/include/utils/List.h"
|
|
|
|
|
|
|
|
#include <pthread.h>
|
2010-09-14 23:26:12 +02:00
|
|
|
#include <sys/types.h>
|
2009-05-08 20:15:53 +02:00
|
|
|
|
|
|
|
class SocketClient {
|
|
|
|
int mSocket;
|
|
|
|
pthread_mutex_t mWriteMutex;
|
|
|
|
|
2010-09-14 23:26:12 +02:00
|
|
|
/* Peer process ID */
|
|
|
|
pid_t mPid;
|
|
|
|
|
|
|
|
/* Peer user ID */
|
|
|
|
uid_t mUid;
|
|
|
|
|
|
|
|
/* Peer group ID */
|
|
|
|
gid_t mGid;
|
|
|
|
|
2009-05-08 20:15:53 +02:00
|
|
|
public:
|
|
|
|
SocketClient(int sock);
|
|
|
|
virtual ~SocketClient() {}
|
|
|
|
|
|
|
|
int getSocket() { return mSocket; }
|
2010-09-14 23:26:12 +02:00
|
|
|
pid_t getPid() const { return mPid; }
|
|
|
|
uid_t getUid() const { return mUid; }
|
|
|
|
gid_t getGid() const { return mGid; }
|
2009-05-08 20:15:53 +02:00
|
|
|
|
2009-05-21 00:27:14 +02:00
|
|
|
int sendMsg(int code, const char *msg, bool addErrno);
|
|
|
|
int sendMsg(const char *msg);
|
2009-05-08 20:15:53 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef android::List<SocketClient *> SocketClientCollection;
|
|
|
|
#endif
|