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.

77 lines
2.3KB

  1. /*
  2. Copyright (C) 2004-2008 Grame
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU Lesser General Public License as published by
  5. the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  14. */
  15. #ifndef __JackMachServerChannel__
  16. #define __JackMachServerChannel__
  17. #include "JackPlatformPlug.h"
  18. #include "JackMachPort.h"
  19. #include <map>
  20. namespace Jack
  21. {
  22. class JackServer;
  23. class JackLockedEngine;
  24. /*!
  25. \brief JackServerChannel using Mach IPC.
  26. */
  27. class JackMachServerChannel : public JackRunnableInterface
  28. {
  29. private:
  30. JackMachPortSet fServerPort; /*! Mach port to communicate with the server : from client to server */
  31. JackThread fThread; /*! Thread to execute the event loop */
  32. JackServer* fServer;
  33. std::map<mach_port_t, int> fClientTable;
  34. static boolean_t MessageHandler(mach_msg_header_t* Request, mach_msg_header_t* Reply);
  35. public:
  36. JackMachServerChannel();
  37. ~JackMachServerChannel();
  38. int Open(const char* server_name, JackServer* server); // Open the Server/Client connection
  39. void Close(); // Close the Server/Client connection
  40. int Start();
  41. JackLockedEngine* 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, int pid, 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. // Has to be public..
  49. static std::map<mach_port_t, JackMachServerChannel*> fPortTable;
  50. };
  51. } // end of namespace
  52. #endif