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 "JackChannelTransaction.h"
00024
00025 #include <sys/un.h>
00026 #include <sys/types.h>
00027 #include <sys/socket.h>
00028 #include <sys/time.h>
00029 #include <arpa/inet.h>
00030 #include <errno.h>
00031 #include <unistd.h>
00032 #include <signal.h>
00033 #include <stdio.h>
00034 #include <stdlib.h>
00035 #include <string.h>
00036
00037 namespace Jack
00038 {
00039
00044 class JackClientSocket : public JackChannelTransaction
00045 {
00046
00047 private:
00048
00049 int fSocket;
00050
00051 public:
00052
00053 JackClientSocket(): fSocket( -1)
00054 {}
00055 JackClientSocket(int socket);
00056 virtual ~JackClientSocket()
00057 {}
00058
00059 int Connect(const char* dir, int which);
00060 int Connect(const char* dir, const char* name, int which);
00061 int Close();
00062 int Read(void* data, int len);
00063 int Write(void* data, int len);
00064 int GetFd()
00065 {
00066 return fSocket;
00067 }
00068 void SetReadTimeOut(long sec);
00069 void SetWriteTimeOut(long sec);
00070 };
00071
00076 class JackServerSocket
00077 {
00078
00079 private:
00080
00081 int fSocket;
00082 char fName[256];
00083
00084 public:
00085
00086 JackServerSocket(): fSocket( -1)
00087 {}
00088 virtual ~JackServerSocket()
00089 {}
00090
00091 int Bind(const char* dir, int which);
00092 int Bind(const char* dir, const char* name, int which);
00093 JackClientSocket* Accept();
00094 int Close();
00095 int GetFd()
00096 {
00097 return fSocket;
00098 }
00099 };
00100
00101 }
00102
00103 #endif
00104