JackSocket.h

00001 /*
00002 Copyright (C) 2004-2008 Grame  
00003   
00004   This program is free software; you can redistribute it and/or modify
00005   it under the terms of the GNU Lesser General Public License as published by
00006   the Free Software Foundation; either version 2.1 of the License, or
00007   (at your option) any later version.
00008   
00009   This program is distributed in the hope that it will be useful,
00010   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012   GNU Lesser General Public License for more details.
00013   
00014   You should have received a copy of the GNU Lesser General Public License
00015   along with this program; if not, write to the Free Software 
00016   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
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 } // end of namespace
00102 
00103 #endif
00104 

Generated on Thu Feb 14 11:16:02 2008 for Jackdmp by  doxygen 1.5.1