diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 4cbb3c78..7b94a699 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -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) diff --git a/src/lib/ipc/CIpcClient.cpp b/src/lib/ipc/CIpcClient.cpp new file mode 100644 index 00000000..7a1e95bd --- /dev/null +++ b/src/lib/ipc/CIpcClient.cpp @@ -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 . + */ + +#include "CIpcClient.h" + +CIpcClient::CIpcClient() +{ +} + +CIpcClient::~CIpcClient() +{ +} + +void +CIpcClient::connect() +{ +} diff --git a/src/lib/ipc/CIpcClient.h b/src/lib/ipc/CIpcClient.h new file mode 100644 index 00000000..c064add5 --- /dev/null +++ b/src/lib/ipc/CIpcClient.h @@ -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 . + */ + +#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(); +}; diff --git a/src/lib/ipc/CIpcClientProxy.cpp b/src/lib/ipc/CIpcClientProxy.cpp new file mode 100644 index 00000000..6d8184a8 --- /dev/null +++ b/src/lib/ipc/CIpcClientProxy.cpp @@ -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 . + */ + +#include "CIpcClientProxy.h" + +CIpcClientProxy::CIpcClientProxy() +{ +} + +CIpcClientProxy::~CIpcClientProxy() +{ +} diff --git a/src/lib/ipc/CIpcClientProxy.h b/src/lib/ipc/CIpcClientProxy.h new file mode 100644 index 00000000..6e95e526 --- /dev/null +++ b/src/lib/ipc/CIpcClientProxy.h @@ -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 . + */ + +#pragma once + +class CIpcClientProxy { +public: + CIpcClientProxy(); + virtual ~CIpcClientProxy(); +}; diff --git a/src/lib/ipc/CIpcServer.cpp b/src/lib/ipc/CIpcServer.cpp new file mode 100644 index 00000000..fa61ba79 --- /dev/null +++ b/src/lib/ipc/CIpcServer.cpp @@ -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 . + */ + +#include "CIpcServer.h" + +CIpcServer::CIpcServer() +{ +} + +CIpcServer::~CIpcServer() +{ +} + +void +CIpcServer::listen() +{ +} diff --git a/src/lib/ipc/CIpcServer.h b/src/lib/ipc/CIpcServer.h new file mode 100644 index 00000000..ddbbfa06 --- /dev/null +++ b/src/lib/ipc/CIpcServer.h @@ -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 . + */ + +#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(); +}; diff --git a/src/lib/ipc/CIpcServerProxy.cpp b/src/lib/ipc/CIpcServerProxy.cpp new file mode 100644 index 00000000..22282b13 --- /dev/null +++ b/src/lib/ipc/CIpcServerProxy.cpp @@ -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 . + */ + +#include "CIpcServerProxy.h" + +CIpcServerProxy::CIpcServerProxy() +{ +} + +CIpcServerProxy::~CIpcServerProxy() +{ +} diff --git a/src/lib/ipc/CIpcServerProxy.h b/src/lib/ipc/CIpcServerProxy.h new file mode 100644 index 00000000..eb9d28e6 --- /dev/null +++ b/src/lib/ipc/CIpcServerProxy.h @@ -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 . + */ + +#pragma once + +class CIpcServerProxy { +public: + CIpcServerProxy(); + virtual ~CIpcServerProxy(); +}; diff --git a/src/lib/ipc/CMakeLists.txt b/src/lib/ipc/CMakeLists.txt new file mode 100644 index 00000000..1f1a7808 --- /dev/null +++ b/src/lib/ipc/CMakeLists.txt @@ -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 . + +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() diff --git a/src/test/integtests/CIpcTests.cpp b/src/test/integtests/CIpcTests.cpp new file mode 100644 index 00000000..e3be8bcf --- /dev/null +++ b/src/test/integtests/CIpcTests.cpp @@ -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 . + */ + +#include +#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(); +} diff --git a/src/test/integtests/CMakeLists.txt b/src/test/integtests/CMakeLists.txt index c29d72b0..fd3b490c 100644 --- a/src/test/integtests/CMakeLists.txt +++ b/src/test/integtests/CMakeLists.txt @@ -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})