Home | History | Annotate | Download | only in sysutils
      1 #ifndef _SOCKET_CLIENT_H
      2 #define _SOCKET_CLIENT_H
      3 
      4 #include "../../../frameworks/base/include/utils/List.h"
      5 
      6 #include <pthread.h>
      7 #include <sys/types.h>
      8 
      9 class SocketClient {
     10     int             mSocket;
     11     pthread_mutex_t mWriteMutex;
     12 
     13     /* 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 
     22 public:
     23     SocketClient(int sock);
     24     virtual ~SocketClient() {}
     25 
     26     int getSocket() { return mSocket; }
     27     pid_t getPid() const { return mPid; }
     28     uid_t getUid() const { return mUid; }
     29     gid_t getGid() const { return mGid; }
     30 
     31     int sendMsg(int code, const char *msg, bool addErrno);
     32     int sendMsg(const char *msg);
     33 };
     34 
     35 typedef android::List<SocketClient *> SocketClientCollection;
     36 #endif
     37