00001 /* 00002 00003 Sound service proxy, header 00004 Copyright (C) 2000-2001 Jussi Laako 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 00020 */ 00021 00022 00023 #include <pthread.h> 00024 #include <limits.h> 00025 00026 #include <Alloc.hh> 00027 #include <Condition.hh> 00028 #include <Mutex.hh> 00029 00030 #include "Config.h" 00031 #include "CfgFile.hh" 00032 #include "LogFile.hh" 00033 #include "SockClie.hh" 00034 #include "SockOp.hh" 00035 #include "SockServ.hh" 00036 00037 00038 #ifndef SOUNDPROXY_HH 00039 #define SOUNDPROXY_HH 00040 00041 #define SP_CONV_BUF_LEN 255 00042 00043 00049 class clSoundProxy 00050 { 00051 volatile bool bRun; // Protected 00052 bool bServeClient[SP_MAXCLIENTS]; // Protected 00053 int iServerPort; 00054 int iServicePort; 00055 int iClientSockH[SP_MAXCLIENTS]; // Protected 00056 char cpLogFile[_POSIX_PATH_MAX + 1]; 00057 char cpServerHost[SP_SERV_MAXLEN + 1]; 00058 char *cpFirstMsg; // Protected 00059 char *cpDataMsg; // Protected 00060 pthread_t ptidSoundIn; 00061 pthread_t ptidWaitConnect; 00062 pthread_t ptidServeClient[SP_MAXCLIENTS]; 00063 clAlloc FirstMsg; 00064 clAlloc DataMsg; 00065 clCfgFile Cfg; 00066 clCondition CondData; 00067 clLogFile Log; 00068 clMutex MutexData; 00069 clMutex MutexClass; 00070 void AddToLog (char, const char *); 00071 void AddToLog (char, const char *, int); 00072 int FindFreeSlot (); 00073 public: 00074 clSoundProxy (); 00075 ~clSoundProxy (); 00076 int Exec (); 00077 void Stop (); 00078 void *SoundInThread (void *); 00079 void *WaitConnectThread (void *); 00080 void *ServeClientThread (void *); 00081 }; 00082 00083 #endif 00084
1.3.3