git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4684 0c269be4-1314-0410-8aa9-9f06e86f4224tags/1.9.9.5
@@ -36,6 +36,10 @@ John Emmas | |||
Jackdmp changes log | |||
--------------------------- | |||
2012-01-11 Stephane Letz <letz@grame.fr> | |||
* Factorize code the server/client request. | |||
2012-01-06 Stephane Letz <letz@grame.fr> | |||
* Cleanup drivers and internals loading code. | |||
@@ -35,6 +35,36 @@ class JackGraphManager; | |||
namespace detail | |||
{ | |||
class JackChannelTransactionInterface | |||
{ | |||
public: | |||
JackChannelTransactionInterface() | |||
{} | |||
virtual ~JackChannelTransactionInterface() | |||
{} | |||
virtual int Read(void* data, int len) = 0; | |||
virtual int Write(void* data, int len) = 0; | |||
}; | |||
class JackClientRequestInterface : public JackChannelTransactionInterface | |||
{ | |||
public: | |||
JackClientRequestInterface() | |||
{} | |||
virtual ~JackClientRequestInterface() | |||
{} | |||
virtual int Connect(const char* dir, const char* name, int which) = 0; | |||
virtual int Close() = 0; | |||
}; | |||
/*! | |||
\brief Inter process channel for server/client bidirectionnal communication : request and (receiving) notifications. | |||
*/ | |||
@@ -27,6 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
#include "JackSynchro.h" | |||
#include "JackPlatformPlug.h" | |||
#include "JackChannel.h" | |||
#include "JackRequest.h" | |||
#include "varargs.h" | |||
#include <list> | |||
@@ -932,7 +932,7 @@ int JackEngine::PortRename(int refnum, jack_port_id_t port, const char* name) | |||
// Session management | |||
//-------------------- | |||
void JackEngine::SessionNotify(int refnum, const char *target, jack_session_event_type_t type, const char *path, JackChannelTransaction *socket, JackSessionNotifyResult** result) | |||
void JackEngine::SessionNotify(int refnum, const char *target, jack_session_event_type_t type, const char *path, detail::JackChannelTransactionInterface *socket, JackSessionNotifyResult** result) | |||
{ | |||
if (fSessionPendingReplies != 0) { | |||
JackSessionNotifyResult res(-1); | |||
@@ -26,6 +26,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
#include "JackMutex.h" | |||
#include "JackTransportEngine.h" | |||
#include "JackPlatformPlug.h" | |||
#include "JackRequest.h" | |||
#include <map> | |||
namespace Jack | |||
@@ -34,6 +35,7 @@ namespace Jack | |||
class JackClientInterface; | |||
struct JackEngineControl; | |||
class JackExternalClient; | |||
class detail::JackChannelTransactionInterface; | |||
/*! | |||
\brief Engine description. | |||
@@ -54,7 +56,7 @@ class SERVER_EXPORT JackEngine : public JackLockAble | |||
jack_time_t fLastSwitchUsecs; | |||
int fSessionPendingReplies; | |||
JackChannelTransaction* fSessionTransaction; | |||
detail::JackChannelTransactionInterface* fSessionTransaction; | |||
JackSessionNotifyResult* fSessionResult; | |||
std::map<int,std::string> fReservationMap; | |||
int fMaxUUID; | |||
@@ -145,7 +147,7 @@ class SERVER_EXPORT JackEngine : public JackLockAble | |||
void NotifyQuit(); | |||
// Session management | |||
void SessionNotify(int refnum, const char *target, jack_session_event_type_t type, const char *path, JackChannelTransaction *socket, JackSessionNotifyResult** result); | |||
void SessionNotify(int refnum, const char *target, jack_session_event_type_t type, const char *path, detail::JackChannelTransactionInterface *socket, JackSessionNotifyResult** result); | |||
void SessionReply(int refnum); | |||
void GetUUIDForClientName(const char *client_name, char *uuid_res, int *result); | |||
@@ -0,0 +1,284 @@ | |||
/* | |||
Copyright (C) 2004-2008 Grame | |||
This program is free software; you can redistribute it and/or modify | |||
it under the terms of the GNU Lesser General Public License as published by | |||
the Free Software Foundation; either version 2.1 of the License, or | |||
(at your option) any later version. | |||
This program is distributed in the hope that it will be useful, | |||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
GNU Lesser General Public License for more details. | |||
You should have received a copy of the GNU Lesser General Public License | |||
along with this program; if not, write to the Free Software | |||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
*/ | |||
#include "JackGenericClientChannel.h" | |||
#include "JackClient.h" | |||
#include "JackGlobals.h" | |||
#include "JackError.h" | |||
namespace Jack | |||
{ | |||
JackGenericClientChannel::JackGenericClientChannel():fClient(NULL) | |||
{} | |||
JackGenericClientChannel::~JackGenericClientChannel() | |||
{} | |||
int JackGenericClientChannel::ServerCheck(const char* server_name) | |||
{ | |||
jack_log("JackGenericClientChannel::ServerCheck = %s", server_name); | |||
// Connect to server | |||
if (fRequest->Connect(jack_server_dir, server_name, 0) < 0) { | |||
jack_error("Cannot connect to server request channel"); | |||
return -1; | |||
} else { | |||
return 0; | |||
} | |||
} | |||
void JackGenericClientChannel::ServerSyncCall(JackRequest* req, JackResult* res, int* result) | |||
{ | |||
if (req->Write(fRequest) < 0) { | |||
jack_error("Could not write request type = %ld", req->fType); | |||
*result = -1; | |||
return; | |||
} | |||
if (res->Read(fRequest) < 0) { | |||
jack_error("Could not read result type = %ld", req->fType); | |||
*result = -1; | |||
return; | |||
} | |||
*result = res->fResult; | |||
} | |||
void JackGenericClientChannel::ServerAsyncCall(JackRequest* req, JackResult* res, int* result) | |||
{ | |||
if (req->Write(fRequest) < 0) { | |||
jack_error("Could not write request type = %ld", req->fType); | |||
*result = -1; | |||
} else { | |||
*result = 0; | |||
} | |||
} | |||
void JackGenericClientChannel::ClientCheck(const char* name, int uuid, char* name_res, int protocol, int options, int* status, int* result, int open) | |||
{ | |||
JackClientCheckRequest req(name, protocol, options, uuid, open); | |||
JackClientCheckResult res; | |||
ServerSyncCall(&req, &res, result); | |||
*status = res.fStatus; | |||
strcpy(name_res, res.fName); | |||
} | |||
void JackGenericClientChannel::ClientOpen(const char* name, int pid, int uuid, int* shared_engine, int* shared_client, int* shared_graph, int* result) | |||
{ | |||
JackClientOpenRequest req(name, pid, uuid); | |||
JackClientOpenResult res; | |||
ServerSyncCall(&req, &res, result); | |||
*shared_engine = res.fSharedEngine; | |||
*shared_client = res.fSharedClient; | |||
*shared_graph = res.fSharedGraph; | |||
} | |||
void JackGenericClientChannel::ClientClose(int refnum, int* result) | |||
{ | |||
JackClientCloseRequest req(refnum); | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackGenericClientChannel::ClientActivate(int refnum, int is_real_time, int* result) | |||
{ | |||
JackActivateRequest req(refnum, is_real_time); | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackGenericClientChannel::ClientDeactivate(int refnum, int* result) | |||
{ | |||
JackDeactivateRequest req(refnum); | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackGenericClientChannel::PortRegister(int refnum, const char* name, const char* type, unsigned int flags, unsigned int buffer_size, jack_port_id_t* port_index, int* result) | |||
{ | |||
JackPortRegisterRequest req(refnum, name, type, flags, buffer_size); | |||
JackPortRegisterResult res; | |||
ServerSyncCall(&req, &res, result); | |||
*port_index = res.fPortIndex; | |||
} | |||
void JackGenericClientChannel::PortUnRegister(int refnum, jack_port_id_t port_index, int* result) | |||
{ | |||
JackPortUnRegisterRequest req(refnum, port_index); | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackGenericClientChannel::PortConnect(int refnum, const char* src, const char* dst, int* result) | |||
{ | |||
JackPortConnectNameRequest req(refnum, src, dst); | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackGenericClientChannel::PortDisconnect(int refnum, const char* src, const char* dst, int* result) | |||
{ | |||
JackPortDisconnectNameRequest req(refnum, src, dst); | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackGenericClientChannel::PortConnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result) | |||
{ | |||
JackPortConnectRequest req(refnum, src, dst); | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackGenericClientChannel::PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result) | |||
{ | |||
JackPortDisconnectRequest req(refnum, src, dst); | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackGenericClientChannel::PortRename(int refnum, jack_port_id_t port, const char* name, int* result) | |||
{ | |||
JackPortRenameRequest req(refnum, port, name); | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackGenericClientChannel::SetBufferSize(jack_nframes_t buffer_size, int* result) | |||
{ | |||
JackSetBufferSizeRequest req(buffer_size); | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackGenericClientChannel::SetFreewheel(int onoff, int* result) | |||
{ | |||
JackSetFreeWheelRequest req(onoff); | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackGenericClientChannel::ComputeTotalLatencies(int* result) | |||
{ | |||
JackComputeTotalLatenciesRequest req; | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackGenericClientChannel::SessionNotify(int refnum, const char* target, jack_session_event_type_t type, const char* path, jack_session_command_t** result) | |||
{ | |||
JackSessionNotifyRequest req(refnum, path, type, target); | |||
JackSessionNotifyResult res; | |||
int intresult; | |||
ServerSyncCall(&req, &res, &intresult); | |||
*result = res.GetCommands(); | |||
} | |||
void JackGenericClientChannel::SessionReply(int refnum, int* result) | |||
{ | |||
JackSessionReplyRequest req(refnum); | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackGenericClientChannel::GetUUIDForClientName(int refnum, const char* client_name, char* uuid_res, int* result) | |||
{ | |||
JackGetUUIDRequest req(client_name); | |||
JackUUIDResult res; | |||
ServerSyncCall(&req, &res, result); | |||
strncpy(uuid_res, res.fUUID, JACK_UUID_SIZE); | |||
} | |||
void JackGenericClientChannel::GetClientNameForUUID(int refnum, const char* uuid, char* name_res, int* result) | |||
{ | |||
JackGetClientNameRequest req(uuid); | |||
JackClientNameResult res; | |||
ServerSyncCall(&req, &res, result); | |||
strncpy(name_res, res.fName, JACK_CLIENT_NAME_SIZE); | |||
} | |||
void JackGenericClientChannel::ClientHasSessionCallback(const char* client_name, int* result) | |||
{ | |||
JackClientHasSessionCallbackRequest req(client_name); | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackGenericClientChannel::ReserveClientName(int refnum, const char* client_name, const char* uuid, int* result) | |||
{ | |||
JackReserveNameRequest req(refnum, client_name, uuid); | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackGenericClientChannel::ReleaseTimebase(int refnum, int* result) | |||
{ | |||
JackReleaseTimebaseRequest req(refnum); | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackGenericClientChannel::SetTimebaseCallback(int refnum, int conditional, int* result) | |||
{ | |||
JackSetTimebaseCallbackRequest req(refnum, conditional); | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackGenericClientChannel::GetInternalClientName(int refnum, int int_ref, char* name_res, int* result) | |||
{ | |||
JackGetInternalClientNameRequest req(refnum, int_ref); | |||
JackGetInternalClientNameResult res; | |||
ServerSyncCall(&req, &res, result); | |||
strcpy(name_res, res.fName); | |||
} | |||
void JackGenericClientChannel::InternalClientHandle(int refnum, const char* client_name, int* status, int* int_ref, int* result) | |||
{ | |||
JackInternalClientHandleRequest req(refnum, client_name); | |||
JackInternalClientHandleResult res; | |||
ServerSyncCall(&req, &res, result); | |||
*int_ref = res.fIntRefNum; | |||
*status = res.fStatus; | |||
} | |||
void JackGenericClientChannel::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) | |||
{ | |||
JackInternalClientLoadRequest req(refnum, client_name, so_name, objet_data, options, uuid); | |||
JackInternalClientLoadResult res; | |||
ServerSyncCall(&req, &res, result); | |||
*int_ref = res.fIntRefNum; | |||
*status = res.fStatus; | |||
} | |||
void JackGenericClientChannel::InternalClientUnload(int refnum, int int_ref, int* status, int* result) | |||
{ | |||
JackInternalClientUnloadRequest req(refnum, int_ref); | |||
JackInternalClientUnloadResult res; | |||
ServerSyncCall(&req, &res, result); | |||
*status = res.fStatus; | |||
} | |||
} // end of namespace | |||
@@ -0,0 +1,105 @@ | |||
/* | |||
Copyright (C) 2004-2008 Grame | |||
This program is free software; you can redistribute it and/or modify | |||
it under the terms of the GNU Lesser General Public License as published by | |||
the Free Software Foundation; either version 2.1 of the License, or | |||
(at your option) any later version. | |||
This program is distributed in the hope that it will be useful, | |||
but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
GNU Lesser General Public License for more details. | |||
You should have received a copy of the GNU Lesser General Public License | |||
along with this program; if not, write to the Free Software | |||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
*/ | |||
#ifndef __JackGenericClientChannel__ | |||
#define __JackGenericClientChannel__ | |||
#include "JackChannel.h" | |||
namespace Jack | |||
{ | |||
struct JackRequest; | |||
struct JackResult; | |||
class detail::JackClientRequestInterface; | |||
/*! | |||
\brief Generic JackClientChannel class. | |||
*/ | |||
class JackGenericClientChannel : public detail::JackClientChannelInterface | |||
{ | |||
protected: | |||
detail::JackClientRequestInterface* fRequest; | |||
JackClient* fClient; | |||
void ServerSyncCall(JackRequest* req, JackResult* res, int* result); | |||
void ServerAsyncCall(JackRequest* req, JackResult* res, int* result); | |||
public: | |||
JackGenericClientChannel(); | |||
virtual ~JackGenericClientChannel(); | |||
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) { return -1; } | |||
virtual void Close() {} | |||
virtual int Start() { return -1; } | |||
virtual void Stop() {} | |||
int ServerCheck(const char* server_name); | |||
void ClientCheck(const char* name, int uuid, char* name_res, int protocol, int options, int* status, int* result, int open); | |||
void ClientOpen(const char* name, int pid, int uuid, int* shared_engine, int* shared_client, int* shared_graph, int* result); | |||
void ClientOpen(const char* name, int* ref, int uuid, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, int* result) | |||
{} | |||
void ClientClose(int refnum, int* result); | |||
void ClientActivate(int refnum, int is_real_time, int* result); | |||
void ClientDeactivate(int refnum, int* result); | |||
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); | |||
void PortUnRegister(int refnum, jack_port_id_t port_index, int* result); | |||
void PortConnect(int refnum, const char* src, const char* dst, int* result); | |||
void PortDisconnect(int refnum, const char* src, const char* dst, int* result); | |||
void PortConnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result); | |||
void PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result); | |||
void PortRename(int refnum, jack_port_id_t port, const char* name, int* result); | |||
void SetBufferSize(jack_nframes_t buffer_size, int* result); | |||
void SetFreewheel(int onoff, int* result); | |||
void ComputeTotalLatencies(int* result); | |||
void ReleaseTimebase(int refnum, int* result); | |||
void SetTimebaseCallback(int refnum, int conditional, int* result); | |||
void GetInternalClientName(int refnum, int int_ref, char* name_res, int* result); | |||
void InternalClientHandle(int refnum, const char* client_name, int* status, int* int_ref, int* result); | |||
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); | |||
void InternalClientUnload(int refnum, int int_ref, int* status, int* result); | |||
// Session API | |||
void SessionNotify(int refnum, const char* target, jack_session_event_type_t type, const char* path, jack_session_command_t** result); | |||
void SessionReply(int refnum, int* result); | |||
void GetUUIDForClientName(int refnum, const char* client_name, char* uuid_res, int* result); | |||
void GetClientNameForUUID(int refnum, const char* uuid, char* name_res, int* result); | |||
void ReserveClientName(int refnum, const char* client_name, const char *uuid, int* result); | |||
void ClientHasSessionCallback(const char* client_name, int* result); | |||
}; | |||
} // end of namespace | |||
#endif | |||
@@ -325,7 +325,7 @@ class SERVER_EXPORT JackLockedEngine | |||
CATCH_EXCEPTION | |||
} | |||
void SessionNotify(int refnum, const char* target, jack_session_event_type_t type, const char *path, JackChannelTransaction *socket, JackSessionNotifyResult** result) | |||
void SessionNotify(int refnum, const char* target, jack_session_event_type_t type, const char *path, detail::JackChannelTransactionInterface *socket, JackSessionNotifyResult** result) | |||
{ | |||
TRY_CALL | |||
JackLock lock(&fEngine); | |||
@@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
#include "JackConstants.h" | |||
#include "JackPlatformPlug.h" | |||
#include "JackChannel.h" | |||
#include "JackTime.h" | |||
#include "types.h" | |||
#include <string.h> | |||
@@ -100,12 +101,12 @@ struct JackRequest | |||
virtual ~JackRequest() | |||
{} | |||
virtual int Read(JackChannelTransaction* trans) | |||
virtual int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
return trans->Read(&fType, sizeof(RequestType)); | |||
} | |||
virtual int Write(JackChannelTransaction* trans) | |||
virtual int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
return trans->Write(&fType, sizeof(RequestType)); | |||
} | |||
@@ -128,12 +129,12 @@ struct JackResult | |||
virtual ~JackResult() | |||
{} | |||
virtual int Read(JackChannelTransaction* trans) | |||
virtual int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
return trans->Read(&fResult, sizeof(int)); | |||
} | |||
virtual int Write(JackChannelTransaction* trans) | |||
virtual int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
return trans->Write(&fResult, sizeof(int)); | |||
} | |||
@@ -161,7 +162,7 @@ struct JackClientCheckRequest : public JackRequest | |||
snprintf(fName, sizeof(fName), "%s", name); | |||
} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(trans->Read(&fName, sizeof(fName))); | |||
CheckRes(trans->Read(&fProtocol, sizeof(int))); | |||
@@ -170,7 +171,7 @@ struct JackClientCheckRequest : public JackRequest | |||
return trans->Read(&fOpen, sizeof(int)); | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackRequest::Write(trans)); | |||
CheckRes(trans->Write(&fName, sizeof(fName))); | |||
@@ -200,7 +201,7 @@ struct JackClientCheckResult : public JackResult | |||
snprintf(fName, sizeof(fName), "%s", name); | |||
} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackResult::Read(trans)); | |||
CheckRes(trans->Read(&fName, sizeof(fName))); | |||
@@ -208,7 +209,7 @@ struct JackClientCheckResult : public JackResult | |||
return 0; | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackResult::Write(trans)); | |||
CheckRes(trans->Write(&fName, sizeof(fName))); | |||
@@ -238,14 +239,14 @@ struct JackClientOpenRequest : public JackRequest | |||
fUUID = uuid; | |||
} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(trans->Read(&fPID, sizeof(int))); | |||
CheckRes(trans->Read(&fUUID, sizeof(int))); | |||
return trans->Read(&fName, sizeof(fName)); | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackRequest::Write(trans)); | |||
CheckRes(trans->Write(&fPID, sizeof(int))); | |||
@@ -273,7 +274,7 @@ struct JackClientOpenResult : public JackResult | |||
: JackResult(result), fSharedEngine(index1), fSharedClient(index2), fSharedGraph(index3) | |||
{} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackResult::Read(trans)); | |||
CheckRes(trans->Read(&fSharedEngine, sizeof(int))); | |||
@@ -282,7 +283,7 @@ struct JackClientOpenResult : public JackResult | |||
return 0; | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackResult::Write(trans)); | |||
CheckRes(trans->Write(&fSharedEngine, sizeof(int))); | |||
@@ -307,12 +308,12 @@ struct JackClientCloseRequest : public JackRequest | |||
JackClientCloseRequest(int refnum): JackRequest(JackRequest::kClientClose), fRefNum(refnum) | |||
{} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
return trans->Read(&fRefNum, sizeof(int)); | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackRequest::Write(trans)); | |||
return trans->Write(&fRefNum, sizeof(int)); | |||
@@ -336,13 +337,13 @@ struct JackActivateRequest : public JackRequest | |||
: JackRequest(JackRequest::kActivateClient), fRefNum(refnum), fIsRealTime(is_real_time) | |||
{} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(trans->Read(&fRefNum, sizeof(int))); | |||
return trans->Read(&fIsRealTime, sizeof(int)); | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackRequest::Write(trans)); | |||
CheckRes(trans->Write(&fRefNum, sizeof(int))); | |||
@@ -365,12 +366,12 @@ struct JackDeactivateRequest : public JackRequest | |||
JackDeactivateRequest(int refnum): JackRequest(JackRequest::kDeactivateClient), fRefNum(refnum) | |||
{} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
return trans->Read(&fRefNum, sizeof(int)); | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackRequest::Write(trans)); | |||
return trans->Write(&fRefNum, sizeof(int)); | |||
@@ -400,7 +401,7 @@ struct JackPortRegisterRequest : public JackRequest | |||
strcpy(fPortType, port_type); | |||
} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(trans->Read(&fRefNum, sizeof(int))); | |||
CheckRes(trans->Read(&fName, sizeof(fName))); | |||
@@ -410,7 +411,7 @@ struct JackPortRegisterRequest : public JackRequest | |||
return 0; | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackRequest::Write(trans)); | |||
CheckRes(trans->Write(&fRefNum, sizeof(int))); | |||
@@ -435,13 +436,13 @@ struct JackPortRegisterResult : public JackResult | |||
JackPortRegisterResult(): JackResult(), fPortIndex(NO_PORT) | |||
{} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackResult::Read(trans)); | |||
return trans->Read(&fPortIndex, sizeof(jack_port_id_t)); | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackResult::Write(trans)); | |||
return trans->Write(&fPortIndex, sizeof(jack_port_id_t)); | |||
@@ -465,14 +466,14 @@ struct JackPortUnRegisterRequest : public JackRequest | |||
: JackRequest(JackRequest::kUnRegisterPort), fRefNum(refnum), fPortIndex(index) | |||
{} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(trans->Read(&fRefNum, sizeof(int))); | |||
CheckRes(trans->Read(&fPortIndex, sizeof(jack_port_id_t))); | |||
return 0; | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackRequest::Write(trans)); | |||
CheckRes(trans->Write(&fRefNum, sizeof(int))); | |||
@@ -502,7 +503,7 @@ struct JackPortConnectNameRequest : public JackRequest | |||
strcpy(fDst, dst_name); | |||
} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(trans->Read(&fRefNum, sizeof(int))); | |||
CheckRes(trans->Read(&fSrc, sizeof(fSrc))); | |||
@@ -511,7 +512,7 @@ struct JackPortConnectNameRequest : public JackRequest | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackRequest::Write(trans)); | |||
CheckRes(trans->Write(&fRefNum, sizeof(int))); | |||
@@ -542,7 +543,7 @@ struct JackPortDisconnectNameRequest : public JackRequest | |||
strcpy(fDst, dst_name); | |||
} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(trans->Read(&fRefNum, sizeof(int))); | |||
CheckRes(trans->Read(&fSrc, sizeof(fSrc))); | |||
@@ -550,7 +551,7 @@ struct JackPortDisconnectNameRequest : public JackRequest | |||
return 0; | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackRequest::Write(trans)); | |||
CheckRes(trans->Write(&fRefNum, sizeof(int))); | |||
@@ -578,7 +579,7 @@ struct JackPortConnectRequest : public JackRequest | |||
: JackRequest(JackRequest::kConnectPorts), fRefNum(refnum), fSrc(src), fDst(dst) | |||
{} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(trans->Read(&fRefNum, sizeof(int))); | |||
CheckRes(trans->Read(&fSrc, sizeof(jack_port_id_t))); | |||
@@ -586,7 +587,7 @@ struct JackPortConnectRequest : public JackRequest | |||
return 0; | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackRequest::Write(trans)); | |||
CheckRes(trans->Write(&fRefNum, sizeof(int))); | |||
@@ -614,7 +615,7 @@ struct JackPortDisconnectRequest : public JackRequest | |||
: JackRequest(JackRequest::kDisconnectPorts), fRefNum(refnum), fSrc(src), fDst(dst) | |||
{} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(trans->Read(&fRefNum, sizeof(int))); | |||
CheckRes(trans->Read(&fSrc, sizeof(jack_port_id_t))); | |||
@@ -622,7 +623,7 @@ struct JackPortDisconnectRequest : public JackRequest | |||
return 0; | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackRequest::Write(trans)); | |||
CheckRes(trans->Write(&fRefNum, sizeof(int))); | |||
@@ -652,7 +653,7 @@ struct JackPortRenameRequest : public JackRequest | |||
strcpy(fName, name); | |||
} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(trans->Read(&fRefNum, sizeof(int))); | |||
CheckRes(trans->Read(&fPort, sizeof(jack_port_id_t))); | |||
@@ -660,7 +661,7 @@ struct JackPortRenameRequest : public JackRequest | |||
return 0; | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackRequest::Write(trans)); | |||
CheckRes(trans->Write(&fRefNum, sizeof(int))); | |||
@@ -687,12 +688,12 @@ struct JackSetBufferSizeRequest : public JackRequest | |||
: JackRequest(JackRequest::kSetBufferSize), fBufferSize(buffer_size) | |||
{} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
return trans->Read(&fBufferSize, sizeof(jack_nframes_t)); | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackRequest::Write(trans)); | |||
return trans->Write(&fBufferSize, sizeof(jack_nframes_t)); | |||
@@ -715,12 +716,12 @@ struct JackSetFreeWheelRequest : public JackRequest | |||
: JackRequest(JackRequest::kSetFreeWheel), fOnOff(onoff) | |||
{} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
return trans->Read(&fOnOff, sizeof(int)); | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackRequest::Write(trans)); | |||
return trans->Write(&fOnOff, sizeof(int)); | |||
@@ -739,12 +740,12 @@ struct JackComputeTotalLatenciesRequest : public JackRequest | |||
: JackRequest(JackRequest::kComputeTotalLatencies) | |||
{} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
return 0; | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackRequest::Write(trans)); | |||
return 0; | |||
@@ -767,12 +768,12 @@ struct JackReleaseTimebaseRequest : public JackRequest | |||
: JackRequest(JackRequest::kReleaseTimebase), fRefNum(refnum) | |||
{} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
return trans->Read(&fRefNum, sizeof(int)); | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackRequest::Write(trans)); | |||
return trans->Write(&fRefNum, sizeof(int)); | |||
@@ -796,13 +797,13 @@ struct JackSetTimebaseCallbackRequest : public JackRequest | |||
: JackRequest(JackRequest::kSetTimebaseCallback), fRefNum(refnum), fConditionnal(conditional) | |||
{} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(trans->Read(&fRefNum, sizeof(int))); | |||
return trans->Read(&fConditionnal, sizeof(int)); | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackRequest::Write(trans)); | |||
CheckRes(trans->Write(&fRefNum, sizeof(int))); | |||
@@ -827,13 +828,13 @@ struct JackGetInternalClientNameRequest : public JackRequest | |||
: JackRequest(JackRequest::kGetInternalClientName), fRefNum(refnum), fIntRefNum(int_ref) | |||
{} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(trans->Read(&fRefNum, sizeof(int))); | |||
return trans->Read(&fIntRefNum, sizeof(int)); | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackRequest::Write(trans)); | |||
CheckRes(trans->Write(&fRefNum, sizeof(int))); | |||
@@ -859,14 +860,14 @@ struct JackGetInternalClientNameResult : public JackResult | |||
snprintf(fName, sizeof(fName), "%s", name); | |||
} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackResult::Read(trans)); | |||
CheckRes(trans->Read(&fName, sizeof(fName))); | |||
return 0; | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackResult::Write(trans)); | |||
CheckRes(trans->Write(&fName, sizeof(fName))); | |||
@@ -893,13 +894,13 @@ struct JackInternalClientHandleRequest : public JackRequest | |||
snprintf(fName, sizeof(fName), "%s", client_name); | |||
} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(trans->Read(&fRefNum, sizeof(int))); | |||
return trans->Read(&fName, sizeof(fName)); | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackRequest::Write(trans)); | |||
CheckRes(trans->Write(&fRefNum, sizeof(int))); | |||
@@ -924,7 +925,7 @@ struct JackInternalClientHandleResult : public JackResult | |||
: JackResult(result), fStatus(status), fIntRefNum(int_ref) | |||
{} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackResult::Read(trans)); | |||
CheckRes(trans->Read(&fStatus, sizeof(int))); | |||
@@ -932,7 +933,7 @@ struct JackInternalClientHandleResult : public JackResult | |||
return 0; | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackResult::Write(trans)); | |||
CheckRes(trans->Write(&fStatus, sizeof(int))); | |||
@@ -971,7 +972,7 @@ struct JackInternalClientLoadRequest : public JackRequest | |||
snprintf(fLoadInitName, sizeof(fLoadInitName), "%s", objet_data); | |||
} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(trans->Read(&fRefNum, sizeof(int))); | |||
CheckRes(trans->Read(&fName, sizeof(fName))); | |||
@@ -981,7 +982,7 @@ struct JackInternalClientLoadRequest : public JackRequest | |||
return trans->Read(&fOptions, sizeof(int)); | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackRequest::Write(trans)); | |||
CheckRes(trans->Write(&fRefNum, sizeof(int))); | |||
@@ -1010,7 +1011,7 @@ struct JackInternalClientLoadResult : public JackResult | |||
: JackResult(result), fStatus(status), fIntRefNum(int_ref) | |||
{} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackResult::Read(trans)); | |||
CheckRes(trans->Read(&fStatus, sizeof(int))); | |||
@@ -1018,7 +1019,7 @@ struct JackInternalClientLoadResult : public JackResult | |||
return 0; | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackResult::Write(trans)); | |||
CheckRes(trans->Write(&fStatus, sizeof(int))); | |||
@@ -1044,13 +1045,13 @@ struct JackInternalClientUnloadRequest : public JackRequest | |||
: JackRequest(JackRequest::kInternalClientUnload), fRefNum(refnum), fIntRefNum(int_ref) | |||
{} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(trans->Read(&fRefNum, sizeof(int))); | |||
return trans->Read(&fIntRefNum, sizeof(int)); | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackRequest::Write(trans)); | |||
CheckRes(trans->Write(&fRefNum, sizeof(int))); | |||
@@ -1073,14 +1074,14 @@ struct JackInternalClientUnloadResult : public JackResult | |||
: JackResult(result), fStatus(status) | |||
{} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackResult::Read(trans)); | |||
CheckRes(trans->Read(&fStatus, sizeof(int))); | |||
return 0; | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackResult::Write(trans)); | |||
CheckRes(trans->Write(&fStatus, sizeof(int))); | |||
@@ -1106,7 +1107,7 @@ struct JackClientNotificationRequest : public JackRequest | |||
: JackRequest(JackRequest::kNotification), fRefNum(refnum), fNotify(notify), fValue(value) | |||
{} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(trans->Read(&fRefNum, sizeof(int))); | |||
CheckRes(trans->Read(&fNotify, sizeof(int))); | |||
@@ -1114,7 +1115,7 @@ struct JackClientNotificationRequest : public JackRequest | |||
return 0; | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackRequest::Write(trans)); | |||
CheckRes(trans->Write(&fRefNum, sizeof(int))); | |||
@@ -1156,7 +1157,7 @@ struct JackSessionNotifyResult : public JackResult | |||
: JackResult(result), fDone(false) | |||
{} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
if (trans == NULL) | |||
{ | |||
@@ -1183,7 +1184,7 @@ struct JackSessionNotifyResult : public JackResult | |||
return 0; | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
if (trans == NULL) | |||
{ | |||
@@ -1257,7 +1258,7 @@ struct JackSessionNotifyRequest : public JackRequest | |||
} | |||
} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(trans->Read(&fRefNum, sizeof(fRefNum))); | |||
CheckRes(trans->Read(&fPath, sizeof(fPath))); | |||
@@ -1266,7 +1267,7 @@ struct JackSessionNotifyRequest : public JackRequest | |||
return 0; | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackRequest::Write(trans)); | |||
CheckRes(trans->Write(&fRefNum, sizeof(fRefNum))); | |||
@@ -1289,13 +1290,13 @@ struct JackSessionReplyRequest : public JackRequest | |||
: JackRequest(JackRequest::kSessionReply), fRefNum(refnum) | |||
{} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(trans->Read(&fRefNum, sizeof(fRefNum))); | |||
return 0; | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackRequest::Write(trans)); | |||
CheckRes(trans->Write(&fRefNum, sizeof(fRefNum))); | |||
@@ -1316,14 +1317,14 @@ struct JackClientNameResult : public JackResult | |||
snprintf(fName, sizeof(fName), "%s", name); | |||
} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackResult::Read(trans)); | |||
CheckRes(trans->Read(&fName, sizeof(fName))); | |||
return 0; | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackResult::Write(trans)); | |||
CheckRes(trans->Write(&fName, sizeof(fName))); | |||
@@ -1344,14 +1345,14 @@ struct JackUUIDResult : public JackResult | |||
snprintf(fUUID, sizeof(fUUID), "%s", uuid); | |||
} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackResult::Read(trans)); | |||
CheckRes(trans->Read(&fUUID, sizeof(fUUID))); | |||
return 0; | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackResult::Write(trans)); | |||
CheckRes(trans->Write(&fUUID, sizeof(fUUID))); | |||
@@ -1373,13 +1374,13 @@ struct JackGetUUIDRequest : public JackRequest | |||
strncpy(fName, client_name, sizeof(fName)); | |||
} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(trans->Read(&fName, sizeof(fName))); | |||
return 0; | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackRequest::Write(trans)); | |||
CheckRes(trans->Write(&fName, sizeof(fName))); | |||
@@ -1401,13 +1402,13 @@ struct JackGetClientNameRequest : public JackRequest | |||
strncpy(fUUID, uuid, sizeof(fUUID)); | |||
} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(trans->Read(&fUUID, sizeof(fUUID))); | |||
return 0; | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackRequest::Write(trans)); | |||
CheckRes(trans->Write(&fUUID, sizeof(fUUID))); | |||
@@ -1432,7 +1433,7 @@ struct JackReserveNameRequest : public JackRequest | |||
strncpy(fUUID, uuid, sizeof(fUUID)); | |||
} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(trans->Read(&fUUID, sizeof(fUUID))); | |||
CheckRes(trans->Read(&fName, sizeof(fName))); | |||
@@ -1440,7 +1441,7 @@ struct JackReserveNameRequest : public JackRequest | |||
return 0; | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackRequest::Write(trans)); | |||
CheckRes(trans->Write(&fUUID, sizeof(fUUID))); | |||
@@ -1464,13 +1465,13 @@ struct JackClientHasSessionCallbackRequest : public JackRequest | |||
strncpy(fName, name, sizeof(fName)); | |||
} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(trans->Read(&fName, sizeof(fName))); | |||
return 0; | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(JackRequest::Write(trans)); | |||
CheckRes(trans->Write(&fName, sizeof(fName))); | |||
@@ -1502,7 +1503,7 @@ struct JackClientNotification | |||
snprintf(fMessage, sizeof(fMessage), "%s", message); | |||
} | |||
int Read(JackChannelTransaction* trans) | |||
int Read(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(trans->Read(&fName, sizeof(fName))); | |||
CheckRes(trans->Read(&fRefNum, sizeof(int))); | |||
@@ -1514,7 +1515,7 @@ struct JackClientNotification | |||
return 0; | |||
} | |||
int Write(JackChannelTransaction* trans) | |||
int Write(detail::JackChannelTransactionInterface* trans) | |||
{ | |||
CheckRes(trans->Write(&fName, sizeof(fName))); | |||
CheckRes(trans->Write(&fRefNum, sizeof(int))); | |||
@@ -56,6 +56,7 @@ def build(bld): | |||
'JackMidiAPI.cpp', | |||
'JackEngineControl.cpp', | |||
'JackShmMem.cpp', | |||
'JackGenericClientChannel.cpp', | |||
'shm.c', | |||
'JackGlobals.cpp', | |||
'JackDebugClient.cpp', | |||
@@ -12,7 +12,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
GNU Lesser General Public License for more details. | |||
You should have received a copy of the GNU Lesser General Public License | |||
along with this program; if not, write to the Free Software | |||
along with this program; if not, write to the Free Software | |||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
*/ | |||
@@ -28,7 +28,7 @@ namespace Jack | |||
{ | |||
struct JackRequest; | |||
struct JackResult; | |||
class JackPosixMutex; | |||
class JackPosixThread; | |||
class JackFifo; | |||
@@ -58,14 +58,16 @@ namespace Jack { typedef JackFifo JackSynchro; } | |||
namespace Jack { typedef JackPosixSemaphore JackSynchro; } | |||
/* __JackPlatformChannelTransaction__ */ | |||
/* | |||
#include "JackSocket.h" | |||
namespace Jack { typedef JackClientSocket JackChannelTransaction; } | |||
*/ | |||
#include "JackProcessSync.h" | |||
/* __JackPlatformProcessSync__ */ | |||
/* Only on windows a special JackProcessSync is used. It is directly defined by including JackProcessSync.h here */ | |||
/* __JackPlatformServerChannel__ */ | |||
/* __JackPlatformServerChannel__ */ | |||
#include "JackSocketServerChannel.h" | |||
namespace Jack { typedef JackSocketServerChannel JackServerChannel; } | |||
@@ -64,12 +64,6 @@ namespace Jack { typedef JackMachThread JackThread; } | |||
namespace Jack { typedef JackMachSemaphore JackSynchro; } | |||
#endif | |||
#include "JackSocket.h" | |||
namespace Jack { typedef JackClientSocket JackChannelTransaction; } | |||
#include "JackSocket.h" | |||
namespace Jack { typedef JackClientSocket JackChannelTransaction; } | |||
/* __JackPlatformProcessSync__ */ | |||
#include "JackProcessSync.h" | |||
/* Only on windows a special JackProcessSync is used. It is directly defined by including JackProcessSync.h here */ | |||
@@ -109,6 +109,18 @@ | |||
/* Begin PBXBuildFile section */ | |||
4B0A28ED0D520852002EFF74 /* tw.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B0A28EC0D520852002EFF74 /* tw.c */; }; | |||
4B0A29260D52108E002EFF74 /* tw.c in Sources */ = {isa = PBXBuildFile; fileRef = 4B0A28EC0D520852002EFF74 /* tw.c */; }; | |||
4B1499F014BDA5B300A51A3C /* JackGenericClientChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B1499EE14BDA5B300A51A3C /* JackGenericClientChannel.cpp */; }; | |||
4B1499F114BDA5B300A51A3C /* JackGenericClientChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B1499EF14BDA5B300A51A3C /* JackGenericClientChannel.h */; }; | |||
4B1499F214BDA5B300A51A3C /* JackGenericClientChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B1499EE14BDA5B300A51A3C /* JackGenericClientChannel.cpp */; }; | |||
4B1499F314BDA5B300A51A3C /* JackGenericClientChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B1499EF14BDA5B300A51A3C /* JackGenericClientChannel.h */; }; | |||
4B1499F414BDA5B300A51A3C /* JackGenericClientChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B1499EE14BDA5B300A51A3C /* JackGenericClientChannel.cpp */; }; | |||
4B1499F514BDA5B300A51A3C /* JackGenericClientChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B1499EF14BDA5B300A51A3C /* JackGenericClientChannel.h */; }; | |||
4B1499F614BDA5B300A51A3C /* JackGenericClientChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B1499EE14BDA5B300A51A3C /* JackGenericClientChannel.cpp */; }; | |||
4B1499F714BDA5B300A51A3C /* JackGenericClientChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B1499EF14BDA5B300A51A3C /* JackGenericClientChannel.h */; }; | |||
4B1499F814BDA5B300A51A3C /* JackGenericClientChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B1499EE14BDA5B300A51A3C /* JackGenericClientChannel.cpp */; }; | |||
4B1499F914BDA5B300A51A3C /* JackGenericClientChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B1499EF14BDA5B300A51A3C /* JackGenericClientChannel.h */; }; | |||
4B1499FA14BDA5B300A51A3C /* JackGenericClientChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B1499EE14BDA5B300A51A3C /* JackGenericClientChannel.cpp */; }; | |||
4B1499FB14BDA5B300A51A3C /* JackGenericClientChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B1499EF14BDA5B300A51A3C /* JackGenericClientChannel.h */; }; | |||
4B193991133F321500547810 /* JackFilters.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B193990133F321500547810 /* JackFilters.h */; }; | |||
4B193992133F321500547810 /* JackFilters.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B193990133F321500547810 /* JackFilters.h */; }; | |||
4B193993133F321500547810 /* JackFilters.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B193990133F321500547810 /* JackFilters.h */; }; | |||
@@ -1586,6 +1598,8 @@ | |||
4B0A28E60D52073D002EFF74 /* jack_thread_wait */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_thread_wait; sourceTree = BUILT_PRODUCTS_DIR; }; | |||
4B0A28EC0D520852002EFF74 /* tw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tw.c; path = "../example-clients/tw.c"; sourceTree = SOURCE_ROOT; }; | |||
4B0A292D0D52108E002EFF74 /* jack_thread_wait */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = jack_thread_wait; sourceTree = BUILT_PRODUCTS_DIR; }; | |||
4B1499EE14BDA5B300A51A3C /* JackGenericClientChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackGenericClientChannel.cpp; path = ../common/JackGenericClientChannel.cpp; sourceTree = SOURCE_ROOT; }; | |||
4B1499EF14BDA5B300A51A3C /* JackGenericClientChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackGenericClientChannel.h; path = ../common/JackGenericClientChannel.h; sourceTree = SOURCE_ROOT; }; | |||
4B193931133F311400547810 /* JackMidiAsyncQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackMidiAsyncQueue.cpp; path = ../common/JackMidiAsyncQueue.cpp; sourceTree = SOURCE_ROOT; }; | |||
4B193932133F311400547810 /* JackMidiAsyncQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackMidiAsyncQueue.h; path = ../common/JackMidiAsyncQueue.h; sourceTree = SOURCE_ROOT; }; | |||
4B19393B133F313000547810 /* JackMidiAsyncWaitQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackMidiAsyncWaitQueue.cpp; path = ../common/JackMidiAsyncWaitQueue.cpp; sourceTree = SOURCE_ROOT; }; | |||
@@ -3245,6 +3259,8 @@ | |||
4BA550FF05E2423600569492 /* Channels */ = { | |||
isa = PBXGroup; | |||
children = ( | |||
4B1499EE14BDA5B300A51A3C /* JackGenericClientChannel.cpp */, | |||
4B1499EF14BDA5B300A51A3C /* JackGenericClientChannel.h */, | |||
4BF8D1AF0834EEC400C94B91 /* JackChannel.h */, | |||
4BB371D40C1AD85A0050C1E4 /* JackNotification.h */, | |||
4BF8D1B30834EED500C94B91 /* JackInternalClientChannel.h */, | |||
@@ -3553,6 +3569,7 @@ | |||
4B193993133F321500547810 /* JackFilters.h in Headers */, | |||
4B49D44614865F22003390F8 /* net.h in Headers */, | |||
4B49D44714865F22003390F8 /* session.h in Headers */, | |||
4B1499F714BDA5B300A51A3C /* JackGenericClientChannel.h in Headers */, | |||
); | |||
runOnlyForDeploymentPostprocessing = 0; | |||
}; | |||
@@ -3637,6 +3654,7 @@ | |||
4B21795213E2EEA60095B3E5 /* JackTimedDriver.h in Headers */, | |||
4B49D44A14865F22003390F8 /* net.h in Headers */, | |||
4B49D44B14865F22003390F8 /* session.h in Headers */, | |||
4B1499F114BDA5B300A51A3C /* JackGenericClientChannel.h in Headers */, | |||
); | |||
runOnlyForDeploymentPostprocessing = 0; | |||
}; | |||
@@ -3935,6 +3953,7 @@ | |||
4B193994133F321500547810 /* JackFilters.h in Headers */, | |||
4B49D44814865F22003390F8 /* net.h in Headers */, | |||
4B49D44914865F22003390F8 /* session.h in Headers */, | |||
4B1499F914BDA5B300A51A3C /* JackGenericClientChannel.h in Headers */, | |||
); | |||
runOnlyForDeploymentPostprocessing = 0; | |||
}; | |||
@@ -4029,6 +4048,7 @@ | |||
4B193991133F321500547810 /* JackFilters.h in Headers */, | |||
4B49D44414865F22003390F8 /* net.h in Headers */, | |||
4B49D44514865F22003390F8 /* session.h in Headers */, | |||
4B1499F514BDA5B300A51A3C /* JackGenericClientChannel.h in Headers */, | |||
); | |||
runOnlyForDeploymentPostprocessing = 0; | |||
}; | |||
@@ -4116,6 +4136,7 @@ | |||
4B21795013E2EEA60095B3E5 /* JackTimedDriver.h in Headers */, | |||
4B49D44214865F22003390F8 /* net.h in Headers */, | |||
4B49D44314865F22003390F8 /* session.h in Headers */, | |||
4B1499FB14BDA5B300A51A3C /* JackGenericClientChannel.h in Headers */, | |||
); | |||
runOnlyForDeploymentPostprocessing = 0; | |||
}; | |||
@@ -4338,6 +4359,7 @@ | |||
4B21795413E2EEA60095B3E5 /* JackTimedDriver.h in Headers */, | |||
4B49D44C14865F22003390F8 /* net.h in Headers */, | |||
4B49D44D14865F22003390F8 /* session.h in Headers */, | |||
4B1499F314BDA5B300A51A3C /* JackGenericClientChannel.h in Headers */, | |||
); | |||
runOnlyForDeploymentPostprocessing = 0; | |||
}; | |||
@@ -7072,6 +7094,7 @@ | |||
4B8A38F1117B827E00664E07 /* JackSocketClientChannel.cpp in Sources */, | |||
4B8A38F6117B82AB00664E07 /* JackSocket.cpp in Sources */, | |||
4B327BAB14B4B50400976483 /* JackPosixMutex.cpp in Sources */, | |||
4B1499F614BDA5B300A51A3C /* JackGenericClientChannel.cpp in Sources */, | |||
); | |||
runOnlyForDeploymentPostprocessing = 0; | |||
}; | |||
@@ -7142,6 +7165,7 @@ | |||
4B21795113E2EEA60095B3E5 /* JackTimedDriver.cpp in Sources */, | |||
4B67AB8E14B4B03800B4AA9A /* JackException.cpp in Sources */, | |||
4B327BA814B4B50400976483 /* JackPosixMutex.cpp in Sources */, | |||
4B1499F014BDA5B300A51A3C /* JackGenericClientChannel.cpp in Sources */, | |||
); | |||
runOnlyForDeploymentPostprocessing = 0; | |||
}; | |||
@@ -7454,6 +7478,7 @@ | |||
4B47ACCE10B5890100469C67 /* JackMachTime.c in Sources */, | |||
4B47ACCF10B5890100469C67 /* JackProcessSync.cpp in Sources */, | |||
4B327BAC14B4B50400976483 /* JackPosixMutex.cpp in Sources */, | |||
4B1499F814BDA5B300A51A3C /* JackGenericClientChannel.cpp in Sources */, | |||
); | |||
runOnlyForDeploymentPostprocessing = 0; | |||
}; | |||
@@ -7538,6 +7563,7 @@ | |||
4B2209EC12F6BC2100E5DC26 /* JackSocket.cpp in Sources */, | |||
4B2209EE12F6BC2300E5DC26 /* JackSocketClientChannel.cpp in Sources */, | |||
4B327BAA14B4B50400976483 /* JackPosixMutex.cpp in Sources */, | |||
4B1499F414BDA5B300A51A3C /* JackGenericClientChannel.cpp in Sources */, | |||
); | |||
runOnlyForDeploymentPostprocessing = 0; | |||
}; | |||
@@ -7608,6 +7634,7 @@ | |||
4B21794F13E2EEA60095B3E5 /* JackTimedDriver.cpp in Sources */, | |||
4B67AB8D14B4B03800B4AA9A /* JackException.cpp in Sources */, | |||
4B327BA714B4B50400976483 /* JackPosixMutex.cpp in Sources */, | |||
4B1499FA14BDA5B300A51A3C /* JackGenericClientChannel.cpp in Sources */, | |||
); | |||
runOnlyForDeploymentPostprocessing = 0; | |||
}; | |||
@@ -7834,6 +7861,7 @@ | |||
4B21795313E2EEA60095B3E5 /* JackTimedDriver.cpp in Sources */, | |||
4B67AB8F14B4B03800B4AA9A /* JackException.cpp in Sources */, | |||
4B327BA914B4B50400976483 /* JackPosixMutex.cpp in Sources */, | |||
4B1499F214BDA5B300A51A3C /* JackGenericClientChannel.cpp in Sources */, | |||
); | |||
runOnlyForDeploymentPostprocessing = 0; | |||
}; | |||
@@ -36,7 +36,7 @@ static void BuildName(const char* client_name, char* res, const char* dir, int w | |||
sprintf(res, "%s/jack_%s_%d_%d", dir, ext_client_name, JackTools::GetUID(), which); | |||
} | |||
JackClientSocket::JackClientSocket(int socket): fSocket(socket),fTimeOut(0) | |||
JackClientSocket::JackClientSocket(int socket): JackClientRequestInterface(), fSocket(socket),fTimeOut(0) | |||
{} | |||
#if defined(__sun__) || defined(sun) | |||
@@ -12,7 +12,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
GNU Lesser General Public License for more details. | |||
You should have received a copy of the GNU Lesser General Public License | |||
along with this program; if not, write to the Free Software | |||
along with this program; if not, write to the Free Software | |||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
*/ | |||
@@ -23,12 +23,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
#include <sys/types.h> | |||
#include <sys/un.h> | |||
#include <sys/socket.h> | |||
#include <sys/ioctl.h> | |||
#include <sys/ioctl.h> | |||
#include <sys/time.h> | |||
#include <arpa/inet.h> | |||
#include <errno.h> | |||
#include <unistd.h> | |||
#include "JackChannel.h" | |||
namespace Jack | |||
{ | |||
@@ -36,17 +38,17 @@ namespace Jack | |||
\brief Client socket. | |||
*/ | |||
class JackClientSocket | |||
class JackClientSocket : public detail::JackClientRequestInterface | |||
{ | |||
private: | |||
int fSocket; | |||
int fTimeOut; | |||
public: | |||
JackClientSocket(): fSocket( -1),fTimeOut(0) | |||
JackClientSocket():JackClientRequestInterface(), fSocket( -1),fTimeOut(0) | |||
{} | |||
JackClientSocket(int socket); | |||
@@ -60,7 +62,7 @@ class JackClientSocket | |||
} | |||
void SetReadTimeOut(long sec); | |||
void SetWriteTimeOut(long sec); | |||
void SetNonBlocking(bool onoff); | |||
}; | |||
@@ -26,38 +26,25 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
namespace Jack | |||
{ | |||
JackSocketClientChannel::JackSocketClientChannel(): | |||
fThread(this) | |||
JackSocketClientChannel::JackSocketClientChannel() | |||
:JackGenericClientChannel(), fThread(this) | |||
{ | |||
fRequest = new JackClientSocket(); | |||
fNotificationSocket = NULL; | |||
fClient = NULL; | |||
} | |||
JackSocketClientChannel::~JackSocketClientChannel() | |||
{ | |||
delete fRequest; | |||
delete fNotificationSocket; | |||
} | |||
int JackSocketClientChannel::ServerCheck(const char* server_name) | |||
{ | |||
jack_log("JackSocketClientChannel::ServerCheck = %s", server_name); | |||
// Connect to server | |||
if (fRequestSocket.Connect(jack_server_dir, server_name, 0) < 0) { | |||
jack_error("Cannot connect to server socket"); | |||
fRequestSocket.Close(); | |||
return -1; | |||
} else { | |||
return 0; | |||
} | |||
} | |||
int JackSocketClientChannel::Open(const char* server_name, const char* name, int uuid, char* name_res, JackClient* obj, jack_options_t options, jack_status_t* status) | |||
{ | |||
int result = 0; | |||
jack_log("JackSocketClientChannel::Open name = %s", name); | |||
if (fRequestSocket.Connect(jack_server_dir, server_name, 0) < 0) { | |||
if (fRequest->Connect(jack_server_dir, server_name, 0) < 0) { | |||
jack_error("Cannot connect to server socket"); | |||
goto error; | |||
} | |||
@@ -83,14 +70,14 @@ int JackSocketClientChannel::Open(const char* server_name, const char* name, int | |||
return 0; | |||
error: | |||
fRequestSocket.Close(); | |||
fRequest->Close(); | |||
fNotificationListenSocket.Close(); | |||
return -1; | |||
} | |||
void JackSocketClientChannel::Close() | |||
{ | |||
fRequestSocket.Close(); | |||
fRequest->Close(); | |||
fNotificationListenSocket.Close(); | |||
if (fNotificationSocket) | |||
fNotificationSocket->Close(); | |||
@@ -116,238 +103,6 @@ void JackSocketClientChannel::Stop() | |||
fThread.Kill(); | |||
} | |||
void JackSocketClientChannel::ServerSyncCall(JackRequest* req, JackResult* res, int* result) | |||
{ | |||
if (req->Write(&fRequestSocket) < 0) { | |||
jack_error("Could not write request type = %ld", req->fType); | |||
*result = -1; | |||
return; | |||
} | |||
if (res->Read(&fRequestSocket) < 0) { | |||
jack_error("Could not read result type = %ld", req->fType); | |||
*result = -1; | |||
return; | |||
} | |||
*result = res->fResult; | |||
} | |||
void JackSocketClientChannel::ServerAsyncCall(JackRequest* req, JackResult* res, int* result) | |||
{ | |||
if (req->Write(&fRequestSocket) < 0) { | |||
jack_error("Could not write request type = %ld", req->fType); | |||
*result = -1; | |||
} else { | |||
*result = 0; | |||
} | |||
} | |||
void JackSocketClientChannel::ClientCheck(const char* name, int uuid, char* name_res, int protocol, int options, int* status, int* result, int open) | |||
{ | |||
JackClientCheckRequest req(name, protocol, options, uuid, open); | |||
JackClientCheckResult res; | |||
ServerSyncCall(&req, &res, result); | |||
*status = res.fStatus; | |||
strcpy(name_res, res.fName); | |||
} | |||
void JackSocketClientChannel::ClientOpen(const char* name, int pid, int uuid, int* shared_engine, int* shared_client, int* shared_graph, int* result) | |||
{ | |||
JackClientOpenRequest req(name, pid, uuid); | |||
JackClientOpenResult res; | |||
ServerSyncCall(&req, &res, result); | |||
*shared_engine = res.fSharedEngine; | |||
*shared_client = res.fSharedClient; | |||
*shared_graph = res.fSharedGraph; | |||
} | |||
void JackSocketClientChannel::ClientClose(int refnum, int* result) | |||
{ | |||
JackClientCloseRequest req(refnum); | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackSocketClientChannel::ClientActivate(int refnum, int is_real_time, int* result) | |||
{ | |||
JackActivateRequest req(refnum, is_real_time); | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackSocketClientChannel::ClientDeactivate(int refnum, int* result) | |||
{ | |||
JackDeactivateRequest req(refnum); | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackSocketClientChannel::PortRegister(int refnum, const char* name, const char* type, unsigned int flags, unsigned int buffer_size, jack_port_id_t* port_index, int* result) | |||
{ | |||
JackPortRegisterRequest req(refnum, name, type, flags, buffer_size); | |||
JackPortRegisterResult res; | |||
ServerSyncCall(&req, &res, result); | |||
*port_index = res.fPortIndex; | |||
} | |||
void JackSocketClientChannel::PortUnRegister(int refnum, jack_port_id_t port_index, int* result) | |||
{ | |||
JackPortUnRegisterRequest req(refnum, port_index); | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackSocketClientChannel::PortConnect(int refnum, const char* src, const char* dst, int* result) | |||
{ | |||
JackPortConnectNameRequest req(refnum, src, dst); | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackSocketClientChannel::PortDisconnect(int refnum, const char* src, const char* dst, int* result) | |||
{ | |||
JackPortDisconnectNameRequest req(refnum, src, dst); | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackSocketClientChannel::PortConnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result) | |||
{ | |||
JackPortConnectRequest req(refnum, src, dst); | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackSocketClientChannel::PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result) | |||
{ | |||
JackPortDisconnectRequest req(refnum, src, dst); | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackSocketClientChannel::PortRename(int refnum, jack_port_id_t port, const char* name, int* result) | |||
{ | |||
JackPortRenameRequest req(refnum, port, name); | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackSocketClientChannel::SetBufferSize(jack_nframes_t buffer_size, int* result) | |||
{ | |||
JackSetBufferSizeRequest req(buffer_size); | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackSocketClientChannel::SetFreewheel(int onoff, int* result) | |||
{ | |||
JackSetFreeWheelRequest req(onoff); | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackSocketClientChannel::ComputeTotalLatencies(int* result) | |||
{ | |||
JackComputeTotalLatenciesRequest req; | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackSocketClientChannel::SessionNotify(int refnum, const char* target, jack_session_event_type_t type, const char* path, jack_session_command_t** result) | |||
{ | |||
JackSessionNotifyRequest req(refnum, path, type, target); | |||
JackSessionNotifyResult res; | |||
int intresult; | |||
ServerSyncCall(&req, &res, &intresult); | |||
*result = res.GetCommands(); | |||
} | |||
void JackSocketClientChannel::SessionReply(int refnum, int* result) | |||
{ | |||
JackSessionReplyRequest req(refnum); | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackSocketClientChannel::GetUUIDForClientName(int refnum, const char* client_name, char* uuid_res, int* result) | |||
{ | |||
JackGetUUIDRequest req(client_name); | |||
JackUUIDResult res; | |||
ServerSyncCall(&req, &res, result); | |||
strncpy(uuid_res, res.fUUID, JACK_UUID_SIZE); | |||
} | |||
void JackSocketClientChannel::GetClientNameForUUID(int refnum, const char* uuid, char* name_res, int* result) | |||
{ | |||
JackGetClientNameRequest req(uuid); | |||
JackClientNameResult res; | |||
ServerSyncCall(&req, &res, result); | |||
strncpy(name_res, res.fName, JACK_CLIENT_NAME_SIZE); | |||
} | |||
void JackSocketClientChannel::ClientHasSessionCallback(const char* client_name, int* result) | |||
{ | |||
JackClientHasSessionCallbackRequest req(client_name); | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackSocketClientChannel::ReserveClientName(int refnum, const char* client_name, const char* uuid, int* result) | |||
{ | |||
JackReserveNameRequest req(refnum, client_name, uuid); | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackSocketClientChannel::ReleaseTimebase(int refnum, int* result) | |||
{ | |||
JackReleaseTimebaseRequest req(refnum); | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackSocketClientChannel::SetTimebaseCallback(int refnum, int conditional, int* result) | |||
{ | |||
JackSetTimebaseCallbackRequest req(refnum, conditional); | |||
JackResult res; | |||
ServerSyncCall(&req, &res, result); | |||
} | |||
void JackSocketClientChannel::GetInternalClientName(int refnum, int int_ref, char* name_res, int* result) | |||
{ | |||
JackGetInternalClientNameRequest req(refnum, int_ref); | |||
JackGetInternalClientNameResult res; | |||
ServerSyncCall(&req, &res, result); | |||
strcpy(name_res, res.fName); | |||
} | |||
void JackSocketClientChannel::InternalClientHandle(int refnum, const char* client_name, int* status, int* int_ref, int* result) | |||
{ | |||
JackInternalClientHandleRequest req(refnum, client_name); | |||
JackInternalClientHandleResult res; | |||
ServerSyncCall(&req, &res, result); | |||
*int_ref = res.fIntRefNum; | |||
*status = res.fStatus; | |||
} | |||
void JackSocketClientChannel::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) | |||
{ | |||
JackInternalClientLoadRequest req(refnum, client_name, so_name, objet_data, options, uuid); | |||
JackInternalClientLoadResult res; | |||
ServerSyncCall(&req, &res, result); | |||
*int_ref = res.fIntRefNum; | |||
*status = res.fStatus; | |||
} | |||
void JackSocketClientChannel::InternalClientUnload(int refnum, int int_ref, int* status, int* result) | |||
{ | |||
JackInternalClientUnloadRequest req(refnum, int_ref); | |||
JackInternalClientUnloadResult res; | |||
ServerSyncCall(&req, &res, result); | |||
*status = res.fStatus; | |||
} | |||
bool JackSocketClientChannel::Init() | |||
{ | |||
jack_log("JackSocketClientChannel::Init"); | |||
@@ -20,10 +20,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |||
#ifndef __JackSocketClientChannel__ | |||
#define __JackSocketClientChannel__ | |||
#include "JackChannel.h" | |||
#include "JackGenericClientChannel.h" | |||
#include "JackSocket.h" | |||
#include "JackPlatformPlug.h" | |||
#include "JackRequest.h" | |||
#include "JackThread.h" | |||
namespace Jack | |||
{ | |||
@@ -32,19 +32,14 @@ namespace Jack | |||
\brief JackClientChannel using sockets. | |||
*/ | |||
class JackSocketClientChannel : public detail::JackClientChannelInterface, public JackRunnableInterface | |||
class JackSocketClientChannel : public JackGenericClientChannel, public JackRunnableInterface | |||
{ | |||
private: | |||
JackClientSocket fRequestSocket; // Socket to communicate with the server | |||
JackServerSocket fNotificationListenSocket; // Socket listener for server notification | |||
JackClientSocket* fNotificationSocket; // Socket for server notification | |||
JackThread fThread; // Thread to execute the event loop | |||
JackClient* fClient; | |||
void ServerSyncCall(JackRequest* req, JackResult* res, int* result); | |||
void ServerAsyncCall(JackRequest* req, JackResult* res, int* result); | |||
public: | |||
@@ -57,49 +52,6 @@ class JackSocketClientChannel : public detail::JackClientChannelInterface, publi | |||
int Start(); | |||
void Stop(); | |||
int ServerCheck(const char* server_name); | |||
void ClientCheck(const char* name, int uuid, char* name_res, int protocol, int options, int* status, int* result, int open); | |||
void ClientOpen(const char* name, int pid, int uuid, int* shared_engine, int* shared_client, int* shared_graph, int* result); | |||
void ClientOpen(const char* name, int* ref, int uuid, JackEngineControl** shared_engine, JackGraphManager** shared_manager, JackClientInterface* client, int* result) | |||
{} | |||
void ClientClose(int refnum, int* result); | |||
void ClientActivate(int refnum, int is_real_time, int* result); | |||
void ClientDeactivate(int refnum, int* result); | |||
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); | |||
void PortUnRegister(int refnum, jack_port_id_t port_index, int* result); | |||
void PortConnect(int refnum, const char* src, const char* dst, int* result); | |||
void PortDisconnect(int refnum, const char* src, const char* dst, int* result); | |||
void PortConnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result); | |||
void PortDisconnect(int refnum, jack_port_id_t src, jack_port_id_t dst, int* result); | |||
void PortRename(int refnum, jack_port_id_t port, const char* name, int* result); | |||
void SetBufferSize(jack_nframes_t buffer_size, int* result); | |||
void SetFreewheel(int onoff, int* result); | |||
void ComputeTotalLatencies(int* result); | |||
void ReleaseTimebase(int refnum, int* result); | |||
void SetTimebaseCallback(int refnum, int conditional, int* result); | |||
void GetInternalClientName(int refnum, int int_ref, char* name_res, int* result); | |||
void InternalClientHandle(int refnum, const char* client_name, int* status, int* int_ref, int* result); | |||
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); | |||
void InternalClientUnload(int refnum, int int_ref, int* status, int* result); | |||
// Session API | |||
void SessionNotify(int refnum, const char* target, jack_session_event_type_t type, const char* path, jack_session_command_t** result); | |||
void SessionReply(int refnum, int* result); | |||
void GetUUIDForClientName(int refnum, const char* client_name, char* uuid_res, int* result); | |||
void GetClientNameForUUID(int refnum, const char* uuid, char* name_res, int* result); | |||
void ReserveClientName(int refnum, const char* client_name, const char *uuid, int* result); | |||
void ClientHasSessionCallback(const char* client_name, int* result); | |||
// JackRunnableInterface interface | |||
bool Init(); | |||
bool Execute(); | |||
@@ -477,8 +477,8 @@ int process4(jack_nframes_t nframes, void *arg) | |||
jack_nframes_t delta_time = cur_time - last_time; | |||
Log("calling process4 callback : jack_frame_time = %ld delta_time = %ld\n", cur_time, delta_time); | |||
if (delta_time > 0 && (jack_nframes_t)abs((double)(delta_time - cur_buffer_size)) > tolerance) { | |||
printf("!!! ERROR !!! jack_frame_time seems to return incorrect values cur_buffer_size = %d, delta_time = %d\n", cur_buffer_size, delta_time); | |||
if (delta_time > 0 && (jack_nframes_t)abs(delta_time - cur_buffer_size) > tolerance) { | |||
printf("!!! ERROR !!! jack_frame_time seems to return incorrect values cur_buffer_size = %d, delta_time = %d tolerance %d\n", cur_buffer_size, delta_time, tolerance); | |||
} | |||
last_time = cur_time; | |||
@@ -27,25 +27,15 @@ | |||
namespace Jack | |||
{ | |||
JackWinNamedPipeClientChannel::JackWinNamedPipeClientChannel():fThread(this) | |||
JackWinNamedPipeClientChannel::JackWinNamedPipeClientChannel() | |||
:JackGenericClientChannel(),fThread(this) | |||
{ | |||
fClient = NULL; | |||
fRequest = new JackWinNamedPipeClient(); | |||
} | |||
JackWinNamedPipeClientChannel::~JackWinNamedPipeClientChannel() | |||
{} | |||
int JackWinNamedPipeClientChannel::ServerCheck(const char* server_name) | |||
{ | |||
jack_log("JackWinNamedPipeClientChannel::ServerCheck = %s", server_name); | |||
// Connect to server | |||
if (fRequestPipe.Connect(jack_server_dir, server_name, 0) < 0) { | |||
jack_error("Cannot connect to server pipe"); | |||
return -1; | |||
} else { | |||
return 0; | |||
} | |||
delete fRequest; | |||
} | |||
int JackWinNamedPipeClientChannel::Open(const char* server_name, const char* name, int uuid, char* name_res, JackClient* obj, jack_options_t options, jack_status_t* status) | |||
@@ -54,14 +44,14 @@ int JackWinNamedPipeClientChannel::Open(const char* server_name, const char* nam | |||
jack_log("JackWinNamedPipeClientChannel::Open name = %s", name); | |||
/* | |||
16/08/07: was called before doing "fRequestPipe.Connect" .... still necessary? | |||
16/08/07: was called before doing "fRequest->Connect" .... still necessary? | |||
if (fNotificationListenPipe.Bind(jack_client_dir, name, 0) < 0) { | |||
jack_error("Cannot bind pipe"); | |||
goto error; | |||
} | |||
*/ | |||
if (fRequestPipe.Connect(jack_server_dir, server_name, 0) < 0) { | |||
if (fRequest->Connect(jack_server_dir, server_name, 0) < 0) { | |||
jack_error("Cannot connect to server pipe"); | |||
goto error; | |||
} | |||
@@ -86,14 +76,14 @@ int JackWinNamedPipeClientChannel::Open(const char* server_name, const char* nam | |||
return 0; | |||
error: | |||
fRequestPipe.Close(); | |||
fRequest->Close(); | |||
fNotificationListenPipe.Close(); | |||
return -1; | |||
} | |||
void JackWinNamedPipeClientChannel::Close() | |||