mirror of
https://github.com/debauchee/barrier.git
synced 2026-05-06 05:12:26 +08:00
skeleton for new ipc code.
This commit is contained in:
@@ -18,6 +18,7 @@ add_subdirectory(base)
|
||||
add_subdirectory(client)
|
||||
add_subdirectory(common)
|
||||
add_subdirectory(io)
|
||||
add_subdirectory(ipc)
|
||||
add_subdirectory(mt)
|
||||
add_subdirectory(net)
|
||||
add_subdirectory(platform)
|
||||
|
||||
31
src/lib/ipc/CIpcClient.cpp
Normal file
31
src/lib/ipc/CIpcClient.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2012 Nick Bolton
|
||||
*
|
||||
* This package is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* found in the file COPYING that should have accompanied this file.
|
||||
*
|
||||
* This package 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "CIpcClient.h"
|
||||
|
||||
CIpcClient::CIpcClient()
|
||||
{
|
||||
}
|
||||
|
||||
CIpcClient::~CIpcClient()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
CIpcClient::connect()
|
||||
{
|
||||
}
|
||||
31
src/lib/ipc/CIpcClient.h
Normal file
31
src/lib/ipc/CIpcClient.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2012 Nick Bolton
|
||||
*
|
||||
* This package is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* found in the file COPYING that should have accompanied this file.
|
||||
*
|
||||
* This package 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
//! IPC client for communication between daemon and GUI.
|
||||
/*!
|
||||
* See \ref CIpcServer description.
|
||||
*/
|
||||
class CIpcClient {
|
||||
public:
|
||||
CIpcClient();
|
||||
virtual ~CIpcClient();
|
||||
|
||||
//! Connects to the IPC server at localhost.
|
||||
void connect();
|
||||
};
|
||||
26
src/lib/ipc/CIpcClientProxy.cpp
Normal file
26
src/lib/ipc/CIpcClientProxy.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2012 Nick Bolton
|
||||
*
|
||||
* This package is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* found in the file COPYING that should have accompanied this file.
|
||||
*
|
||||
* This package 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "CIpcClientProxy.h"
|
||||
|
||||
CIpcClientProxy::CIpcClientProxy()
|
||||
{
|
||||
}
|
||||
|
||||
CIpcClientProxy::~CIpcClientProxy()
|
||||
{
|
||||
}
|
||||
24
src/lib/ipc/CIpcClientProxy.h
Normal file
24
src/lib/ipc/CIpcClientProxy.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2012 Nick Bolton
|
||||
*
|
||||
* This package is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* found in the file COPYING that should have accompanied this file.
|
||||
*
|
||||
* This package 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
class CIpcClientProxy {
|
||||
public:
|
||||
CIpcClientProxy();
|
||||
virtual ~CIpcClientProxy();
|
||||
};
|
||||
31
src/lib/ipc/CIpcServer.cpp
Normal file
31
src/lib/ipc/CIpcServer.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2012 Nick Bolton
|
||||
*
|
||||
* This package is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* found in the file COPYING that should have accompanied this file.
|
||||
*
|
||||
* This package 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "CIpcServer.h"
|
||||
|
||||
CIpcServer::CIpcServer()
|
||||
{
|
||||
}
|
||||
|
||||
CIpcServer::~CIpcServer()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
CIpcServer::listen()
|
||||
{
|
||||
}
|
||||
34
src/lib/ipc/CIpcServer.h
Normal file
34
src/lib/ipc/CIpcServer.h
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2012 Nick Bolton
|
||||
*
|
||||
* This package is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* found in the file COPYING that should have accompanied this file.
|
||||
*
|
||||
* This package 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
//! IPC server for communication between daemon and GUI.
|
||||
/*!
|
||||
* The IPC server listens on localhost. The IPC client runs on both the
|
||||
* client/server process or the GUI. The IPC server runs on the daemon process.
|
||||
* This allows the GUI to send config changes to the daemon and client/server,
|
||||
* and allows the daemon and client/server to send log data to the GUI.
|
||||
*/
|
||||
class CIpcServer {
|
||||
public:
|
||||
CIpcServer();
|
||||
virtual ~CIpcServer();
|
||||
|
||||
//! Opens a TCP socket only allowing local connections
|
||||
void listen();
|
||||
};
|
||||
26
src/lib/ipc/CIpcServerProxy.cpp
Normal file
26
src/lib/ipc/CIpcServerProxy.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2012 Nick Bolton
|
||||
*
|
||||
* This package is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* found in the file COPYING that should have accompanied this file.
|
||||
*
|
||||
* This package 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "CIpcServerProxy.h"
|
||||
|
||||
CIpcServerProxy::CIpcServerProxy()
|
||||
{
|
||||
}
|
||||
|
||||
CIpcServerProxy::~CIpcServerProxy()
|
||||
{
|
||||
}
|
||||
24
src/lib/ipc/CIpcServerProxy.h
Normal file
24
src/lib/ipc/CIpcServerProxy.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2012 Nick Bolton
|
||||
*
|
||||
* This package is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* found in the file COPYING that should have accompanied this file.
|
||||
*
|
||||
* This package 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
class CIpcServerProxy {
|
||||
public:
|
||||
CIpcServerProxy();
|
||||
virtual ~CIpcServerProxy();
|
||||
};
|
||||
49
src/lib/ipc/CMakeLists.txt
Normal file
49
src/lib/ipc/CMakeLists.txt
Normal file
@@ -0,0 +1,49 @@
|
||||
# synergy -- mouse and keyboard sharing utility
|
||||
# Copyright (C) 2009 Chris Schoeneman, Nick Bolton, Sorin Sbarnea
|
||||
#
|
||||
# This package is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# found in the file COPYING that should have accompanied this file.
|
||||
#
|
||||
# This package 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
set(inc
|
||||
CIpcServer.h
|
||||
CIpcClient.h
|
||||
CIpcServerProxy.h
|
||||
CIpcClientProxy.h
|
||||
)
|
||||
|
||||
set(src
|
||||
CIpcServer.cpp
|
||||
CIpcClient.cpp
|
||||
CIpcServerProxy.cpp
|
||||
CIpcClientProxy.cpp
|
||||
)
|
||||
|
||||
if (WIN32)
|
||||
list(APPEND src ${inc})
|
||||
endif()
|
||||
|
||||
set(inc
|
||||
../net
|
||||
)
|
||||
|
||||
if (UNIX)
|
||||
list(APPEND inc
|
||||
../../..
|
||||
)
|
||||
endif()
|
||||
|
||||
include_directories(${inc})
|
||||
add_library(ipc STATIC ${src})
|
||||
|
||||
if (UNIX)
|
||||
target_link_libraries(net)
|
||||
endif()
|
||||
38
src/test/integtests/CIpcTests.cpp
Normal file
38
src/test/integtests/CIpcTests.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2012 Nick Bolton
|
||||
*
|
||||
* This package is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* found in the file COPYING that should have accompanied this file.
|
||||
*
|
||||
* This package 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "CIpcServer.h"
|
||||
#include "CIpcClient.h"
|
||||
|
||||
TEST(CIpcTests, serverSend)
|
||||
{
|
||||
CIpcServer server;
|
||||
server.listen();
|
||||
|
||||
CIpcClient client;
|
||||
client.connect();
|
||||
}
|
||||
|
||||
TEST(CIpcTests, clientSend)
|
||||
{
|
||||
CIpcServer server;
|
||||
server.listen();
|
||||
|
||||
CIpcClient client;
|
||||
client.connect();
|
||||
}
|
||||
@@ -15,34 +15,27 @@
|
||||
|
||||
set(src
|
||||
Main.cpp
|
||||
CIpcTests.cpp
|
||||
)
|
||||
|
||||
if (WIN32)
|
||||
|
||||
# windows
|
||||
list(APPEND src
|
||||
platform/CMSWindowsClipboardTests.cpp
|
||||
platform/CMSWindowsKeyStateTests.cpp
|
||||
)
|
||||
|
||||
elseif (APPLE)
|
||||
|
||||
# mac
|
||||
list(APPEND src
|
||||
platform/COSXClipboardTests.cpp
|
||||
platform/COSXKeyStateTests.cpp
|
||||
)
|
||||
|
||||
elseif (UNIX)
|
||||
|
||||
# unix/linux
|
||||
list(APPEND src
|
||||
platform/CXWindowsClipboardTests.cpp
|
||||
platform/CXWindowsKeyStateTests.cpp
|
||||
platform/CXWindowsScreenTests.cpp
|
||||
platform/CXWindowsScreenSaverTests.cpp
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
set(inc
|
||||
@@ -51,6 +44,7 @@ set(inc
|
||||
../../lib/client
|
||||
../../lib/common
|
||||
../../lib/io
|
||||
../../lib/ipc
|
||||
../../lib/mt
|
||||
../../lib/net
|
||||
../../lib/platform
|
||||
@@ -76,4 +70,4 @@ endif()
|
||||
include_directories(${inc})
|
||||
add_executable(integtests ${src})
|
||||
target_link_libraries(integtests
|
||||
arch base client common io mt net platform server synergy gtest gmock ${libs})
|
||||
arch base client common io ipc mt net platform server synergy gtest gmock ${libs})
|
||||
|
||||
Reference in New Issue
Block a user