Merge pull request #23 from jackaudio/device_reservation_fixes
[jack2.git] / common / JackChannel.h
blob40f23b4fb3a18ee6e31c92d1d03f910846d3addc
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.
20 #ifndef __JackChannel__
21 #define __JackChannel__
23 #include "types.h"
24 #include "JackSession.h"
26 namespace Jack
29 class JackClientInterface;
30 class JackClient;
31 class JackServer;
32 struct JackEngineControl;
33 class JackGraphManager;
35 namespace detail
38 class JackChannelTransactionInterface
41 public:
43 JackChannelTransactionInterface()
45 virtual ~JackChannelTransactionInterface()
48 virtual int Read(void* data, int len) = 0;
49 virtual int Write(void* data, int len) = 0;
53 class JackRequestInterface
56 public:
58 JackRequestInterface()
60 virtual ~JackRequestInterface()
63 virtual int Connect(const char* dir, const char* name, int which) = 0;
64 virtual int Close() = 0;
68 class JackClientRequestInterface : public JackChannelTransactionInterface, public JackRequestInterface
71 public:
73 JackClientRequestInterface()
75 virtual ~JackClientRequestInterface()
78 virtual int Read(void* data, int len) { return -1; }
79 virtual int Write(void* data, int len) { return -1; }
81 virtual int Connect(const char* dir, const char* name, int which) { return -1; }
82 virtual int Close() { return -1; }
86 /*!
87 \brief Inter process channel for server/client bidirectionnal communication : request and (receiving) notifications.
90 class JackClientChannelInterface
93 public:
95 JackClientChannelInterface()
97 virtual ~JackClientChannelInterface()
100 // Open the Server/Client connection
101 virtual int Open(const char* server_name, const char* name, int uuid, char* name_res, JackClient* obj, jack_options_t options, jack_status_t* status)
103 return 0;
106 // Close the Server/Client connection
107 virtual void Close()
110 // Start listening for messages from the server
111 virtual int Start()
113 return 0;
116 // Stop listening for messages from the server
117 virtual void Stop()
120 virtual int ServerCheck(const char* server_name)
122 return -1;
125 virtual void ClientCheck(const char* name, int uuid, char* name_res, int protocol, int options, int* status, int* result, int open)
127 virtual void ClientOpen(const char* name, int pid, int uuid, int* shared_engine, int* shared_client, int* shared_graph, int* result)
129 virtual void ClientOpen(const char* name, int* ref, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, int* result)
131 virtual void ClientClose(int refnum, int* result)
134 virtual void ClientActivate(int refnum, int is_real_time, int* result)
136 virtual void ClientDeactivate(int refnum, int* result)
139 virtual void PortRegister(int refnum, const char* name, const char* type, unsigned int flags, unsigned int buffer_size, jack_port_id_t* port_index, int* result)
141 virtual void PortUnRegister(int refnum, jack_port_id_t port_index, int* result)
144 virtual void PortConnect(int refnum, const char* src, const char* dst, int* result)
146 virtual void PortDisconnect(int refnum, const char* src, const char* dst, int* result)
148 virtual void PortConnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result)
150 virtual void PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result)
152 virtual void PortRename(int refnum, jack_port_id_t port, const char* name, int* result)
155 virtual void SetBufferSize(jack_nframes_t buffer_size, int* result)
157 virtual void SetFreewheel(int onoff, int* result)
159 virtual void ComputeTotalLatencies(int* result)
162 virtual void ReleaseTimebase(int refnum, int* result)
164 virtual void SetTimebaseCallback(int refnum, int conditional, int* result)
167 virtual void GetInternalClientName(int refnum, int int_ref, char* name_res, int* result)
169 virtual void InternalClientHandle(int refnum, const char* client_name, int* status, int* int_ref, int* result)
171 virtual void InternalClientLoad(int refnum, const char* client_name, const char* so_name, const char* objet_data, int options, int* status, int* int_ref, int uuid, int* result)
173 virtual void InternalClientUnload(int refnum, int int_ref, int* status, int* result)
176 virtual void SessionNotify(int refnum, const char* target, jack_session_event_type_t type, const char* path, jack_session_command_t** result)
178 virtual void SessionReply(int refnum, int* result)
180 virtual void GetUUIDForClientName(int refnum, const char* client_name, char* uuid_res, int* result)
182 virtual void GetClientNameForUUID(int refnum, const char* uuid, char* name_res, int* result)
184 virtual void ReserveClientName(int refnum, const char* client_name, const char *uuid, int* result)
186 virtual void ClientHasSessionCallback(const char* client_name, int* result)
189 virtual bool IsChannelThread()
191 return false;
197 } // end of namespace
199 #endif