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.
20 #ifndef __JackMachServerChannel__
21 #define __JackMachServerChannel__
23 #include "JackPlatformPlug.h"
24 #include "JackMachPort.h"
31 class JackLockedEngine
;
34 \brief JackServerChannel using Mach IPC.
37 class JackMachServerChannel
: public JackRunnableInterface
42 JackMachPortSet fServerPort
; /*! Mach port to communicate with the server : from client to server */
43 JackThread fThread
; /*! Thread to execute the event loop */
45 std::map
<mach_port_t
, int> fClientTable
;
47 static boolean_t
MessageHandler(mach_msg_header_t
* Request
, mach_msg_header_t
* Reply
);
51 JackMachServerChannel();
52 ~JackMachServerChannel();
54 int Open(const char* server_name
, JackServer
* server
); // Open the Server/Client connection
55 void Close(); // Close the Server/Client connection
59 JackLockedEngine
* GetEngine();
60 JackServer
* GetServer();
62 void ClientCheck(char* name
, char* name_res
, int protocol
, int options
, int* status
, int* result
);
63 void ClientOpen(char* name
, int pid
, mach_port_t
* private_port
, int* shared_engine
, int* shared_client
, int* shared_graph
, int* result
);
64 void ClientClose(mach_port_t private_port
, int refnum
);
65 void ClientKill(mach_port_t private_port
);
70 static std::map
<mach_port_t
, JackMachServerChannel
*> fPortTable
;