00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __JackSocket__
00021 #define __JackSocket__
00022
00023 #include <sys/un.h>
00024 #include <sys/types.h>
00025 #include <sys/socket.h>
00026 #include <sys/ioctl.h>
00027 #include <sys/time.h>
00028 #include <arpa/inet.h>
00029 #include <errno.h>
00030 #include <unistd.h>
00031
00032 namespace Jack
00033 {
00034
00039 class JackClientSocket
00040 {
00041
00042 private:
00043
00044 int fSocket;
00045
00046 public:
00047
00048 JackClientSocket(): fSocket( -1)
00049 {}
00050 JackClientSocket(int socket);
00051
00052 int Connect(const char* dir, int which);
00053 int Connect(const char* dir, const char* name, int which);
00054 int Close();
00055 int Read(void* data, int len);
00056 int Write(void* data, int len);
00057 int GetFd()
00058 {
00059 return fSocket;
00060 }
00061 void SetReadTimeOut(long sec);
00062 void SetWriteTimeOut(long sec);
00063
00064 void SetNonBlocking(bool onoff);
00065 };
00066
00071 class JackServerSocket
00072 {
00073
00074 private:
00075
00076 int fSocket;
00077 char fName[256];
00078
00079 public:
00080
00081 JackServerSocket(): fSocket( -1)
00082 {}
00083 ~JackServerSocket()
00084 {}
00085
00086 int Bind(const char* dir, int which);
00087 int Bind(const char* dir, const char* name, int which);
00088 JackClientSocket* Accept();
00089 int Close();
00090 int GetFd()
00091 {
00092 return fSocket;
00093 }
00094 };
00095
00096 }
00097
00098 #endif
00099