Correct target
[jack2.git] / windows / JackWinNamedPipeServerChannel.h
blob07f33d439fca02216d7bea48bdbcfcd2e0ba9b7f
1 /*
2 Copyright (C) 2004-2006 Grame
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published by
6 the Free Software Foundation; either version 2.1 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #ifndef __JackWinNamedPipeServerChannel__
21 #define __JackWinNamedPipeServerChannel__
23 #include "JackChannel.h"
24 #include "JackWinNamedPipe.h"
25 #include "JackThread.h"
26 #include <map>
27 #include <list>
29 namespace Jack
32 class JackClientPipeThread : public JackRunnableInterface
35 private:
37 JackWinNamedPipeClient* fPipe;
38 JackServer* fServer;
39 JackThread* fThread;
40 int fRefNum;
42 void AddClient(JackWinNamedPipeClient* pipe, char* name, int* shared_engine, int* shared_client, int* shared_ports, int* result);
43 void RemoveClient(JackWinNamedPipeClient* pipe, int refnum);
44 void KillClient(JackWinNamedPipeClient* pipe);
46 static HANDLE fMutex;
48 public:
50 JackClientPipeThread(JackWinNamedPipeClient* pipe);
51 virtual ~JackClientPipeThread();
53 int Open(JackServer* server); // Open the Server/Client connection
54 void Close(); // Close the Server/Client connection
56 int HandleRequest(JackWinNamedPipeClient* pipe);
58 // JackRunnableInterface interface
59 bool Execute();
61 bool IsRunning()
63 return (fRefNum >= 0);
67 /*!
68 \brief JackServerChannel using pipe.
71 class JackWinNamedPipeServerChannel : public JackServerChannelInterface, public JackRunnableInterface
74 private:
76 JackWinNamedPipeServer fRequestListenPipe; // Pipe to create request socket for the client
77 JackServer* fServer;
78 JackThread* fThread; // Thread to execute the event loop
80 std::list<JackClientPipeThread*> fClientList;
82 void AddClient(JackWinNamedPipeClient* pipe);
84 public:
86 JackWinNamedPipeServerChannel();
87 virtual ~JackWinNamedPipeServerChannel();
89 int Open(JackServer* server); // Open the Server/Client connection
90 void Close(); // Close the Server/Client connection
92 // JackRunnableInterface interface
93 bool Init();
94 bool Execute();
98 } // end of namespace
100 #endif