Replace Util.pprint by Logs.pprint
[jack2.git] / windows / JackWinNamedPipeServerChannel.h
blob0cc1412955f7a12949d347a5dbf9313754273164
1 /*
2 Copyright (C) 2004-2008 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.
21 #ifndef __JackWinNamedPipeServerChannel__
22 #define __JackWinNamedPipeServerChannel__
24 #include "JackWinNamedPipe.h"
25 #include "JackPlatformPlug.h"
26 #include "JackConstants.h"
28 #include "JackRequestDecoder.h"
30 #include <list>
32 namespace Jack
35 class JackServer;
37 class JackClientPipeThread : public JackRunnableInterface, public JackClientHandlerInterface
40 private:
42 JackWinNamedPipeClient* fPipe;
43 JackRequestDecoder* fDecoder;
44 JackServer* fServer;
45 JackThread fThread;
46 int fRefNum;
48 void ClientAdd(detail::JackChannelTransactionInterface* socket, JackClientOpenRequest* req, JackClientOpenResult *res);
49 void ClientRemove(detail::JackChannelTransactionInterface* socket, int refnum);
51 void ClientKill();
53 static HANDLE fMutex;
55 public:
57 JackClientPipeThread(JackWinNamedPipeClient* pipe);
58 virtual ~JackClientPipeThread();
60 int Open(JackServer* server); // Open the Server/Client connection
61 void Close(); // Close the Server/Client connection
63 // JackRunnableInterface interface
64 bool Execute();
66 // To be used for find out if the object can be deleted
67 bool IsRunning()
69 return (fRefNum >= 0);
74 /*!
75 \brief JackServerChannel using pipe.
78 class JackWinNamedPipeServerChannel : public JackRunnableInterface
81 private:
83 JackWinNamedPipeServer fRequestListenPipe; // Pipe to create request socket for the client
84 JackServer* fServer;
85 JackThread fThread; // Thread to execute the event loop
86 char fServerName[JACK_SERVER_CONTROL_NAME_SIZE];
88 std::list<JackClientPipeThread*> fClientList;
90 void ClientAdd(JackWinNamedPipeClient* pipe);
92 bool ClientListen();
93 bool ClientAccept();
95 public:
97 JackWinNamedPipeServerChannel();
98 ~JackWinNamedPipeServerChannel();
100 int Open(const char* server_name, JackServer* server); // Open the Server/Client connection
101 void Close(); // Close the Server/Client connection
103 int Start();
104 void Stop();
106 // JackRunnableInterface interface
107 bool Init();
108 bool Execute();
112 } // end of namespace
114 #endif