jack2 codebase
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.2KB

  1. /*
  2. Copyright (C) 2004-2006 Grame
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  14. */
  15. #ifndef __JackMachServerChannel__
  16. #define __JackMachServerChannel__
  17. #include "JackChannel.h"
  18. #include "JackThread.h"
  19. #include "JackMachPort.h"
  20. #include <map>
  21. namespace Jack
  22. {
  23. class JackServer;
  24. class JackEngine;
  25. /*!
  26. \brief JackServerChannel using Mach IPC.
  27. */
  28. class JackMachServerChannel : public JackServerChannelInterface, public JackRunnableInterface
  29. {
  30. private:
  31. JackMachPortSet fServerPort; /*! Mach port to communicate with the server : from client to server */
  32. JackThread* fThread; /*! Thread to execute the event loop */
  33. JackServer* fServer;
  34. std::map<mach_port_t, int> fClientTable;
  35. static boolean_t MessageHandler(mach_msg_header_t* Request, mach_msg_header_t* Reply);
  36. public:
  37. JackMachServerChannel();
  38. virtual ~JackMachServerChannel();
  39. int Open(JackServer* server); // Open the Server/Client connection
  40. void Close(); // Close the Server/Client connection
  41. JackEngine* GetEngine();
  42. JackServer* GetServer();
  43. void ClientCheck(char* name, char* name_res, int protocol, int options, int* status, int* result);
  44. void ClientOpen(char* name, mach_port_t* private_port, int* shared_engine, int* shared_client, int* shared_graph, int* result);
  45. void ClientClose(mach_port_t private_port, int refnum);
  46. void ClientKill(mach_port_t private_port);
  47. bool Execute();
  48. static std::map<mach_port_t, JackMachServerChannel*> fPortTable;
  49. };
  50. } // end of namespace
  51. #endif