├── .clang-format ├── .gitignore ├── 3rdparty ├── SOURCES └── openh264 │ ├── codec_api.h │ ├── codec_app_def.h │ ├── codec_def.h │ └── codec_ver.h ├── CMakeLists.txt ├── COPYING ├── LICENSE ├── LICENSE-AGPL ├── LICENSE-OPENSSL ├── README.md ├── backend-launcher ├── .gitignore ├── CMakeLists.txt ├── ModuleCommunication.cpp ├── ModuleCommunication.h ├── SystemSession.cpp ├── SystemSession.h └── main.cpp ├── backend ├── .gitignore ├── CMakeLists.txt ├── dmgbuf.c ├── keycodes.c ├── ogon-backend.pc.in ├── ogon-backendConfig.cmake.in ├── protocol.c ├── protocol.h ├── service.c └── transport.c ├── buildflags.h.in ├── cli ├── .gitignore ├── CMakeLists.txt └── cli.cpp ├── cmake ├── CheckCmakeCompat.cmake ├── ConfigOptions.cmake ├── FindDBus.cmake ├── FindDependency.cmake ├── FindPAM.cmake ├── FindProtobufC.cmake ├── FindThrift.cmake ├── Findlibsystemd.cmake ├── GNUInstallDirsWrapper.cmake ├── GetGitRevisionDescription.cmake ├── GetGitRevisionDescription.cmake.in ├── ThriftExternalProject.cmake ├── ThriftUtils.cmake └── ogonCompilerFlags.cmake ├── common ├── global.h ├── icp.h ├── procutils.c ├── procutils.h ├── security.c └── security.h ├── config.h.in ├── doc ├── .gitignore ├── ICPProtocol.md ├── SBProtocol.md ├── SCOPES.md ├── architecture.md ├── backendProtocol.md ├── build-debian-ubuntu.md ├── config.md ├── desktop-hints.md ├── exampleConfig.ini ├── images │ ├── architecture.png │ ├── frame_automata.png │ ├── frame_timeline.png │ └── module_start.png ├── implementingBackend.md ├── implementingSessionManager.md ├── moduleProtocol.md ├── rdpServer.md ├── sessionManager.md └── sources │ ├── architecture.dia │ ├── architecture.odg │ ├── backend_protocol_init_sequence.dia │ ├── module_start.dia │ ├── ogon_frame_automata.odg │ └── ogon_frame_timeline.odg ├── include ├── CMakeLists.txt └── ogon │ ├── api.h │ ├── backend.h │ ├── build-config.h.in │ ├── dmgbuf.h │ ├── message.h │ ├── module.h │ ├── service.h │ └── version.h.in ├── misc ├── .gitignore ├── CMakeLists.txt ├── config.ini.debian.in ├── firewalld │ └── rdp.xml ├── ogon-get-openh264-codec.in ├── ogon-rdp-server.init.in ├── ogon-rdp-server.service.in ├── ogon-session-manager.init.in ├── ogon-session-manager.service.in ├── ogon-start-vc.sh.in ├── ogonXsession ├── ogon_cleanup.sh └── pam.d │ ├── ogon.debian │ ├── ogon.fedora │ └── ogon.suse ├── ogon.pc.in ├── ogonConfig.cmake.in ├── packaging ├── deb │ └── ogon │ │ ├── .gitignore │ │ ├── changelog │ │ ├── compat │ │ ├── control │ │ ├── copyright │ │ ├── libogon-backend1-dbg.lintian-overrides │ │ ├── libogon-backend1.install │ │ ├── libogon-backend1.lintian-overrides │ │ ├── ogon-core-dbg.lintian-overrides │ │ ├── ogon-core.docs │ │ ├── ogon-core.install │ │ ├── ogon-core.lintian-overrides │ │ ├── ogon-dev.install │ │ ├── ogon-dev.lintian-overrides │ │ ├── rules │ │ └── source │ │ └── format ├── rpm │ ├── ogon-core-rpmlintrc │ └── ogon-core.spec └── scripts │ └── prepare_deb.sh ├── patches └── THRIFT-3420.patch ├── protocols ├── protobuf │ ├── ICP.proto │ ├── Module.proto │ ├── SBP.proto │ ├── backend.proto │ └── pbRPC.proto └── thrift │ └── otsapi.thrift ├── rdp-server ├── .gitignore ├── CMakeLists.txt ├── PMurHash.c ├── PMurHash.h ├── app_context.c ├── app_context.h ├── backend.c ├── backend.h ├── bandwidth_mgmt.c ├── bandwidth_mgmt.h ├── channels.c ├── channels.h ├── commondefs.h ├── encoder.c ├── encoder.h ├── eventloop.c ├── eventloop.h ├── font8x8.h ├── frontend.c ├── frontend.h ├── graphics.c ├── icp │ ├── CMakeLists.txt │ ├── icp.c │ ├── icp_client_stubs.c │ ├── icp_client_stubs.h │ ├── icp_server_stubs.c │ ├── icp_server_stubs.h │ └── pbrpc │ │ ├── pbrpc.c │ │ ├── pbrpc.h │ │ ├── pbrpc_transport.h │ │ ├── pbrpc_utils.c │ │ ├── pbrpc_utils.h │ │ ├── pipe_transport.c │ │ └── pipe_transport.h ├── ogon.c ├── ogon.h ├── openh264.c ├── openh264.h ├── peer.c ├── peer.h ├── rdpgfx.c ├── rdpgfx.h ├── state.c ├── state.h └── test │ ├── .gitignore │ ├── CMakeLists.txt │ ├── TestOgonEventLoop.c │ └── TestOgonTimer.c ├── session-manager ├── .gitignore ├── CMakeLists.txt ├── auth.h ├── auth │ ├── CMakeLists.txt │ └── pam │ │ ├── CMakeLists.txt │ │ ├── pam_auth.c │ │ └── pam_auth.h ├── common │ ├── appcontext │ │ ├── ApplicationContext.cpp │ │ └── ApplicationContext.h │ ├── call │ │ ├── Call.cpp │ │ ├── Call.h │ │ ├── CallFactory.cpp │ │ ├── CallFactory.h │ │ ├── CallIn.cpp │ │ ├── CallIn.h │ │ ├── CallInAuthenticateUser.cpp │ │ ├── CallInAuthenticateUser.h │ │ ├── CallInDisconnectUserSession.cpp │ │ ├── CallInDisconnectUserSession.h │ │ ├── CallInEndSession.cpp │ │ ├── CallInEndSession.h │ │ ├── CallInLogonUser.cpp │ │ ├── CallInLogonUser.h │ │ ├── CallInPing.cpp │ │ ├── CallInPing.h │ │ ├── CallInPropertyBool.cpp │ │ ├── CallInPropertyBool.h │ │ ├── CallInPropertyBulk.cpp │ │ ├── CallInPropertyBulk.h │ │ ├── CallInPropertyNumber.cpp │ │ ├── CallInPropertyNumber.h │ │ ├── CallInPropertyString.cpp │ │ ├── CallInPropertyString.h │ │ ├── CallInRemoteControlEnded.cpp │ │ ├── CallInRemoteControlEnded.h │ │ ├── CallInSBPVersion.cpp │ │ ├── CallInSBPVersion.h │ │ ├── CallOut.cpp │ │ ├── CallOut.h │ │ ├── CallOutDisconnectUserSession.cpp │ │ ├── CallOutDisconnectUserSession.h │ │ ├── CallOutLogOffUserSession.cpp │ │ ├── CallOutLogOffUserSession.h │ │ ├── CallOutMessage.cpp │ │ ├── CallOutMessage.h │ │ ├── CallOutOtsApiStartRemoteControl.cpp │ │ ├── CallOutOtsApiStartRemoteControl.h │ │ ├── CallOutOtsApiStopRemoteControl.cpp │ │ ├── CallOutOtsApiStopRemoteControl.h │ │ ├── CallOutOtsApiVirtualChannelClose.cpp │ │ ├── CallOutOtsApiVirtualChannelClose.h │ │ ├── CallOutOtsApiVirtualChannelOpen.cpp │ │ ├── CallOutOtsApiVirtualChannelOpen.h │ │ ├── CallOutPing.cpp │ │ ├── CallOutPing.h │ │ ├── CallOutSwitchTo.cpp │ │ ├── CallOutSwitchTo.h │ │ ├── TaskAuthenticateUser.cpp │ │ ├── TaskAuthenticateUser.h │ │ ├── TaskCallInLogonUser.cpp │ │ ├── TaskCallInLogonUser.h │ │ ├── TaskEndRemoteControl.cpp │ │ └── TaskEndRemoteControl.h │ ├── config │ │ ├── PropertyCWrapper.cpp │ │ ├── PropertyCWrapper.h │ │ ├── PropertyLevel.h │ │ ├── PropertyManager.cpp │ │ └── PropertyManager.h │ ├── module │ │ ├── AuthModule.cpp │ │ ├── AuthModule.h │ │ ├── CallBacks.cpp │ │ ├── CallBacks.h │ │ ├── LocalModule.cpp │ │ ├── LocalModule.h │ │ ├── Module.h │ │ ├── ModuleManager.cpp │ │ ├── ModuleManager.h │ │ ├── RemoteModule.cpp │ │ ├── RemoteModule.h │ │ ├── RemoteModuleTransport.cpp │ │ └── RemoteModuleTransport.h │ ├── otsapi │ │ ├── OTSApiHandler.cpp │ │ ├── OTSApiHandler.h │ │ ├── OTSApiServer.cpp │ │ ├── OTSApiServer.h │ │ ├── OgonServerSSL.h │ │ ├── TaskDisconnect.cpp │ │ ├── TaskDisconnect.h │ │ ├── TaskLogoff.cpp │ │ ├── TaskLogoff.h │ │ ├── TaskStartRemoteControl.cpp │ │ ├── TaskStartRemoteControl.h │ │ ├── TaskStopRemoteControl.cpp │ │ └── TaskStopRemoteControl.h │ ├── pbRPC │ │ ├── RpcEngine.cpp │ │ └── RpcEngine.h │ ├── permission │ │ ├── LogonPermission.cpp │ │ ├── LogonPermission.h │ │ ├── PermissionManager.cpp │ │ ├── PermissionManager.h │ │ └── permission.h │ ├── process │ │ ├── ProcessMonitor.cpp │ │ └── ProcessMonitor.h │ ├── session │ │ ├── Connection.cpp │ │ ├── Connection.h │ │ ├── ConnectionStore.cpp │ │ ├── ConnectionStore.h │ │ ├── Session.cpp │ │ ├── Session.h │ │ ├── SessionAccessor.h │ │ ├── SessionNotifier.cpp │ │ ├── SessionNotifier.h │ │ ├── SessionStore.cpp │ │ ├── SessionStore.h │ │ ├── TaskCallIn.cpp │ │ ├── TaskCallIn.h │ │ ├── TaskDisconnect.cpp │ │ ├── TaskDisconnect.h │ │ ├── TaskEnd.cpp │ │ ├── TaskEnd.h │ │ ├── TaskLogonUser.cpp │ │ ├── TaskLogonUser.h │ │ ├── TaskSessionTimeout.cpp │ │ ├── TaskSessionTimeout.h │ │ ├── TaskShutdown.cpp │ │ ├── TaskShutdown.h │ │ ├── TaskSwitchTo.cpp │ │ └── TaskSwitchTo.h │ ├── task │ │ ├── Executor.cpp │ │ ├── Executor.h │ │ ├── InformableTask.h │ │ ├── Task.h │ │ └── ThreadTask.h │ └── utils │ │ ├── CSGuard.h │ │ ├── FactoryBase.h │ │ ├── MakeCert.cpp │ │ ├── MakeCert.h │ │ ├── SignalingQueue.h │ │ ├── SingletonBase.h │ │ ├── StringHelpers.cpp │ │ ├── StringHelpers.h │ │ ├── TimeHelpers.cpp │ │ └── TimeHelpers.h ├── config │ ├── ReadMe.txt │ └── ogon.SessionManager.conf ├── main.cpp ├── module │ ├── CMakeLists.txt │ ├── Qt │ │ ├── CMakeLists.txt │ │ ├── qt_module.cpp │ │ └── qt_module.h │ ├── Weston │ │ ├── CMakeLists.txt │ │ ├── weston_module.cpp │ │ └── weston_module.h │ ├── X11 │ │ ├── CMakeLists.txt │ │ ├── x11_module.cpp │ │ └── x11_module.h │ └── common │ │ ├── module_helper.cpp │ │ └── module_helper.h └── otsapi │ ├── CMakeLists.txt │ ├── ogon_ssl.h │ └── otsapi_thrift.cpp ├── snmon ├── .gitignore ├── CMakeLists.txt └── snmon.cpp └── utils └── astylerc /.gitignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | CMakeCache.txt 3 | CMakeFiles/ 4 | CTestTestfile.cmake 5 | cmake_install.cmake 6 | install_manifest.txt 7 | *.DS_Store 8 | .project 9 | .cproject 10 | Testing/ 11 | config.h 12 | buildflags.h 13 | DartConfiguration.tcl 14 | include/ogon/build-config.h 15 | include/ogon/version.h 16 | ogon*.pc 17 | ogonConfig.cmake 18 | ogonConfigVersion.cmake 19 | *.init 20 | *.service 21 | *.pb.cc 22 | *.pb.h 23 | *.pb-c.c 24 | *.pb-c.h 25 | *.so 26 | *.so.* 27 | *.a 28 | *.o 29 | external 30 | .idea 31 | -------------------------------------------------------------------------------- /3rdparty/SOURCES: -------------------------------------------------------------------------------- 1 | # openh264 2 | https://github.com/cisco/openh264/tree/v1.7.1-Firefox39/codec/api/svc 3 | openh264 commit 6c2e7008f8bbe2ff90100972f97071eb87ec37cb 4 | -------------------------------------------------------------------------------- /3rdparty/openh264/codec_ver.h: -------------------------------------------------------------------------------- 1 | //The current file is auto-generated by script: generate_codec_ver.sh 2 | #ifndef CODEC_VER_H 3 | #define CODEC_VER_H 4 | 5 | #include "codec_app_def.h" 6 | 7 | static const OpenH264Version g_stCodecVersion = {1, 7, 1, 1706}; 8 | static const char* const g_strCodecVer = "OpenH264 version:1.7.1.1706"; 9 | 10 | #define OPENH264_MAJOR (1) 11 | #define OPENH264_MINOR (7) 12 | #define OPENH264_REVISION (1) 13 | #define OPENH264_RESERVED (1706) 14 | 15 | #endif // CODEC_VER_H 16 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | Please see the file LICENSE in this directory. 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Welcome to the ogon (core) repository 2 | 3 | The ogon repository is part of the ogon project and contains the code of the 4 | RDP server and session manager as well as protocol descriptions and some command line 5 | (helper) utilities. 6 | 7 | ## What is the ogon project? 8 | 9 | The ogon project is an open source driven collection of services and tools mainly written in C/C++ 10 | that provide graphical remote access to Linux desktop sessions using the Remote Desktop Protocol 11 | (RDP). It supports most modern RDP protocol extensions, bitmap compression codecs, dis- and 12 | reconnection to sessions and device redirections. 13 | ogon is compatible with virtually any existing RDP Client. 14 | 15 | Any X11 destkop, weston or qt application can be used as session. Due to it's modular 16 | design it's easily possible to extend or add features or add new backends. 17 | 18 | # tl;dr - too long; didn't read - I just want ... 19 | 20 | * .. to report [a BUG][bugs] 21 | * .. to build it - have a look at our [documentation][documentation] 22 | * .. help - have a look to our [SUPPORT.md document][support] 23 | * .. to get in touch - have a look to our [SUPPORT.md document][support] 24 | * .. to contribute - have a look to [CONTRIBUTING.md][contribute] 25 | 26 | # License 27 | 28 | Most components of the ogon-project are licensed under the GNU AFFERO GENERAL PUBLIC LICENSE version 3. 29 | See LICENSE file of the respective repository. 30 | 31 | [support]: https://github.com/ogon-project/ogon-project/blob/master/SUPPORT.md 32 | [bugs]: https://github.com/ogon-project/ogon-project/blob/master/SUPPORT.md#bugs 33 | [documentation]: https://github.com/ogon-project/ogon-project/blob/master/SUPPORT.md#documentation 34 | [contribute]: https://github.com/ogon-project/ogon-project/blob/master/CONTRIBUTING.md 35 | -------------------------------------------------------------------------------- /backend-launcher/.gitignore: -------------------------------------------------------------------------------- 1 | ogon-backend-launcher 2 | -------------------------------------------------------------------------------- /backend-launcher/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(MODULE_PREFIX "OGON_SESSION_MANAGER") 2 | set(MODULE_NAME "ogon-backend-launcher") 3 | 4 | PROTOBUF_GENERATE_CPP(PBRPC_PROTOBUF_SRC PBRPC_PROTOBUF_HEADERS ${CMAKE_SOURCE_DIR}/protocols/protobuf/pbRPC.proto) 5 | PROTOBUF_GENERATE_CPP(MODULE_PROTOBUF_SRC MODULE_PROTOBUF_HEADERS ${CMAKE_SOURCE_DIR}/protocols/protobuf/Module.proto) 6 | 7 | include_directories(${PROTOBUF_INCLUDE_DIRS}) 8 | 9 | set(${MODULE_PREFIX}_SRCS 10 | SystemSession.cpp 11 | ../session-manager/common/module/RemoteModuleTransport.cpp 12 | ModuleCommunication.cpp 13 | main.cpp 14 | ${PBRPC_PROTOBUF_SRC} 15 | ${PBRPC_PROTOBUF_HEADERS} 16 | ${MODULE_PROTOBUF_SRC} 17 | ${MODULE_PROTOBUF_HEADERS} 18 | ) 19 | 20 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}) 21 | include_directories(${CMAKE_CURRENT_BINARY_DIR}) 22 | add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) 23 | target_link_libraries(${MODULE_NAME} ${PAM_LIBRARY} ${PROTOBUF_LIBRARY} winpr ${CMAKE_THREAD_LIBS_INIT}) 24 | if(WITH_LIBSYSTEMD) 25 | target_link_libraries(${MODULE_NAME} ${LIBSYSTEMD_LIBRARIES}) 26 | include_directories(${LIBSYSTEMD_INCLUDE_DIRS}) 27 | endif(WITH_LIBSYSTEMD) 28 | 29 | install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_SBINDIR}) 30 | -------------------------------------------------------------------------------- /backend-launcher/SystemSession.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Backend Process Launcher 4 | * Abstraction of system session handling 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Bernhard Miklautz 10 | * David Fort 11 | * Martin Haimberger 12 | * 13 | * This file may be used under the terms of the GNU Affero General 14 | * Public License version 3 as published by the Free Software Foundation 15 | * and appearing in the file LICENSE-AGPL included in the distribution 16 | * of this file. 17 | * 18 | * Under the GNU Affero General Public License version 3 section 7 the 19 | * copyright holders grant the additional permissions set forth in the 20 | * ogon Core AGPL Exceptions version 1 as published by 21 | * Thincast Technologies GmbH. 22 | * 23 | * For more information see the file LICENSE in the distribution of this file. 24 | */ 25 | 26 | #ifndef _OGON_BACKENDLAUNCHER_SYSTEMSESSION_H_ 27 | #define _OGON_BACKENDLAUNCHER_SYSTEMSESSION_H_ 28 | 29 | #include 30 | #include 31 | #include 32 | 33 | namespace ogon { namespace launcher { 34 | 35 | class SystemSession { 36 | public: 37 | SystemSession(); 38 | ~SystemSession(); 39 | bool init(const std::string &userName, const std::string &serviceName, 40 | const std::string &remoteHost, pid_t sessionPID, UINT32 sessionID); 41 | bool startSession(); 42 | bool populateEnv(char **envBlockp) const; 43 | bool stopSession(); 44 | static int pam_conv_cb(int msg_length, const struct pam_message **msg, struct pam_response **resp, void *app_data); 45 | private: 46 | bool uninitalizePAM(); 47 | bool writeUTMPEntry(short type); 48 | bool mSessionOpen; 49 | bool mUTMPwritten; 50 | pam_handle_t *mPamHandle; 51 | std::string mUserName; 52 | std::string mRemoteHost; 53 | pid_t mSessionPID; 54 | UINT32 mSessionID; 55 | }; 56 | 57 | } /* launcher */ } /* ogon */ 58 | #endif /* _OGON_BACKENDLAUNCHER_SYSTEMSESSION_H_ */ 59 | -------------------------------------------------------------------------------- /backend/.gitignore: -------------------------------------------------------------------------------- 1 | ogon-backend*.pc 2 | ogon-backendConfig.cmake 3 | ogon-backendConfigVersion.cmake 4 | -------------------------------------------------------------------------------- /backend/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(MODULE_NAME "ogon-backend") 2 | set(MODULE_PREFIX "OGON_MODULE") 3 | 4 | PROTOBUFC_GENERATE_C(MODULE_PROTOC_SRC MODULE_PROTOC_HDRS ${CMAKE_SOURCE_DIR}/protocols/protobuf/backend.proto) 5 | 6 | set(${MODULE_PREFIX}_SRCS 7 | dmgbuf.c 8 | protocol.c 9 | protocol.h 10 | transport.c 11 | service.c 12 | keycodes.c 13 | ${MODULE_PROTOC_SRC} 14 | ${MODULE_PROTOC_HDRS} 15 | ../common/security.c 16 | ) 17 | 18 | include_directories(${CMAKE_CURRENT_BINARY_DIR}) 19 | add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) 20 | target_link_libraries(${MODULE_NAME} ${PRIVATE_KEYWORD} winpr ${PROTOBUFC_LIBRARIES}) 21 | 22 | set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "lib") 23 | set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${OGON_VERSION_FULL} SOVERSION ${OGON_VERSION_MAJOR}) 24 | 25 | install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} EXPORT ogon-backend) 26 | 27 | if(${CMAKE_VERSION} VERSION_GREATER "2.8.10") 28 | 29 | export(PACKAGE ogon-backend) 30 | 31 | set(OGON_CMAKE_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/ogon-backend${OGON_VERSION_MAJOR}") 32 | set(OGON_INCLUDE_DIR "include/ogon${OGON_VERSION_MAJOR}") 33 | set(OGON_PROTOCOL_DIR "share/ogon/${OGON_VERSION_MAJOR}") 34 | 35 | configure_package_config_file(ogon-backendConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/ogon-backendConfig.cmake 36 | INSTALL_DESTINATION ${OGON_CMAKE_INSTALL_DIR} 37 | PATH_VARS OGON_INCLUDE_DIR OGON_PROTOCOL_DIR) 38 | 39 | write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/ogon-backendConfigVersion.cmake 40 | VERSION ${OGON_VERSION} COMPATIBILITY SameMajorVersion) 41 | 42 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ogon-backendConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/ogon-backendConfigVersion.cmake 43 | DESTINATION ${OGON_CMAKE_INSTALL_DIR}) 44 | 45 | install(EXPORT ogon-backend DESTINATION ${OGON_CMAKE_INSTALL_DIR}) 46 | 47 | endif() 48 | 49 | if(NOT MSVC) 50 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ogon-backend.pc.in ${CMAKE_CURRENT_BINARY_DIR}/ogon-backend${OGON_VERSION_MAJOR}.pc @ONLY) 51 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ogon-backend${OGON_VERSION_MAJOR}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) 52 | endif() 53 | -------------------------------------------------------------------------------- /backend/ogon-backend.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | exec_prefix=@CMAKE_INSTALL_PREFIX@ 3 | libdir=@CMAKE_INSTALL_FULL_LIBDIR@ 4 | includedir=@CMAKE_INSTALL_PREFIX@/@OGON_INCLUDE_DIR@ 5 | protocol_dir=@CMAKE_INSTALL_PREFIX@/share/ogon/@OGON_VERSION_MAJOR@ 6 | module_dir=@CMAKE_INSTALL_FULL_LIBDIR@/ogon@OGON_VERSION_MAJOR@ 7 | libs=-logon-backend 8 | 9 | Name: ogon backend 10 | Description: ogon RDP server backend library 11 | URL: http://ogon-project.com/ 12 | Version: @OGON_VERSION_FULL@ 13 | Requires: 14 | Requires.private: freerdp2 15 | Libs: -L${libdir} ${libs} 16 | Cflags: -I${includedir} 17 | -------------------------------------------------------------------------------- /backend/ogon-backendConfig.cmake.in: -------------------------------------------------------------------------------- 1 | 2 | @PACKAGE_INIT@ 3 | 4 | set(OGON-BACKEND_VERSION_MAJOR "@OGON_VERSION_MAJOR@") 5 | set(OGON-BACKEND_VERSION_MINOR "@OGON_VERSION_MINOR@") 6 | set(OGON-BACKEND_VERSION_REVISION "@OGON_VERSION_REVISION@") 7 | 8 | set_and_check(OGON-BACKEND_INCLUDE_DIR "@PACKAGE_OGON_INCLUDE_DIR@") 9 | set_and_check(OGON-BACKEND_PROTOCOL_DIR "@PACKAGE_OGON_PROTOCOL_DIR@") 10 | 11 | include("${CMAKE_CURRENT_LIST_DIR}/ogon-backend.cmake") 12 | 13 | -------------------------------------------------------------------------------- /buildflags.h.in: -------------------------------------------------------------------------------- 1 | #ifndef _OGON_BUILD_FLAGS_H_ 2 | #define _OGON_BUILD_FLAGS_H_ 3 | 4 | #define CFLAGS "${CMAKE_C_FLAGS}" 5 | #define COMPILER_ID "${CMAKE_C_COMPILER_ID}" 6 | #define COMPILER_VERSION "${CMAKE_C_COMPILER_VERSION}" 7 | #define BUILD_CONFIG "${OGON_BUILD_CONFIG}" 8 | #define BUILD_TYPE "${CMAKE_BUILD_TYPE}" 9 | 10 | #endif /*_OGON_BUILD_FLAGS_H_ */ 11 | -------------------------------------------------------------------------------- /cli/.gitignore: -------------------------------------------------------------------------------- 1 | ogon-cli 2 | -------------------------------------------------------------------------------- /cli/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | set(MODULE_NAME "ogon-cli") 3 | set(MODULE_PREFIX "OGON_CLI") 4 | 5 | set(${MODULE_PREFIX}_SRCS 6 | cli.cpp) 7 | 8 | add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) 9 | 10 | target_link_libraries(${MODULE_NAME} winpr) 11 | 12 | install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) 13 | 14 | -------------------------------------------------------------------------------- /cmake/CheckCmakeCompat.cmake: -------------------------------------------------------------------------------- 1 | # GetGitRevisionDescription requires FindGit which was added in version 2.8.2 2 | # build won't fail but GIT_REVISION is set to n/a 3 | if(${CMAKE_VERSION} VERSION_LESS 2.8.2) 4 | message(WARNING "GetGitRevisionDescription reqires (FindGit) cmake >= 2.8.2 to work properly - 5 | GIT_REVISION will be set to n/a") 6 | endif() 7 | -------------------------------------------------------------------------------- /cmake/ConfigOptions.cmake: -------------------------------------------------------------------------------- 1 | # Build unit tests 2 | option(BUILD_TESTING "Build unit tests" OFF) 3 | 4 | # Build with OpenH264 support 5 | option(WITH_OPENH264 "Add support for H.264 encoding" ON) 6 | 7 | # Debugging options 8 | option(WITH_DEBUG_STATE "Enable frame state machine debugging." OFF) 9 | option(WITH_ENCODER_STATS "Enable encoding stats" OFF) 10 | -------------------------------------------------------------------------------- /cmake/FindPAM.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find the PAM libraries 2 | # Once done this will define 3 | # 4 | # PAM_FOUND - system has pam 5 | # PAM_INCLUDE_DIR - the pam include directory 6 | # PAM_LIBRARIES - libpam library 7 | 8 | if (PAM_INCLUDE_DIR AND PAM_LIBRARY) 9 | set(PAM_FIND_QUIETLY TRUE) 10 | endif (PAM_INCLUDE_DIR AND PAM_LIBRARY) 11 | 12 | find_path(PAM_INCLUDE_DIR NAMES security/pam_appl.h pam/pam_appl.h) 13 | find_library(PAM_LIBRARY pam) 14 | find_library(DL_LIBRARY dl) 15 | 16 | if (PAM_INCLUDE_DIR AND PAM_LIBRARY) 17 | set(PAM_FOUND TRUE) 18 | if (DL_LIBRARY) 19 | set(PAM_LIBRARIES ${PAM_LIBRARY} ${DL_LIBRARY}) 20 | else (DL_LIBRARY) 21 | set(PAM_LIBRARIES ${PAM_LIBRARY}) 22 | endif (DL_LIBRARY) 23 | 24 | if (EXISTS ${PAM_INCLUDE_DIR}/pam/pam_appl.h) 25 | set(HAVE_PAM_PAM_APPL_H 1) 26 | endif (EXISTS ${PAM_INCLUDE_DIR}/pam/pam_appl.h) 27 | endif (PAM_INCLUDE_DIR AND PAM_LIBRARY) 28 | 29 | if (PAM_FOUND) 30 | if (NOT PAM_FIND_QUIETLY) 31 | message(STATUS "Found PAM: ${PAM_LIBRARIES}") 32 | endif (NOT PAM_FIND_QUIETLY) 33 | else (PAM_FOUND) 34 | if (PAM_FIND_REQUIRED) 35 | message(FATAL_ERROR "PAM was not found") 36 | endif(PAM_FIND_REQUIRED) 37 | endif (PAM_FOUND) 38 | 39 | mark_as_advanced(PAM_INCLUDE_DIR PAM_LIBRARY DL_LIBRARY) 40 | 41 | -------------------------------------------------------------------------------- /cmake/FindThrift.cmake: -------------------------------------------------------------------------------- 1 | # - Find Thrift (a cross platform RPC lib/tool) 2 | # This module defines 3 | # THRIFT_VERSION, version string of ant if found 4 | # THRIFT_INCLUDE_DIR, where to find THRIFT headers 5 | # THRIFT_LIBS, THRIFT libraries 6 | # THRIFT_FOUND, true or false 7 | 8 | # prefer the thrift version supplied in THRIFT_HOME 9 | message(STATUS "THRIFT_HOME: $ENV{THRIFT_HOME}") 10 | 11 | find_path(THRIFT_INCLUDE_DIR thrift/Thrift.h HINTS 12 | $ENV{THRIFT_HOME}/include/ 13 | /usr/local/include/ 14 | /opt/local/include/) 15 | 16 | set(THRIFT_LIB_PATHS 17 | $ENV{THRIFT_HOME}/lib 18 | /usr/local/lib 19 | /opt/local/lib) 20 | 21 | find_library(THRIFT_LIBRARY NAMES "thrift" HINTS ${THRIFT_LIB_PATHS}) 22 | 23 | find_program(THRIFT_COMPILER thrift 24 | $ENV{THRIFT_HOME}/bin 25 | /usr/local/bin 26 | /usr/bin) 27 | 28 | if(THRIFT_LIBRARY) 29 | set(THRIFT_FOUND TRUE) 30 | set(THRIFT_LIBS ${THRIFT_LIBRARY}) 31 | set(THRIFT_STATIC_LIB "${THRIFT_LIBRARY}") 32 | exec_program(${THRIFT_COMPILER} ARGS -version OUTPUT_VARIABLE THRIFT_VERSION RETURN_VALUE THRIFT_RETURN) 33 | else() 34 | set(THRIFT_FOUND FALSE) 35 | endif() 36 | 37 | if(THRIFT_FOUND) 38 | if (NOT THRIFT_FIND_QUIETLY) 39 | message(STATUS "Thrift version: ${THRIFT_VERSION}") 40 | message(STATUS "Thrift library: ${THRIFT_LIBRARY}") 41 | endif() 42 | endif() 43 | 44 | mark_as_advanced( 45 | THRIFT_LIBRARY 46 | THRIFT_COMPILER 47 | THRIFT_INCLUDE_DIR) 48 | -------------------------------------------------------------------------------- /cmake/Findlibsystemd.cmake: -------------------------------------------------------------------------------- 1 | # Module defines 2 | # LIBSYSTEMD_FOUND - libsystemd libraries and includes found 3 | # LIBSYSTEMD_INCLUDE_DIRS - the libsystemd include directories 4 | # LIBSYSTEMD_LIBRARIES - the libsystemd libraries 5 | # 6 | # Cache entries: 7 | # LIBSYSTEMD_LIBRARY - detected libsystemd library 8 | # LIBSYSTEMD_INCLUDE_DIR - detected libsystemd include dir(s) 9 | # 10 | 11 | if(LIBSYSTEMD_INCLUDE_DIR AND LIBSYSTEMD_LIBRARY) 12 | # in cache already 13 | set(LIBSYSTEMD_FOUND TRUE) 14 | set(LIBSYSTEMD_LIBRARIES ${LIBSYSTEMD_LIBRARY}) 15 | set(LIBSYSTEMD_INCLUDE_DIRS ${LIBSYSTEMD_INCLUDE_DIR}) 16 | else(LIBSYSTEMD_INCLUDE_DIR AND LIBSYSTEMD_LIBRARY) 17 | 18 | find_package(PkgConfig) 19 | if(PKG_CONFIG_FOUND) 20 | pkg_check_modules(_LIBSYSTEMD_PC QUIET "libsystemd") 21 | endif(PKG_CONFIG_FOUND) 22 | 23 | find_path(LIBSYSTEMD_INCLUDE_DIR systemd/sd-journal.h 24 | ${_LIBSYSTEMD_PC_INCLUDE_DIRS} 25 | /usr/include 26 | /usr/local/include 27 | ) 28 | mark_as_advanced(LIBSYSTEMD_INCLUDE_DIR) 29 | 30 | find_library (LIBSYSTEMD_LIBRARY NAMES systemd 31 | PATHS 32 | ${_LIBSYSTEMD_PC_LIBDIR} 33 | ) 34 | mark_as_advanced(LIBSYSTEMD_LIBRARY) 35 | 36 | include(FindPackageHandleStandardArgs) 37 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(libsystemd DEFAULT_MSG LIBSYSTEMD_LIBRARY LIBSYSTEMD_INCLUDE_DIR) 38 | 39 | if(LIBSYSTEMD_FOUND) 40 | set(LIBSYSTEMD_LIBRARIES ${LIBSYSTEMD_LIBRARY}) 41 | set(LIBSYSTEMD_INCLUDE_DIRS ${LIBSYSTEMD_INCLUDE_DIR}) 42 | endif(LIBSYSTEMD_FOUND) 43 | 44 | endif(LIBSYSTEMD_INCLUDE_DIR AND LIBSYSTEMD_LIBRARY) 45 | -------------------------------------------------------------------------------- /cmake/GNUInstallDirsWrapper.cmake: -------------------------------------------------------------------------------- 1 | # GNUInstallDirs is a relatively new cmake module, so wrap it to avoid errors 2 | include(GNUInstallDirs OPTIONAL RESULT_VARIABLE GID_PATH) 3 | if(GID_PATH STREQUAL "NOTFOUND") 4 | if(NOT DEFINED CMAKE_INSTALL_BINDIR) 5 | set(CMAKE_INSTALL_BINDIR "bin" CACHE PATH "user executables (bin)") 6 | endif() 7 | 8 | if(NOT DEFINED CMAKE_INSTALL_LIBDIR) 9 | set(CMAKE_INSTALL_LIBDIR "lib${LIB_SUFFIX}" CACHE PATH "object code libraries (lib)") 10 | endif() 11 | 12 | foreach(dir BINDIR LIBDIR) 13 | if(NOT IS_ABSOLUTE ${CMAKE_INSTALL_${dir}}) 14 | set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}") 15 | else() 16 | set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_${dir}}") 17 | endif() 18 | endforeach() 19 | 20 | mark_as_advanced(CMAKE_INSTALL_BINDIR CMAKE_INSTALL_LIBDIR) 21 | endif() 22 | -------------------------------------------------------------------------------- /cmake/GetGitRevisionDescription.cmake.in: -------------------------------------------------------------------------------- 1 | # Internal file for GetGitRevisionDescription.cmake 2 | # 3 | # Requires CMake 2.6 or newer (uses the 'function' command) 4 | # 5 | # Original Author: 6 | # 2009-2010 Ryan Pavlik 7 | # http://academic.cleardefinition.com 8 | # Iowa State University HCI Graduate Program/VRAC 9 | # 10 | # Copyright Iowa State University 2009-2010. 11 | # Distributed under the Boost Software License, Version 1.0. 12 | # (See http://www.boost.org/LICENSE_1_0.txt) 13 | 14 | set(HEAD_HASH) 15 | 16 | file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024) 17 | 18 | string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS) 19 | if(HEAD_CONTENTS MATCHES "ref") 20 | # named branch 21 | string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}") 22 | if(EXISTS "@GIT_DIR@/${HEAD_REF}") 23 | configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) 24 | elseif(EXISTS "@GIT_DIR@/logs/${HEAD_REF}") 25 | configure_file("@GIT_DIR@/logs/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) 26 | set(HEAD_HASH "${HEAD_REF}") 27 | endif() 28 | else() 29 | # detached HEAD 30 | configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY) 31 | endif() 32 | 33 | if(NOT HEAD_HASH) 34 | file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024) 35 | string(STRIP "${HEAD_HASH}" HEAD_HASH) 36 | endif() 37 | -------------------------------------------------------------------------------- /cmake/ThriftUtils.cmake: -------------------------------------------------------------------------------- 1 | function(THRIFT_GEN VAR) 2 | IF (NOT ARGN) 3 | MESSAGE(SEND_ERROR "Error: THRIFT_GEN called without any src files") 4 | RETURN() 5 | ENDIF(NOT ARGN) 6 | 7 | set(${VAR}) 8 | foreach(FIL ${ARGN}) 9 | # Get full path 10 | get_filename_component(ABS_FIL ${FIL} ABSOLUTE) 11 | # Get basename 12 | get_filename_component(FIL_WE ${FIL} NAME_WE) 13 | 14 | set(OUTPUT_THRIFT_FILE "${THRIFT_OUTPUT_DIR}/${FIL_WE}_types.cpp") 15 | set(OUTPUT_THRIFT_FILE ${OUTPUT_THRIFT_FILE} "${THRIFT_OUTPUT_DIR}/${FIL_WE}_types.h") 16 | set(OUTPUT_THRIFT_FILE ${OUTPUT_THRIFT_FILE} "${THRIFT_OUTPUT_DIR}/${FIL_WE}_constants.cpp") 17 | set(OUTPUT_THRIFT_FILE ${OUTPUT_THRIFT_FILE} "${THRIFT_OUTPUT_DIR}/${FIL_WE}_constants.h") 18 | set(OUTPUT_THRIFT_FILE ${OUTPUT_THRIFT_FILE} "${THRIFT_OUTPUT_DIR}/${FIL_WE}.cpp") 19 | 20 | list(APPEND ${VAR} ${OUTPUT_THRIFT_FILE}) 21 | 22 | set(CPP_ARGS ${THRIFT_INCLUDE_DIR_OPTION} --gen cpp -out ${THRIFT_OUTPUT_DIR}) 23 | 24 | add_custom_command( 25 | OUTPUT ${OUTPUT_THRIFT_FILE} 26 | COMMAND ${THRIFT_COMPILER} ${CPP_ARGS} ${FIL} 27 | DEPENDS ${ABS_FIL} 28 | COMMENT "Running thrift compiler on ${FIL}" 29 | VERBATIM 30 | ) 31 | endforeach(FIL) 32 | 33 | set(${VAR} ${${VAR}} PARENT_SCOPE) 34 | endfunction(THRIFT_GEN) 35 | -------------------------------------------------------------------------------- /common/global.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Global Macros and Defines 4 | * 5 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 6 | * 7 | * Authors: 8 | * Bernhard Miklautz 9 | * 10 | * This file may be used under the terms of the GNU Affero General 11 | * Public License version 3 as published by the Free Software Foundation 12 | * and appearing in the file LICENSE-AGPL included in the distribution 13 | * of this file. 14 | * 15 | * Under the GNU Affero General Public License version 3 section 7 the 16 | * copyright holders grant the additional permissions set forth in the 17 | * ogon Core AGPL Exceptions version 1 as published by 18 | * Thincast Technologies GmbH. 19 | * 20 | * Under the GNU Affero General Public License version 3 section 7 the 21 | * copyright holders grant the additional permissions set forth in the 22 | * ogon Library AGPL Exceptions version 1 as published by 23 | * Thincast Technologies GmbH. 24 | * 25 | * For more information see the file LICENSE in the distribution of this file. 26 | */ 27 | 28 | #ifndef _OGON_GLOBAL_H_ 29 | #define _OGON_GLOBAL_H_ 30 | 31 | #include 32 | 33 | #define OGON_TAG(tag) "com.ogon." tag 34 | 35 | #define OGON_UNUSED(x) (void)(x) 36 | 37 | 38 | #endif /* _OGON_GLOBAL_H_ */ 39 | -------------------------------------------------------------------------------- /common/icp.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Internal Communication Protocol (ICP) 4 | * 5 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 6 | * 7 | * Authors: 8 | * Bernhard Miklautz 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * Under the GNU Affero General Public License version 3 section 7 the 22 | * copyright holders grant the additional permissions set forth in the 23 | * ogon Library AGPL Exceptions version 1 as published by 24 | * Thincast Technologies GmbH. 25 | * 26 | * For more information see the file LICENSE in the distribution of this file. 27 | */ 28 | 29 | #ifndef _OGON_ICP_H_ 30 | #define _OGON_ICP_H_ 31 | 32 | #include 33 | 34 | int ogon_icp_start(HANDLE shutdown, UINT32 vmajor, UINT32 vminor); 35 | int ogon_icp_shutdown(); 36 | void *ogon_icp_get_context(); 37 | BOOL ogon_icp_get_protocol_version(void *context, UINT32 *vmajor, UINT32 *vminor); 38 | 39 | typedef void (*disconnected_callback)(); 40 | void ogon_icp_set_disconnect_cb(disconnected_callback cb); 41 | 42 | #endif /* _OGON_ICP_H_ */ 43 | -------------------------------------------------------------------------------- /common/procutils.c: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * procutils 4 | * 5 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 6 | * 7 | * Authors: 8 | * Bernhard Miklautz 9 | * Norbert Federa 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #include "procutils.h" 25 | #include 26 | #include 27 | #include 28 | 29 | BOOL get_parent_pid(const pid_t pid, pid_t *ppid) { 30 | char buffer[2048]; 31 | size_t size; 32 | FILE *fp; 33 | 34 | *ppid = 0; 35 | snprintf(buffer, sizeof(buffer), "/proc/%lu/stat", (unsigned long) pid); 36 | fp = fopen(buffer, "r"); 37 | if (!fp) { 38 | return FALSE; 39 | } 40 | size = fread(buffer, sizeof(char), sizeof(buffer), fp); 41 | fclose(fp); 42 | if (size <= 0) { 43 | return FALSE; 44 | } 45 | char *ptr; 46 | buffer[size - 1] = '\0'; 47 | /* For format details see man 5 proc */ 48 | /* %d (%s) %c %d .. == pid (comm) state ppid */ 49 | strtok(buffer, ")"); 50 | strtok(NULL, " "); 51 | ptr = strtok(NULL, " "); 52 | *ppid = atoi(ptr); 53 | return TRUE; 54 | } 55 | 56 | char* get_process_name(const pid_t pid) { 57 | FILE *fp; 58 | size_t size; 59 | char buffer[4096]; 60 | char path[32]; 61 | 62 | snprintf(path, sizeof(path), "/proc/%lu/cmdline", (unsigned long) pid); 63 | 64 | if (!(fp = fopen(path, "r"))) { 65 | return NULL; 66 | } 67 | 68 | memset(buffer, 0, sizeof(buffer)); 69 | size = fread(buffer, sizeof(char), sizeof(buffer) - 1, fp); 70 | fclose(fp); 71 | 72 | return size < 1 ? NULL : strdup(buffer); 73 | } 74 | -------------------------------------------------------------------------------- /common/procutils.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * procutils 4 | * 5 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 6 | * 7 | * Authors: 8 | * Bernhard Miklautz 9 | * Norbert Federa 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_PROCUTILS_H_ 25 | #define _OGON_PROCUTILS_H_ 26 | 27 | #include 28 | #include 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif /* __cplusplus */ 33 | 34 | 35 | BOOL get_parent_pid(const pid_t pid, pid_t *ppid); 36 | char* get_process_name(const pid_t pid); 37 | 38 | #ifdef __cplusplus 39 | }; 40 | #endif /* __cplusplus */ 41 | 42 | #endif /* _OGON_PROCUTILS_H_ */ 43 | -------------------------------------------------------------------------------- /common/security.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Common Security Functions 4 | * 5 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 6 | * 7 | * Authors: 8 | * David Fort 9 | * 10 | * This file may be used under the terms of the GNU Affero General 11 | * Public License version 3 as published by the Free Software Foundation 12 | * and appearing in the file LICENSE-AGPL included in the distribution 13 | * of this file. 14 | * 15 | * Under the GNU Affero General Public License version 3 section 7 the 16 | * copyright holders grant the additional permissions set forth in the 17 | * ogon Core AGPL Exceptions version 1 as published by 18 | * Thincast Technologies GmbH. 19 | * 20 | * Under the GNU Affero General Public License version 3 section 7 the 21 | * copyright holders grant the additional permissions set forth in the 22 | * ogon Library AGPL Exceptions version 1 as published by 23 | * Thincast Technologies GmbH. 24 | * 25 | * For more information see the file LICENSE in the distribution of this file. 26 | */ 27 | 28 | #ifndef _OGON_SECURITY_H_ 29 | #define _OGON_SECURITY_H_ 30 | 31 | #include 32 | #include 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | /** 39 | * Tries to get peer's identity using the socket and SO_PEERCRED like functions. 40 | * 41 | * @param fd a file descriptor of a connected socket 42 | * @param uid the uid to fill 43 | * @param haveUid if we have been able to fill the uid 44 | * @param pid the pid to fill 45 | * @param havePid if we have been able to fill the pid 46 | * @return if the function was successful 47 | */ 48 | BOOL ogon_socket_credentials(int fd, uid_t *uid, BOOL *haveUid, pid_t *pid, BOOL *havePid); 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif /* _OGON_SECURITY_H_ */ 55 | -------------------------------------------------------------------------------- /config.h.in: -------------------------------------------------------------------------------- 1 | #ifndef _OGON_CONFIG_H_ 2 | #define _OGON_CONFIG_H_ 3 | 4 | #define OGON_OPENH264_LIBRARY "${OGON_OPENH264_LIBRARY}" 5 | 6 | /* Include files */ 7 | 8 | #cmakedefine HAVE_UNISTD_H 9 | #cmakedefine HAVE_EVENTFD_H 10 | #cmakedefine HAVE_EPOLL_H 11 | 12 | /* Debug */ 13 | #cmakedefine WITH_DEBUG_STATE 14 | 15 | /* Cisco OpenH264 */ 16 | #cmakedefine WITH_OPENH264 17 | #cmakedefine WITH_LIBSYSTEMD 18 | 19 | /* Encoder stats */ 20 | #cmakedefine WITH_ENCODER_STATS 21 | 22 | #endif /* _OGON_CONFIG_H_ */ 23 | -------------------------------------------------------------------------------- /doc/.gitignore: -------------------------------------------------------------------------------- 1 | .*.md.html 2 | -------------------------------------------------------------------------------- /doc/SBProtocol.md: -------------------------------------------------------------------------------- 1 | ogon Session Manager to backend protocol 2 | ============= 3 | 4 | # Introduction 5 | 6 | This document describes the protocol that is used between the ogon Session Manager and a backend. 7 | The SBP uses the ICP connection for transport and uses the same wire format. The MSGTYPE has to be 200 or greater to 8 | be treated as SBP Message from the ogon RDP Server and to be forwarded to the backend. 9 | 10 | # Protocol 11 | 12 | For the packing and the wire format please have a look at the ICP protocol definition. 13 | The messages can go both directions, but at the moment only calls from the backend to the ogon Session Manager are implemented 14 | so far. 15 | 16 | ## ogon backend to ogon Session Manager messages 17 | 18 | ### AuthenticateUser 19 | 20 | This message is sent if a backend needs to authenticate a user. This is obviously used for greeters, so the entered 21 | authentication informatio can be transmitted to the ogon Session Manager. 22 | 23 | The message contains: 24 | 25 | * sessionId - the sessionId to identify the session. 26 | * username - the username 27 | * password - the password 28 | * domain - the domain 29 | 30 | The response: 31 | 32 | * authStatus - result of the authentication: 33 | - AUTH_SUCCESSFUL: Authentication was succesful. 34 | - AUTH_BAD_CREDENTIAL: bad credentials. 35 | - AUTH_WRONG_SESSION_STATE: session was in wrong state. 36 | - AUTH_UNKOWN_ERROR : unknown error. 37 | 38 | 39 | ### EndSession 40 | 41 | This message is sent if a backend wants to terminate. This is only used in the greeter so far, if cancel gets pressed. 42 | 43 | The message contains: 44 | 45 | * sessionId - the sessionId to identify the session. 46 | 47 | The response: 48 | 49 | * success - ture if successfully otherwise false. 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /doc/SCOPES.md: -------------------------------------------------------------------------------- 1 | # ogon commit message scopes 2 | 3 | * protocols - protocol definitions 4 | * rdp-server - RDP server 5 | * misc - miscellaneous like start scripts or configurations 6 | * cli - command line utility 7 | * common - common definitions and code 8 | * snmon - custom dbus monitor for session manager notifications 9 | * libbackend - backend library 10 | * backend-launcher - (systemd) backend launcher 11 | * session-manager - session manager 12 | -------------------------------------------------------------------------------- /doc/desktop-hints.md: -------------------------------------------------------------------------------- 1 | # Tested Desktops 2 | There are a few limitations concerning different desktop types when using ogon. 3 | This file is about documenting the approved desktop types and maybe the changes required to make them work. 4 | 5 | ## Basics 6 | Ogon is using session files (usually located at /usr/share/xsession/*.desktop) to start sessions. 7 | The desktop type can be defined globally (by setting the environment variable OGON_X11_DESKTOP in ogon.ini) 8 | ```ini 9 | environment_add_string=WTSAPI_LIBRARY:/usr/lib/x86_64-linux-gnu/ogon1/libogon-otsapi.so;OGON_X11_DESKTOP:xfce 10 | ``` 11 | or on a per user basis by creating a file: 12 | ```console 13 | echo "xfce" > ~/.config/ogon/desktop 14 | ``` 15 | 16 | ## LXDE desktop (LXDE.desktop, Tested on Ubuntu 20.04) 17 | Install packages: 18 | ```console 19 | apt install lxde # OGON_X11_DESKTOP=LXDE 20 | ``` 21 | 22 | ## MATE desktop (mate.desktop, Tested on Ubuntu 20.04) 23 | Install packages: 24 | ```console 25 | apt install mate-desktop-environment # OGON_X11_DESKTOP=mate 26 | ``` 27 | Known issues: 28 | * Panel app IndicatorAppletcomplete won't start (just disable it). 29 | 30 | ## XFCE desktop (xfce.desktop, Tested on Ubuntu 20.04) 31 | Install packages: 32 | ```console 33 | apt install xfce4 # OGON_X11_DESKTOP=xfce 34 | ``` 35 | 36 | ## xubuntu desktop (xubuntu.desktop, Tested on Ubuntu 20.04) 37 | Install packages: 38 | ```console 39 | apt install xubuntu-desktop # OGON_X11_DESKTOP=xubuntu 40 | ``` 41 | 42 | ## Ubuntu desktop (ubuntu.desktop, Tested on Ubuntu 20.04) 43 | Install packages: 44 | ```console 45 | apt install ubuntu-session # OGON_X11_DESKTOP=ubuntu 46 | ``` 47 | Running ubuntu desktop requires a little more work: 48 | Make sure to set variables XDG_SESSION_TYPE and GDK_BACKEND to "x11": 49 | ```ini 50 | environment_add_string=WTSAPI_LIBRARY:/usr/lib/x86_64-linux-gnu/ogon1/libogon-otsapi.so;OGON_X11_DESKTOP:ubuntu;XDG_SESSION_TYPE:x11;GDK_BACKEND:x11 51 | ``` 52 | Known issues: 53 | * Some gnome applications may have a double title bar, similar to [this issue](https://github.com/neutrinolabs/xrdp/issues/1642). 54 | -------------------------------------------------------------------------------- /doc/exampleConfig.ini: -------------------------------------------------------------------------------- 1 | [global] 2 | environment_add_string=WTSAPI_LIBRARY:/opt/ogon/lib/x86_64-linux-gnu/libogon-otsapi.so 3 | auth_greeter_string=greeter 4 | auth_module_string=PAM 5 | module_string=xsession 6 | module_xsession_fontPath_string=/usr/X11R6/lib/X11/fonts/misc,/usr/X11R6/lib/X11/fonts/75dpi,/usr/X11R6/lib/X11/fonts/100dpi,/usr/X11R6/lib/X11/fonts/URW,/usr/X11R6/lib/X11/fonts/encodings,/usr/X11R6/lib/X11/fonts/local,/usr/X11R6/lib/X11/fonts/util,/usr/X11R6/lib/X11/fonts/cyrillic/,/usr/X11R6/lib/X11/fonts/java,/usr/X11R6/lib/X11/fonts/Speedo,/usr/X11R6/lib/X11/fonts/Type1,/usr/X11R6/lib/X11/fonts/truetype 7 | 8 | module_greeter_modulename_string=Qt 9 | module_greeter_cmd_string=/opt/ogon/bin/ogon-qt-greeter --noeffects 10 | module_greeter_colordepth_number=24 11 | 12 | module_xsession_modulename_string=X11 13 | module_xsession_colordepth_number=24 14 | module_xsession_displayOffset_number=100 15 | module_xsession_uselauncher_bool=true 16 | module_xsession_launcherexecutable_string=/opt/ogon/sbin/ogon-backend-launcher 17 | 18 | module_weston_modulename_string=Weston 19 | module_weston_cmd_string=/opt/ogon/bin/weston 20 | module_weston_uselauncher_bool=true 21 | session_singleSession_bool=true 22 | 23 | session_reconnect_bool=false 24 | session_timeout_number=60 25 | session_maxXRes_number=1920 26 | session_maxYRes_number=1200 27 | session_xres_number=1024 28 | session_yres_number=768 29 | 30 | #module_xsession_startvc_string=/opt/ogon/etc/ogon/ogonXsession 31 | #environment_add_string=ALSA_CONFIG_PATH:/opt/ogon/etc/ogon/pulse/alsa.conf 32 | 33 | [user_demo1] 34 | session_timeout_number=0 35 | 36 | [user_demo2] 37 | module_string=xsession 38 | session_reconnect_bool=true 39 | session_reconnect_fromSameClient_bool=true 40 | 41 | [user_demo3] 42 | module_string=weston 43 | session_reconnect_bool=true 44 | session_reconnect_fromSameClient_bool=true 45 | 46 | [user_root] 47 | permission_level_string=FULL 48 | 49 | -------------------------------------------------------------------------------- /doc/images/architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogon-project/ogon/24301079b1ff35f1118ce873b9e8dccf71fc6457/doc/images/architecture.png -------------------------------------------------------------------------------- /doc/images/frame_automata.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogon-project/ogon/24301079b1ff35f1118ce873b9e8dccf71fc6457/doc/images/frame_automata.png -------------------------------------------------------------------------------- /doc/images/frame_timeline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogon-project/ogon/24301079b1ff35f1118ce873b9e8dccf71fc6457/doc/images/frame_timeline.png -------------------------------------------------------------------------------- /doc/images/module_start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogon-project/ogon/24301079b1ff35f1118ce873b9e8dccf71fc6457/doc/images/module_start.png -------------------------------------------------------------------------------- /doc/sources/architecture.dia: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogon-project/ogon/24301079b1ff35f1118ce873b9e8dccf71fc6457/doc/sources/architecture.dia -------------------------------------------------------------------------------- /doc/sources/architecture.odg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogon-project/ogon/24301079b1ff35f1118ce873b9e8dccf71fc6457/doc/sources/architecture.odg -------------------------------------------------------------------------------- /doc/sources/backend_protocol_init_sequence.dia: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogon-project/ogon/24301079b1ff35f1118ce873b9e8dccf71fc6457/doc/sources/backend_protocol_init_sequence.dia -------------------------------------------------------------------------------- /doc/sources/module_start.dia: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogon-project/ogon/24301079b1ff35f1118ce873b9e8dccf71fc6457/doc/sources/module_start.dia -------------------------------------------------------------------------------- /doc/sources/ogon_frame_automata.odg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogon-project/ogon/24301079b1ff35f1118ce873b9e8dccf71fc6457/doc/sources/ogon_frame_automata.odg -------------------------------------------------------------------------------- /doc/sources/ogon_frame_timeline.odg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ogon-project/ogon/24301079b1ff35f1118ce873b9e8dccf71fc6457/doc/sources/ogon_frame_timeline.odg -------------------------------------------------------------------------------- /include/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ogon/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/ogon/version.h) 2 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ogon/build-config.h.in ${CMAKE_CURRENT_BINARY_DIR}/ogon/build-config.h) 3 | 4 | file(GLOB OGON_HEADERS "ogon/*.h") 5 | install(FILES ${OGON_HEADERS} DESTINATION include/ogon${OGON_VERSION_MAJOR}/ogon COMPONENT headers) 6 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ogon/version.h DESTINATION include/ogon${OGON_VERSION_MAJOR}/ogon COMPONENT headers) 7 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ogon/build-config.h DESTINATION include/ogon${OGON_VERSION_MAJOR}/ogon COMPONENT headers) 8 | -------------------------------------------------------------------------------- /include/ogon/api.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * API Header 4 | * 5 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 6 | * 7 | * This file may be used under the terms of the GNU Affero General 8 | * Public License version 3 as published by the Free Software Foundation 9 | * and appearing in the file LICENSE-AGPL included in the distribution 10 | * of this file. 11 | * 12 | * Under the GNU Affero General Public License version 3 section 7 the 13 | * copyright holders grant the additional permissions set forth in the 14 | * ogon Core AGPL Exceptions version 1 as published by 15 | * Thincast Technologies GmbH. 16 | * 17 | * Under the GNU Affero General Public License version 3 section 7 the 18 | * copyright holders grant the additional permissions set forth in the 19 | * ogon Library AGPL Exceptions version 1 as published by 20 | * Thincast Technologies GmbH. 21 | * 22 | * For more information see the file LICENSE in the distribution of this file. 23 | */ 24 | 25 | #ifndef _OGON_API_H_ 26 | #define _OGON_API_H_ 27 | 28 | #if __GNUC__ >= 4 29 | #define OGON_API __attribute__ ((visibility("default"))) 30 | #else 31 | #define OGON_API 32 | #endif 33 | 34 | #endif /* _OGON_API_H_ */ 35 | -------------------------------------------------------------------------------- /include/ogon/build-config.h.in: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Build Configuration (Core) 4 | * 5 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 6 | * 7 | * This file may be used under the terms of the GNU Affero General 8 | * Public License version 3 as published by the Free Software Foundation 9 | * and appearing in the file LICENSE-AGPL included in the distribution 10 | * of this file. 11 | * 12 | * Under the GNU Affero General Public License version 3 section 7 the 13 | * copyright holders grant the additional permissions set forth in the 14 | * ogon Core AGPL Exceptions version 1 as published by 15 | * Thincast Technologies GmbH. 16 | * 17 | * Under the GNU Affero General Public License version 3 section 7 the 18 | * copyright holders grant the additional permissions set forth in the 19 | * ogon Library AGPL Exceptions version 1 as published by 20 | * Thincast Technologies GmbH. 21 | * 22 | * For more information see the file LICENSE in the distribution of this file. 23 | */ 24 | 25 | #ifndef _OGON_BUILD_CONFIG_H_ 26 | #define _OGON_BUILD_CONFIG_H_ 27 | 28 | /* Build related settings */ 29 | #define OGON_BIN_PATH "${OGON_BIN_PATH}" 30 | #define OGON_SBIN_PATH "${OGON_SBIN_PATH}" 31 | #define OGON_CFG_PATH "${OGON_CFG_PATH}" 32 | #define OGON_VAR_PATH "${OGON_VAR_PATH}" 33 | #define OGON_PID_PATH "${OGON_PID_PATH}" 34 | 35 | #define OGON_LIB_PATH "${OGON_LIB_PATH}" 36 | #define OGON_APP_LIB_PATH "${OGON_APP_LIB_PATH}" 37 | #define OGON_MODULE_LIB_PATH "${OGON_MODULE_LIB_PATH}" 38 | #define OGON_AUTH_MODULE_LIB_PATH "${OGON_AUTH_MODULE_LIB_PATH}" 39 | 40 | #endif /* _OGON_BUILD_CONFIG_H_ */ 41 | 42 | -------------------------------------------------------------------------------- /include/ogon/message.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * WTS Message Type Definitions 4 | * 5 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 6 | * 7 | * This file may be used under the terms of the GNU Affero General 8 | * Public License version 3 as published by the Free Software Foundation 9 | * and appearing in the file LICENSE-AGPL included in the distribution 10 | * of this file. 11 | * 12 | * Under the GNU Affero General Public License version 3 section 7 the 13 | * copyright holders grant the additional permissions set forth in the 14 | * ogon Core AGPL Exceptions version 1 as published by 15 | * Thincast Technologies GmbH. 16 | * 17 | * Under the GNU Affero General Public License version 3 section 7 the 18 | * copyright holders grant the additional permissions set forth in the 19 | * ogon Library AGPL Exceptions version 1 as published by 20 | * Thincast Technologies GmbH. 21 | * 22 | * For more information see the file LICENSE in the distribution of this file. 23 | */ 24 | 25 | #ifndef _OGON_MESSAGE_H_ 26 | #define _OGON_MESSAGE_H_ 27 | 28 | #define MESSAGE_CUSTOM_TYPE 1 29 | #define MESSAGE_REQUEST_REMOTE_CONTROL 2 30 | 31 | #endif /* _OGON_MESSAGE_H_ */ 32 | -------------------------------------------------------------------------------- /include/ogon/version.h.in: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Version Definitions 4 | * 5 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 6 | * 7 | * This file may be used under the terms of the GNU Affero General 8 | * Public License version 3 as published by the Free Software Foundation 9 | * and appearing in the file LICENSE-AGPL included in the distribution 10 | * of this file. 11 | * 12 | * Under the GNU Affero General Public License version 3 section 7 the 13 | * copyright holders grant the additional permissions set forth in the 14 | * ogon Core AGPL Exceptions version 1 as published by 15 | * Thincast Technologies GmbH. 16 | * 17 | * Under the GNU Affero General Public License version 3 section 7 the 18 | * copyright holders grant the additional permissions set forth in the 19 | * ogon Library AGPL Exceptions version 1 as published by 20 | * Thincast Technologies GmbH. 21 | * 22 | * For more information see the file LICENSE in the distribution of this file. 23 | */ 24 | 25 | #ifndef _OGON_VERSION_H_ 26 | #define _OGON_VERSION_H_ 27 | 28 | #define OGON_VERSION_MAJOR ${OGON_VERSION_MAJOR} 29 | #define OGON_VERSION_MINOR ${OGON_VERSION_MINOR} 30 | #define OGON_VERSION_REVISION ${OGON_VERSION_REVISION} 31 | #define OGON_VERSION_SUFFIX "${OGON_VERSION_SUFFIX}" 32 | #define OGON_VERSION "${OGON_VERSION}" 33 | #define OGON_VERSION_FULL "${OGON_VERSION_FULL}" 34 | #define GIT_REVISION "${GIT_REVISION}" 35 | 36 | #define OGON_PROTOCOL_VERSION_MAJOR 1 37 | #define OGON_PROTOCOL_VERSION_MINOR 1 38 | 39 | #endif /* _OGON_VERSION_H_ */ 40 | -------------------------------------------------------------------------------- /misc/.gitignore: -------------------------------------------------------------------------------- 1 | ogon-get-openh264-codec 2 | config.ini.debian 3 | -------------------------------------------------------------------------------- /misc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ogon-rdp-server.service.in ${CMAKE_CURRENT_BINARY_DIR}/ogon-rdp-server.service) 2 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ogon-session-manager.service.in ${CMAKE_CURRENT_BINARY_DIR}/ogon-session-manager.service) 3 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ogon-session-manager.init.in ${CMAKE_CURRENT_BINARY_DIR}/ogon-session-manager.init) 4 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ogon-rdp-server.init.in ${CMAKE_CURRENT_BINARY_DIR}/ogon-rdp-server.init) 5 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.ini.debian.in ${CMAKE_CURRENT_BINARY_DIR}/config.ini.debian) 6 | 7 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ogon-start-vc.sh.in ${CMAKE_CURRENT_BINARY_DIR}/ogon-start-vc.sh) 8 | install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/ogon-start-vc.sh" DESTINATION ${CMAKE_INSTALL_BINDIR}) 9 | 10 | install(PROGRAMS "ogonXsession" DESTINATION ${OGON_CFG_PATH}) 11 | install(PROGRAMS "ogon_cleanup.sh" DESTINATION ${OGON_CFG_PATH}) 12 | 13 | if(WITH_OPENH264) 14 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ogon-get-openh264-codec.in ${CMAKE_CURRENT_BINARY_DIR}/ogon-get-openh264-codec) 15 | install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/ogon-get-openh264-codec" DESTINATION ${CMAKE_INSTALL_SBINDIR}) 16 | endif() 17 | -------------------------------------------------------------------------------- /misc/config.ini.debian.in: -------------------------------------------------------------------------------- 1 | # For details on the configuration see /usr/share/doc/ogon-core/config.md 2 | [global] 3 | # Use the snakeoil certificates from ssl-cert 4 | ssl_certificate_string=/etc/ssl/certs/ssl-cert-snakeoil.pem 5 | ssl_key_string=/etc/ssl/private/ssl-cert-snakeoil.key 6 | 7 | # Greeter definition 8 | module_greeter_modulename_string=Qt 9 | module_greeter_cmd_string=@OGON_BIN_PATH@/ogon-qt-greeter --noeffects 10 | module_greeter_colordepth_number=24 11 | 12 | # Xorg backend configuration 13 | module_xsession_modulename_string=X11 14 | module_xsession_colordepth_number=24 15 | module_xsession_displayOffset_number=100 16 | module_xsession_uselauncher_bool=true 17 | module_xsession_startwm_string=@OGON_CFG_PATH@/ogonXsession 18 | module_xsession_launcherexecutable_string=@OGON_SBIN_PATH@/ogon-backend-launcher 19 | #module_xsession_xauthoritypath_string=/tmp 20 | 21 | # Weston configuration 22 | module_weston_modulename_string=Weston 23 | module_weston_cmd_string=@OGON_BIN_PATH@/ogon-backend-weston 24 | module_weston_uselauncher_bool=true 25 | module_weston_launcherexecutable_string=@OGON_SBIN_PATH@/ogon-backend-launcher 26 | 27 | 28 | # general settings 29 | ## Globaly set WTSAPI_LIBRARY within the session to make wtsapi (channels) work 30 | environment_add_string=WTSAPI_LIBRARY:@OGON_LIB_PATH@/ogon@OGON_VERSION_MAJOR@/libogon-otsapi.so 31 | ## use "greeter" as greeter 32 | auth_greeter_string=greeter 33 | ## use PAM for authentication 34 | auth_module_string=PAM 35 | ## use X as default backend 36 | module_string=xsession 37 | 38 | # session specific settings 39 | ## enable single session for a user 40 | session_singleSession_bool=true 41 | ## Allow reconnection to a session 42 | session_reconnect_bool=true 43 | ## Timeout the session after 60 minutes 44 | session_timeout_number=60 45 | ## set the maximum allowed resolution (RDPv6: 4096x2048) 46 | session_maxXRes_number=4096 47 | session_maxYRes_number=2048 48 | ## set the default resolution to use 49 | session_xres_number=1024 50 | session_yres_number=768 51 | 52 | # allow root to have full permissions for wtsapi 53 | [user_root] 54 | permission_level_string=FULL 55 | 56 | -------------------------------------------------------------------------------- /misc/firewalld/rdp.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | rdp 4 | Enable this if you run a RDP server, and you wish that external users can connect using the RDP protocol. 5 | 6 | 7 | -------------------------------------------------------------------------------- /misc/ogon-rdp-server.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=ogon RDP server 3 | After=network.target 4 | After=ogon-session-manager.service 5 | Requires=ogon-session-manager.service 6 | JoinsNamespaceOf=ogon-session-manager.service 7 | 8 | [Service] 9 | Type=forking 10 | PIDFile=${OGON_PID_PATH}/ogon-rdp-server.pid 11 | ExecStart=${OGON_SBIN_PATH}/ogon-rdp-server --log=syslog 12 | ExecStop=${OGON_SBIN_PATH}/ogon-rdp-server --kill 13 | StandardOutput=journal 14 | StandardError=journal 15 | 16 | [Install] 17 | WantedBy=multi-user.target 18 | -------------------------------------------------------------------------------- /misc/ogon-session-manager.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=ogon session manager 3 | After=network.target 4 | Requires=dbus.service 5 | 6 | [Service] 7 | Type=forking 8 | ExecStartPre=-${OGON_CFG_PATH}/ogon_cleanup.sh 9 | ExecStart=${OGON_SBIN_PATH}/ogon-session-manager --log=syslog 10 | ExecStop=${OGON_SBIN_PATH}/ogon-session-manager --kill 11 | ExecReload=/bin/kill -HUP $MAINPID 12 | User=root 13 | Group=root 14 | KillMode=control-group 15 | PIDFile=${OGON_PID_PATH}/ogon-session-manager.pid 16 | StandardOutput=journal 17 | StandardError=journal 18 | 19 | [Install] 20 | WantedBy=multi-user.target 21 | -------------------------------------------------------------------------------- /misc/ogon-start-vc.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # rdp clipboard 4 | RDPCLIP=@OGON_BIN_PATH@/rdpclip 5 | if [ -x "$RDPCLIP" ]; then 6 | "$RDPCLIP" --log=syslog & 7 | # Options: 8 | # --log=[syslog|journald|console] 9 | fi 10 | 11 | # rdp device redirector 12 | RDPDR=@OGON_BIN_PATH@/rdpdr 13 | if [ -x "$RDPDR" ]; then 14 | "$RDPDR" "--mountpointrule={HOME}/rdpfiles/{CLIENTNAME}/{DEVICENAME}/" --log=syslog & 15 | # Options: 16 | # --log=[syslog|journald|console] 17 | fi 18 | 19 | # rdp audio 20 | PULSE=@OGON_BIN_PATH@/pulseaudio 21 | if [ -x "$PULSE" ] && [ ! -z "$OGON_SID" ]; then 22 | export PULSE_RUNTIME_PATH="/tmp/.rdpsnd-$OGON_SID/" 23 | export PULSE_STATE_PATH="$PULSE_RUNTIME_PATH" 24 | export HOME="$PULSE_RUNTIME_PATH" 25 | $PULSE --start --log-target=syslog 26 | # Options: 27 | # --log-target=[auto|syslog|stderr|file:PATH|newfile:PATH] 28 | # --log-level=debug 29 | 30 | # if not configured to use x11 publish the following can be used 31 | #if [ $? -eq 0 ] && [ x"$DISPLAY" != x ] ;then 32 | # /usr/bin/ogon-pactl load-module module-x11-publish "display=$DISPLAY" 33 | #fi 34 | fi 35 | 36 | -------------------------------------------------------------------------------- /misc/ogonXsession: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | CONF_FILE="${HOME}/.config/ogon/desktop" 4 | XSESSION_DIR="/usr/share/xsessions" 5 | ENV_FILE="/etc/environment" 6 | LOCALE_FILE="/etc/default/locale" 7 | DESKTOP_SESSION="" 8 | SESSION_COMMAND="" 9 | 10 | # Make sure to set the very basic environment 11 | if [ -r "${ENV_FILE}" ]; then 12 | . "${ENV_FILE}" 13 | fi 14 | if [ -r "${LOCALE_FILE}" ]; then 15 | . "${LOCALE_FILE}" 16 | fi 17 | [ -z "$LANG" ] || export LANG 18 | [ -z "$LC_ALL" ] || export LC_ALL 19 | 20 | if [ -z "${OGON_X11_NODBUS}" ] && [ -z "${DBUS_SESSION_BUS_ADDRESS}" ]; then 21 | eval $(dbus-launch --sh-syntax --exit-with-session) 22 | fi 23 | 24 | if [ ! -z "${OGON_X11_DESKTOP}" ]; then 25 | DESKTOP_SESSION="${OGON_X11_DESKTOP}" 26 | elif [ -r ${CONF_FILE} ]; then 27 | DESKTOP_SESSION="$(cat ${CONF_FILE} | tr -d '\n')" 28 | fi 29 | 30 | if [ ! -z ${DESKTOP_SESSION} ] && [ -r "${XSESSION_DIR}/${DESKTOP_SESSION}.desktop" ]; then 31 | SESSION_COMMAND="$(grep -e '^Exec=' "${XSESSION_DIR}/${DESKTOP_SESSION}.desktop" | tr -d '\n' | cut -d "=" -f 2-)" 32 | fi 33 | 34 | # Option passed to Xsession needs to have 1 argument only 35 | export DESKTOP_SESSION="${DESKTOP_SESSION}" 36 | export GDMSESSION="${DESKTOP_SESSION}" 37 | export XDG_SESSION_DESKTOP="${DESKTOP_SESSION}" 38 | 39 | # SESSION_COMMAND should be one argument - will be parsed later 40 | if [ -r /etc/X11/Xsession ]; then 41 | . /etc/X11/Xsession "${SESSION_COMMAND}" 42 | elif [ -r /etc/X11/xdm/Xsession ]; then 43 | . /etc/X11/xdm/Xsession "${SESSION_COMMAND}" 44 | elif [ -r /etc/gdm/Xsession ]; then 45 | /etc/gdm/Xsession "${SESSION_COMMAND}" 46 | elif [ -r /etc/X11/xinit/Xsession ]; then 47 | . /etc/X11/xinit/Xsession "${SESSION_COMMAND}" 48 | elif [ -r /etc/X11/xinit/xinitrc ]; then 49 | . /etc/X11/xinit/xinitrc "${SESSION_COMMAND}" 50 | fi 51 | -------------------------------------------------------------------------------- /misc/ogon_cleanup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # get rid of temorary pulse audio directories 4 | rm -rf /tmp/.rdpsnd-* 5 | exit 0 6 | -------------------------------------------------------------------------------- /misc/pam.d/ogon.debian: -------------------------------------------------------------------------------- 1 | #%PAM-1.0 2 | auth include common-auth 3 | account include common-account 4 | 5 | -------------------------------------------------------------------------------- /misc/pam.d/ogon.fedora: -------------------------------------------------------------------------------- 1 | #%PAM-1.0 2 | auth include password-auth 3 | account include password-auth 4 | session include password-auth 5 | 6 | -------------------------------------------------------------------------------- /misc/pam.d/ogon.suse: -------------------------------------------------------------------------------- 1 | #%PAM-1.0 2 | auth include common-auth 3 | account include common-account 4 | password include common-password 5 | session required pam_loginuid.so 6 | session include common-session 7 | 8 | -------------------------------------------------------------------------------- /ogon.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | exec_prefix=@CMAKE_INSTALL_PREFIX@ 3 | libdir=@CMAKE_INSTALL_FULL_LIBDIR@ 4 | includedir=@CMAKE_INSTALL_PREFIX@/@OGON_INCLUDE_DIR@ 5 | protocol_dir=@CMAKE_INSTALL_PREFIX@/share/ogon/@OGON_VERSION_MAJOR@ 6 | module_dir=@CMAKE_INSTALL_FULL_LIBDIR@/ogon@OGON_VERSION_MAJOR@ 7 | 8 | Name: ogon 9 | Description: ogon RDP server 10 | URL: http://ogon-project.com/ 11 | Version: @OGON_VERSION_FULL@ 12 | -------------------------------------------------------------------------------- /ogonConfig.cmake.in: -------------------------------------------------------------------------------- 1 | 2 | @PACKAGE_INIT@ 3 | 4 | set(OGON_VERSION_MAJOR "@OGON_VERSION_MAJOR@") 5 | set(OGON_VERSION_MINOR "@OGON_VERSION_MINOR@") 6 | set(OGON_VERSION_REVISION "@OGON_VERSION_REVISION@") 7 | 8 | set_and_check(OGON_INCLUDE_DIR "@PACKAGE_OGON_INCLUDE_DIR@") 9 | set_and_check(OGON_PROTOCOL_DIR "@PACKAGE_OGON_PROTOCOL_DIR@") 10 | -------------------------------------------------------------------------------- /packaging/deb/ogon/.gitignore: -------------------------------------------------------------------------------- 1 | *.log 2 | .debhelper/ 3 | debhelper-build-stamp 4 | files 5 | *.substvars 6 | tmp 7 | ogon-core-dbg/ 8 | ogon-core/ 9 | ogon-dev/ 10 | libogon-backend1-dbg/ 11 | libogon-backend1/ 12 | 13 | *.debhelper 14 | *.pam 15 | *.service 16 | *.init 17 | -------------------------------------------------------------------------------- /packaging/deb/ogon/changelog: -------------------------------------------------------------------------------- 1 | ogon (1.0.0) UNRELEASED; urgency=low 2 | 3 | * Updated to compile on debian bullseye. 4 | 5 | -- ogon packaging team Wed, 14 Oct 2020 23:15:58 +0200 6 | 7 | ogon (0.0.1) UNRELEASED; urgency=low 8 | 9 | * Initial release. 10 | 11 | -- ogon packaging team Fri, 01 Apr 2016 15:50:58 +0200 12 | -------------------------------------------------------------------------------- /packaging/deb/ogon/compat: -------------------------------------------------------------------------------- 1 | 10 2 | -------------------------------------------------------------------------------- /packaging/deb/ogon/copyright: -------------------------------------------------------------------------------- 1 | Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: ogon 3 | Upstream-Contact: ogon 4 | Source: http://github.com/ogon/ogon 5 | 6 | Files: * 7 | Copyright: 2018 Thincast Technologies GmBH 8 | License: Apache-2.0 9 | 10 | License: Apache-2.0 11 | Licensed under the Apache License, Version 2.0 (the "License"); 12 | you may not use this file except in compliance with the License. 13 | You may obtain a copy of the License at 14 | . 15 | http://www.apache.org/licenses/LICENSE-2.0 16 | . 17 | Unless required by applicable law or agreed to in writing, software 18 | distributed under the License is distributed on an "AS IS" BASIS, 19 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | See the License for the specific language governing permissions and 21 | limitations under the License. 22 | . 23 | On Debian systems, the complete text of the Apache 2.0 License 24 | can be found in /usr/share/common-licenses/Apache-2.0 file. 25 | -------------------------------------------------------------------------------- /packaging/deb/ogon/libogon-backend1-dbg.lintian-overrides: -------------------------------------------------------------------------------- 1 | libogon-backend1-dbg binary: new-package-should-close-itp-bug 2 | -------------------------------------------------------------------------------- /packaging/deb/ogon/libogon-backend1.install: -------------------------------------------------------------------------------- 1 | usr/lib/*/libogon-backend.so.* 2 | -------------------------------------------------------------------------------- /packaging/deb/ogon/libogon-backend1.lintian-overrides: -------------------------------------------------------------------------------- 1 | libogon-backend1 binary: new-package-should-close-itp-bug 2 | -------------------------------------------------------------------------------- /packaging/deb/ogon/ogon-core-dbg.lintian-overrides: -------------------------------------------------------------------------------- 1 | ogon-core-dbg binary: new-package-should-close-itp-bug 2 | -------------------------------------------------------------------------------- /packaging/deb/ogon/ogon-core.docs: -------------------------------------------------------------------------------- 1 | doc/config.md 2 | -------------------------------------------------------------------------------- /packaging/deb/ogon/ogon-core.install: -------------------------------------------------------------------------------- 1 | usr/sbin/ogon-* 2 | usr/bin/ogon-* 3 | etc/dbus-1/system.d 4 | etc/ogon 5 | usr/lib/*/ogon1 6 | -------------------------------------------------------------------------------- /packaging/deb/ogon/ogon-core.lintian-overrides: -------------------------------------------------------------------------------- 1 | ogon-core binary: new-package-should-close-itp-bug 2 | ogon-core binary: binary-without-manpage * 3 | ogon-core binary: pkg-has-shlibs-control-file-but-no-actual-shared-libs 4 | ogon-core binary: postinst-has-useless-call-to-ldconfig 5 | -------------------------------------------------------------------------------- /packaging/deb/ogon/ogon-dev.install: -------------------------------------------------------------------------------- 1 | usr/share/ogon 2 | usr/lib/*/cmake/* 3 | usr/lib/*/*.so 4 | usr/lib/*/pkgconfig/* 5 | usr/include/ogon1 6 | -------------------------------------------------------------------------------- /packaging/deb/ogon/ogon-dev.lintian-overrides: -------------------------------------------------------------------------------- 1 | ogon-dev binary: new-package-should-close-itp-bug 2 | -------------------------------------------------------------------------------- /packaging/deb/ogon/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /packaging/rpm/ogon-core-rpmlintrc: -------------------------------------------------------------------------------- 1 | setBadness("suse-dbus-unauthorized-service",0) 2 | addFilter("suse-dbus-unauthorized-service .*/etc/dbus-1/system.d/.*"); 3 | -------------------------------------------------------------------------------- /packaging/scripts/prepare_deb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ln -s packaging/deb/ogon debian 4 | -------------------------------------------------------------------------------- /protocols/protobuf/Module.proto: -------------------------------------------------------------------------------- 1 | syntax="proto2"; 2 | package ogon.module; 3 | 4 | enum MSGTYPE { 5 | ModuleStart = 300; 6 | ModuleStop = 301; 7 | ModuleGetCustomInfo = 302; 8 | ModuleConnect = 303; 9 | ModuleDisconnect = 304; 10 | PropertyBool = 305; 11 | PropertyNumber = 306; 12 | PropertyString = 307; 13 | ModuleExit = 308; 14 | } 15 | 16 | message ModuleStartRequest { 17 | required uint32 sessionId = 1; 18 | required string userName = 2; 19 | required string userDomain = 3; 20 | required string baseConfigPath = 4; 21 | required bytes envBlock = 5; 22 | required string moduleFileName = 6; 23 | required string remoteIp = 7; 24 | } 25 | 26 | message ModuleStartResponse { 27 | required string pipeName = 1; 28 | } 29 | 30 | message ModuleStopRequest { 31 | } 32 | 33 | message ModuleStopResponse { 34 | required int32 success = 1; 35 | } 36 | 37 | message ModuleGetCustomInfoRequest { 38 | } 39 | 40 | message ModuleGetCustomInfoResponse { 41 | required string info = 1; 42 | } 43 | 44 | message ModuleConnectRequest { 45 | } 46 | 47 | message ModuleConnectResponse { 48 | required int32 success = 1; 49 | } 50 | 51 | message ModuleDisconnectRequest { 52 | } 53 | 54 | message ModuleDisconnectResponse { 55 | required int32 success = 1; 56 | } 57 | 58 | message PropertyBoolRequest { 59 | required uint32 sessionId = 1; 60 | required string path = 2; 61 | } 62 | 63 | message PropertyBoolResponse { 64 | required bool success = 1; 65 | optional bool value = 2; 66 | } 67 | 68 | message PropertyNumberRequest { 69 | required uint32 sessionId = 1; 70 | required string path = 2; 71 | } 72 | 73 | message PropertyNumberResponse { 74 | required bool success = 1; 75 | optional uint32 value = 2; 76 | } 77 | 78 | message PropertyStringRequest { 79 | required uint32 sessionId = 1; 80 | required string path = 2; 81 | } 82 | 83 | message PropertyStringResponse { 84 | required bool success = 1; 85 | optional string value = 2; 86 | } 87 | 88 | message ModuleExitRequest { 89 | } 90 | 91 | message ModuleExitResponse { 92 | required bool success = 1; 93 | } 94 | -------------------------------------------------------------------------------- /protocols/protobuf/SBP.proto: -------------------------------------------------------------------------------- 1 | syntax="proto2"; 2 | package ogon.sbp; 3 | 4 | enum MSGTYPE { 5 | AuthenticateUser = 200; 6 | EndSession = 201; 7 | VersionInfo = 202; 8 | } 9 | 10 | message VersionInfoRequest { 11 | required uint32 sessionId = 1; 12 | required uint32 vmajor = 2; 13 | required uint32 vminor = 3; 14 | } 15 | 16 | message VersionInfoResponse { 17 | required uint32 vmajor = 2; 18 | required uint32 vminor = 3; 19 | } 20 | 21 | message AuthenticateUserRequest { 22 | required uint32 sessionId = 1; 23 | required string username = 2; 24 | required string password = 3; 25 | required string domain = 4; 26 | } 27 | 28 | message AuthenticateUserResponse { 29 | enum AUTH_STATUS { 30 | AUTH_SUCCESSFUL = 0; 31 | AUTH_BAD_CREDENTIALS = 1; 32 | AUTH_WRONG_SESSION_STATE = 2; 33 | AUTH_UNKNOWN_ERROR = 3; 34 | } 35 | 36 | required AUTH_STATUS authStatus = 1; 37 | } 38 | 39 | message EndSessionRequest { 40 | required uint32 sessionId = 1; 41 | } 42 | 43 | message EndSessionResponse { 44 | required bool success = 1; 45 | } 46 | -------------------------------------------------------------------------------- /protocols/protobuf/pbRPC.proto: -------------------------------------------------------------------------------- 1 | syntax="proto2"; 2 | package ogon.pbrpc; 3 | 4 | message VersionInfo { 5 | required uint32 vmajor = 1; 6 | required uint32 vminor = 2; 7 | optional string cookie = 3; 8 | } 9 | 10 | message RPCBase { 11 | required uint32 tag = 1; // Tag to identify the message 12 | required bool isResponse = 2 [default = false]; // request or response 13 | enum RPCSTATUS { 14 | SUCCESS = 0; 15 | FAILED = 1; 16 | NOTFOUND = 2; 17 | } 18 | required RPCSTATUS status = 3 [default = SUCCESS]; 19 | required uint32 msgType = 4; 20 | optional bytes payload = 5; 21 | optional string errorDescription = 6; 22 | optional VersionInfo versionInfo = 7; 23 | } 24 | -------------------------------------------------------------------------------- /rdp-server/.gitignore: -------------------------------------------------------------------------------- 1 | ogon-rdp-server 2 | -------------------------------------------------------------------------------- /rdp-server/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${CMAKE_CURRENT_BINARY_DIR}/icp) 2 | add_subdirectory(icp) 3 | 4 | set(MODULE_NAME "ogon-rdp-server") 5 | set(MODULE_PREFIX "OGON_CORE") 6 | 7 | include_directories(".") 8 | include_directories("${CMAKE_BINARY_DIR}/backend") 9 | 10 | set(${MODULE_PREFIX}_SRCS 11 | app_context.c 12 | app_context.h 13 | backend.c 14 | channels.c 15 | channels.h 16 | encoder.c 17 | encoder.h 18 | eventloop.c 19 | eventloop.h 20 | ogon.c 21 | ogon.h 22 | frontend.c 23 | graphics.c 24 | peer.c 25 | peer.h 26 | PMurHash.c 27 | PMurHash.h 28 | state.c 29 | state.h 30 | rdpgfx.c 31 | rdpgfx.h 32 | font8x8.h 33 | openh264.c 34 | openh264.h 35 | bandwidth_mgmt.c 36 | bandwidth_mgmt.h 37 | ../common/procutils.c 38 | ../common/procutils.h 39 | ) 40 | 41 | 42 | add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) 43 | 44 | list(APPEND ${MODULE_PREFIX}_LIBS freerdp) 45 | list(APPEND ${MODULE_PREFIX}_LIBS ogon-backend) 46 | list(APPEND ${MODULE_PREFIX}_LIBS ogon-icp) 47 | list(APPEND ${MODULE_PREFIX}_LIBS freerdp-server) 48 | list(APPEND ${MODULE_PREFIX}_LIBS ${OPENSSL_LIBRARIES}) 49 | list(APPEND ${MODULE_PREFIX}_LIBS winpr) 50 | list(APPEND ${MODULE_PREFIX}_LIBS ${CMAKE_DL_LIBS}) 51 | target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS} ${CMAKE_THREAD_LIBS_INIT}) 52 | 53 | install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_SBINDIR}) 54 | 55 | if(BUILD_TESTING) 56 | add_subdirectory(test) 57 | endif() 58 | -------------------------------------------------------------------------------- /rdp-server/app_context.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * RDP Server 4 | * Application Context 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Bernhard Miklautz 10 | * David Fort 11 | * 12 | * This file may be used under the terms of the GNU Affero General 13 | * Public License version 3 as published by the Free Software Foundation 14 | * and appearing in the file LICENSE-AGPL included in the distribution 15 | * of this file. 16 | * 17 | * Under the GNU Affero General Public License version 3 section 7 the 18 | * copyright holders grant the additional permissions set forth in the 19 | * ogon Core AGPL Exceptions version 1 as published by 20 | * Thincast Technologies GmbH. 21 | * 22 | * For more information see the file LICENSE in the distribution of this file. 23 | */ 24 | 25 | #ifndef _OGON_RDPSRV_APPCONTEXT_H_ 26 | #define _OGON_RDPSRV_APPCONTEXT_H_ 27 | 28 | #include 29 | 30 | #include "commondefs.h" 31 | 32 | /** @brief the global ogon context */ 33 | typedef struct _ogon_app_context { 34 | wListDictionary *connections; 35 | volatile LONG connectionId; 36 | } ogon_app_context; 37 | 38 | BOOL app_context_init(); 39 | void app_context_uninit(); 40 | long app_context_get_connectionid(); 41 | BOOL app_context_add_connection(ogon_connection *connection); 42 | void app_context_remove_connection(long id); 43 | BOOL app_context_post_message_connection(long id, UINT32 type,void *wParam, void *lParam); 44 | BOOL app_context_stop_all_connections(); 45 | 46 | #endif /* _OGON_RDPSRV_APPCONTEXT_H_ */ 47 | -------------------------------------------------------------------------------- /rdp-server/bandwidth_mgmt.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * RDP Server 4 | * Bandwidth Management 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_RDPSRV_BANDWIDTH_MGMT_H_ 25 | #define _OGON_RDPSRV_BANDWIDTH_MGMT_H_ 26 | 27 | #include 28 | #include "commondefs.h" 29 | 30 | 31 | void ogon_bwmgmt_init_buckets(ogon_connection *conn, UINT32 bitrate); 32 | UINT32 ogon_bwmgmt_update_bucket(ogon_connection *conn); 33 | BOOL ogon_bwmgmt_update_data_usage(ogon_connection *conn); 34 | UINT32 ogon_bwmgtm_calc_max_target_frame_size(ogon_connection *conn); 35 | 36 | BOOL ogon_bwmgmt_client_detect_rtt(ogon_connection *conn); 37 | BOOL ogon_bwmgmt_client_rtt_measure_response(rdpContext *context, UINT16 sequenceNumber); 38 | 39 | BOOL ogon_bwmgmt_detect_bandwidth_start(ogon_connection *conn); 40 | BOOL ogon_bwmgmt_detect_bandwidth_stop(ogon_connection *conn); 41 | BOOL ogon_bwmgmt_client_bandwidth_measure_results(rdpContext *context, UINT16 sequenceNumber); 42 | 43 | #endif /* _OGON_RDPSRV_BANDWIDTH_MGMT_H_ */ 44 | -------------------------------------------------------------------------------- /rdp-server/frontend.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * RDP Server 4 | * Frontend 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Bernhard Miklautz 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | 25 | #ifndef _OGON_RDPSRV_FRONTEND_H_ 26 | #define _OGON_RDPSRV_FRONTEND_H_ 27 | 28 | void handle_wait_timer_state(ogon_connection *conn); 29 | 30 | #endif /* _OGON_RDPSRV_FRONTEND_H_ */ 31 | -------------------------------------------------------------------------------- /rdp-server/icp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(MODULE_NAME "ogon-icp") 2 | set(MODULE_PREFIX "OGON_ICP") 3 | set(PBRPC_PREFIX "pbrpc") 4 | 5 | PROTOBUFC_GENERATE_C(ICP_PROTOC_SRC ICP_PROTOC_HDRS ${CMAKE_CURRENT_SOURCE_DIR}/../../protocols/protobuf/ICP.proto) 6 | PROTOBUFC_GENERATE_C(PBRPC_PROTOC_SRC PBRPC_PROTOC_HDRS ${CMAKE_CURRENT_SOURCE_DIR}/../../protocols/protobuf/pbRPC.proto) 7 | 8 | set(PBRPC_SRC 9 | ${PBRPC_PREFIX}/pbrpc.c 10 | ${PBRPC_PREFIX}/pbrpc_utils.c 11 | ${PBRPC_PREFIX}/pipe_transport.c 12 | ${PBRPC_PROTOC_HDRS} 13 | ${PBRPC_PROTOC_SRC} 14 | ) 15 | 16 | include_directories(${PBRPC_PREFIX}) 17 | include_directories(${CMAKE_CURRENT_BINARY_DIR}) 18 | include_directories(${CMAKE_BINARY_DIR}/backend) 19 | 20 | set(${MODULE_PREFIX}_SRCS 21 | icp.c 22 | icp_client_stubs.c 23 | icp_server_stubs.c 24 | ${ICP_PROTOC_SRC} 25 | ${ICP_PROTOC_HDRS} 26 | ${PBRPC_SRC} 27 | ) 28 | 29 | add_library(${MODULE_NAME} STATIC ${${MODULE_PREFIX}_SRCS}) 30 | 31 | 32 | target_link_libraries(${MODULE_NAME} winpr ${PROTOBUFC_LIBRARIES}) 33 | -------------------------------------------------------------------------------- /rdp-server/icp/icp_server_stubs.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Internal Communication Protocol (ICP) 4 | * Server Stubs 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Bernhard Miklautz 10 | * Martin Haimberger 11 | * 12 | * This file may be used under the terms of the GNU Affero General 13 | * Public License version 3 as published by the Free Software Foundation 14 | * and appearing in the file LICENSE-AGPL included in the distribution 15 | * of this file. 16 | * 17 | * Under the GNU Affero General Public License version 3 section 7 the 18 | * copyright holders grant the additional permissions set forth in the 19 | * ogon Core AGPL Exceptions version 1 as published by 20 | * Thincast Technologies GmbH. 21 | * 22 | * For more information see the file LICENSE in the distribution of this file. 23 | */ 24 | 25 | #ifndef _OGON_RDPSRV_ICPSERVERSTUBS_H_ 26 | #define _OGON_RDPSRV_ICPSERVERSTUBS_H_ 27 | 28 | #include "pbrpc.h" 29 | 30 | int ping(LONG tag, pbRPCPayload *request, pbRPCPayload **response); 31 | int switchTo(LONG tag, pbRPCPayload* pbrequest, pbRPCPayload** pbresponse); 32 | int logoffUserSession(LONG tag, pbRPCPayload* pbrequest, pbRPCPayload** pbresponse); 33 | int otsapiVirtualChannelOpen(LONG tag, pbRPCPayload* pbrequest, pbRPCPayload** pbresponse); 34 | int otsapiVirtualChannelClose(LONG tag, pbRPCPayload* pbrequest, pbRPCPayload** pbresponse); 35 | int otsapiStartRemoteControl(LONG tag, pbRPCPayload* pbrequest, pbRPCPayload **pbresponse); 36 | int otsapiStopRemoteControl(LONG tag, pbRPCPayload* pbrequest, pbRPCPayload **pbresponse); 37 | int message(LONG tag, pbRPCPayload* pbrequest, pbRPCPayload** pbresponse); 38 | 39 | #endif /* _OGON_RDPSRV_ICPSERVERSTUBS_H_ */ 40 | -------------------------------------------------------------------------------- /rdp-server/icp/pbrpc/pbrpc_transport.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * pbRPC: Simple Protocol Buffers based RPC 4 | * Transport Protocol Abstraction 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Bernhard Miklautz 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_RDPSRV_ICP_PBRPCTRANSPORT_H_ 25 | #define _OGON_RDPSRV_ICP_PBRPCTRANSPORT_H_ 26 | 27 | #include 28 | 29 | typedef struct pbrpc_transport_context pbRPCTransportContext; 30 | 31 | typedef int (*pTransport_open)(pbRPCTransportContext* context, int timeout); 32 | typedef int (*pTransport_close)(pbRPCTransportContext* context); 33 | typedef int (*pTransport_write)(pbRPCTransportContext* context, char* data, unsigned int datalen); 34 | typedef int (*pTransport_read)(pbRPCTransportContext* context, char* data, unsigned int datalen); 35 | typedef HANDLE (*pTransport_get_fds)(pbRPCTransportContext* context); 36 | 37 | struct pbrpc_transport_context 38 | { 39 | pTransport_open open; 40 | pTransport_close close; 41 | pTransport_read read; 42 | pTransport_write write; 43 | pTransport_get_fds get_fds; 44 | }; 45 | 46 | #endif /* _OGON_RDPSRV_ICP_PBRPCTRANSPORT_H_ */ 47 | -------------------------------------------------------------------------------- /rdp-server/icp/pbrpc/pbrpc_utils.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * pbRPC: Simple Protocol Buffers based RPC 4 | * Utility Functions 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Bernhard Miklautz 10 | * Martin Haimberger 11 | * 12 | * This file may be used under the terms of the GNU Affero General 13 | * Public License version 3 as published by the Free Software Foundation 14 | * and appearing in the file LICENSE-AGPL included in the distribution 15 | * of this file. 16 | * 17 | * Under the GNU Affero General Public License version 3 section 7 the 18 | * copyright holders grant the additional permissions set forth in the 19 | * ogon Core AGPL Exceptions version 1 as published by 20 | * Thincast Technologies GmbH. 21 | * 22 | * For more information see the file LICENSE in the distribution of this file. 23 | */ 24 | 25 | #ifndef _OGON_RDPSRV_ICP_PBRPCUTILS_H_ 26 | #define _OGON_RDPSRV_ICP_PBRPCUTILS_H_ 27 | 28 | #include "pbRPC.pb-c.h" 29 | #include "pbrpc.h" 30 | 31 | DWORD pbrpc_getTag(pbRPCContext *context); 32 | Ogon__Pbrpc__RPCBase *pbrpc_message_new(); 33 | void pbrpc_message_free(Ogon__Pbrpc__RPCBase* msg, BOOL freePayload); 34 | void pbrpc_message_free_response(Ogon__Pbrpc__RPCBase* msg); 35 | void pbrpc_prepare_request(pbRPCContext* context, Ogon__Pbrpc__RPCBase* msg); 36 | void pbrpc_prepare_response(Ogon__Pbrpc__RPCBase* msg, UINT32 tag); 37 | void pbrpc_prepare_error(Ogon__Pbrpc__RPCBase* msg, UINT32 tag, char* error); 38 | pbRPCPayload* pbrpc_payload_new(); 39 | void pbrpc_free_payload(pbRPCPayload* response); 40 | 41 | #endif /* _OGON_RDPSRV_ICP_PBRPCUTILS_H_ */ 42 | -------------------------------------------------------------------------------- /rdp-server/icp/pbrpc/pipe_transport.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * pbRPC: Simple Protocol Buffers based RPC 4 | * Named Pipe Transport 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Bernhard Miklautz 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_RDPSRV_ICP_PIPETRANSPORT_H_ 25 | #define _OGON_RDPSRV_ICP_PIPETRANSPORT_H_ 26 | 27 | #include "pbrpc.h" 28 | #include "pbrpc_transport.h" 29 | 30 | pbRPCTransportContext* tp_npipe_new(); 31 | void tp_npipe_free(pbRPCTransportContext *context); 32 | #endif /* _OGON_RDPSRV_ICP_PIPETRANSPORT_H_ */ 33 | -------------------------------------------------------------------------------- /rdp-server/openh264.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * RDP Server 4 | * OpenH264 Encoder 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Norbert Federa 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_RDPSRV_OPENH264_H_ 25 | #define _OGON_RDPSRV_OPENH264_H_ 26 | 27 | #ifdef HAVE_CONFIG_H 28 | #include "config.h" 29 | #endif 30 | 31 | #ifdef WITH_OPENH264 32 | 33 | #include 34 | 35 | typedef struct _ogon_h264_context ogon_h264_context; 36 | 37 | typedef enum _ogon_openh264_compress_mode { 38 | COMPRESS_MODE_AVC420, /* AVC420 frame only */ 39 | COMPRESS_MODE_AVC444V1_A, /* AVC444v1 step 1/2: yuv conversion and compress pic1 */ 40 | COMPRESS_MODE_AVC444V2_A, /* AVC444v2 step 1/2: yuv conversion and compress pic1 */ 41 | COMPRESS_MODE_AVC444VX_B, /* AVC444vX step 2/2: compress pic2 only */ 42 | } ogon_openh264_compress_mode; 43 | 44 | 45 | BOOL ogon_openh264_library_open(void); 46 | void ogon_openh264_library_close(void); 47 | BOOL ogon_openh264_compress(ogon_h264_context *h264, UINT32 newFrameRate, 48 | UINT32 targetFrameSizeInBits, BYTE *data, BYTE **ppDstData, 49 | UINT32 *pDstSize, ogon_openh264_compress_mode avcMode, BOOL *pOptimizable); 50 | void ogon_openh264_context_free(ogon_h264_context *h264); 51 | ogon_h264_context *ogon_openh264_context_new(UINT32 scrWidth, UINT32 scrHeight, UINT32 scrStride); 52 | 53 | 54 | #endif /* WITH_OPENH264 defined */ 55 | #endif /* _OGON_RDPSRV_OPENH264_H_ */ 56 | -------------------------------------------------------------------------------- /rdp-server/test/.gitignore: -------------------------------------------------------------------------------- 1 | TestOgonCore.c 2 | -------------------------------------------------------------------------------- /rdp-server/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | set(MODULE_NAME "TestOgonCore") 3 | set(MODULE_PREFIX "TEST_OGON_CORE") 4 | 5 | set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) 6 | 7 | set(${MODULE_PREFIX}_TESTS 8 | TestOgonEventLoop.c 9 | TestOgonTimer.c 10 | ) 11 | 12 | create_test_sourcelist(${MODULE_PREFIX}_SRCS 13 | ${${MODULE_PREFIX}_DRIVER} 14 | ${${MODULE_PREFIX}_TESTS} 15 | ) 16 | 17 | add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) 18 | 19 | target_link_libraries(${MODULE_NAME} winpr) 20 | 21 | set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") 22 | 23 | foreach(test ${${MODULE_PREFIX}_TESTS}) 24 | get_filename_component(TestName ${test} NAME_WE) 25 | add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) 26 | endforeach() 27 | 28 | set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/Test") 29 | 30 | -------------------------------------------------------------------------------- /session-manager/.gitignore: -------------------------------------------------------------------------------- 1 | ogon-session-manager 2 | gen/ 3 | -------------------------------------------------------------------------------- /session-manager/auth/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(PAM_FOUND) 2 | add_subdirectory(pam) 3 | endif() 4 | -------------------------------------------------------------------------------- /session-manager/auth/pam/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(MODULE_NAME "ogon-auth-pam") 2 | set(MODULE_PREFIX "OGON_AUTH_PAM") 3 | 4 | include_directories(${PAM_INCLUDE_DIR}) 5 | 6 | set(${MODULE_PREFIX}_SRCS 7 | pam_auth.c 8 | pam_auth.h) 9 | 10 | add_library(${MODULE_NAME} SHARED ${${MODULE_PREFIX}_SRCS}) 11 | 12 | set(${MODULE_PREFIX}_LIBS ${PAM_LIBRARY}) 13 | list(APPEND ${MODULE_PREFIX}_LIBS winpr) 14 | 15 | target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) 16 | 17 | install(TARGETS ${MODULE_NAME} DESTINATION ${OGON_AUTH_MODULE_LIB_PATH}) 18 | -------------------------------------------------------------------------------- /session-manager/auth/pam/pam_auth.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * PAM Authentication Module 4 | * 5 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 6 | * Copyright (c) 2013 Marc-Andre Moreau 7 | * 8 | * Authors: 9 | * Marc-Andre Moreau 10 | * Martin Haimberger 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | */ 24 | 25 | #ifndef _OGON_SMGR_AUTH_PAM_H_ 26 | #define _OGON_SMGR_AUTH_PAM_H_ 27 | 28 | #include "../../auth.h" 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | #define PAM_AUTH_DOMAIN "" 35 | 36 | int RdsAuthModuleEntry(RDS_AUTH_MODULE_ENTRY_POINTS* pEntryPoints); 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif /* _OGON_SMGR_AUTH_PAM_H_ */ 43 | -------------------------------------------------------------------------------- /session-manager/common/call/Call.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Baseclass of an rpc call 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifdef HAVE_CONFIG_H 25 | #include "config.h" 26 | #endif 27 | 28 | #include "Call.h" 29 | #include 30 | #include 31 | 32 | namespace ogon { namespace sessionmanager { namespace call { 33 | 34 | Call::Call():mTag(0), mResult(0) { 35 | } 36 | 37 | Call::~Call() { 38 | } 39 | 40 | void Call::setTag(uint32_t tag) { 41 | mTag = tag; 42 | } 43 | 44 | uint32_t Call::getTag() { 45 | return mTag; 46 | } 47 | 48 | uint32_t Call::getResult() { 49 | return mResult; 50 | } 51 | 52 | std::string Call::getErrorDescription() { 53 | return mErrorDescription; 54 | } 55 | 56 | } /*call*/ } /*sessionmanager*/ } /*call*/ 57 | -------------------------------------------------------------------------------- /session-manager/common/call/Call.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Baseclass of an rpc call 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_CALL_CALL_H_ 25 | #define _OGON_SMGR_CALL_CALL_H_ 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | namespace ogon { namespace sessionmanager { namespace call { 32 | 33 | class Call: public std::enable_shared_from_this { 34 | public: 35 | Call(); 36 | virtual ~Call(); 37 | 38 | virtual unsigned long getCallType() const = 0; 39 | 40 | void setTag(uint32_t tag); 41 | uint32_t getTag(); 42 | 43 | uint32_t getResult(); 44 | std::string getErrorDescription(); 45 | 46 | void abort() { 47 | mResult = -2; 48 | } 49 | 50 | private: 51 | uint32_t mTag; 52 | protected: 53 | std::string mEncodedRequest; 54 | std::string mEncodedResponse; 55 | 56 | uint32_t mResult; 57 | // this is used if result ist not 0 58 | std::string mErrorDescription; 59 | }; 60 | 61 | typedef std::shared_ptr CallPtr; 62 | 63 | } /*call*/ } /*sessionmanager*/ } /*ogon*/ 64 | 65 | namespace callNS = ogon::sessionmanager::call; 66 | 67 | #endif /* _OGON_SMGR_CALL_CALL_H_ */ 68 | -------------------------------------------------------------------------------- /session-manager/common/call/CallFactory.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Factory for rpc calls 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifdef HAVE_CONFIG_H 25 | #include "config.h" 26 | #endif 27 | 28 | #include "CallFactory.h" 29 | 30 | namespace ogon { namespace sessionmanager { namespace call { 31 | 32 | CallFactory::CallFactory() { 33 | } 34 | 35 | CallFactory::~CallFactory() { 36 | } 37 | 38 | } /*call*/ } /*sessionmanager*/ } /*ogon*/ 39 | -------------------------------------------------------------------------------- /session-manager/common/call/CallFactory.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Factory for rpc calls 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_CALL_CALLFACTORY_H_ 25 | #define _OGON_SMGR_CALL_CALLFACTORY_H_ 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | #include 32 | 33 | #define CALL_FACTORY ogon::sessionmanager::call::CallFactory::instance() 34 | 35 | namespace ogon { namespace sessionmanager { namespace call { 36 | 37 | /** 38 | * @class PacketFactory. 39 | * 40 | * @brief Factory for creating packetes. 41 | * 42 | * @author Martin Haimberger 43 | */ 44 | 45 | class CallFactory :public FactoryBase, public SingletonBase { 46 | SINGLETON_ADD_INITIALISATION(CallFactory) 47 | }; 48 | 49 | } /*call*/ } /*sessionmanager*/ } /*ogon*/ 50 | 51 | namespace callNS = ogon::sessionmanager::call; 52 | 53 | #endif /* _OGON_SMGR_CALL_CALLFACTORY_H_ */ 54 | -------------------------------------------------------------------------------- /session-manager/common/call/CallIn.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Baseclass for incoming rpc calls (ogon to session manager) 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_CALL_CALLIN_H_ 25 | #define _OGON_SMGR_CALL_CALLIN_H_ 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | namespace ogon { namespace sessionmanager { namespace call { 32 | 33 | /** 34 | * @brief 35 | */ 36 | class CallIn: public Call { 37 | public: 38 | CallIn(); 39 | virtual ~CallIn(); 40 | 41 | void setEncodedRequest(const std::string &encodedRequest); 42 | virtual bool decodeRequest() = 0; 43 | 44 | virtual bool encodeResponse() = 0; 45 | std::string getEncodedResponse() const; 46 | std::shared_ptr shared_from_this(); 47 | 48 | virtual bool prepare() {return true;}; 49 | virtual bool doStuff() = 0; 50 | protected: 51 | bool putInSessionExecutor_conId(UINT32 connectionId); 52 | bool putInSessionExecutor_sesId(UINT32 sessionId); 53 | }; 54 | 55 | typedef std::shared_ptr CallInPtr; 56 | 57 | } /*call*/ } /*sessionmanager*/ } /*ogon*/ 58 | 59 | namespace callNS = ogon::sessionmanager::call; 60 | 61 | #endif // _OGON_SMGR_CALL_CALLIN_H_ 62 | -------------------------------------------------------------------------------- /session-manager/common/call/CallInAuthenticateUser.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Class for rpc call AuthenticateUser (backend to session manager over SBP) 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_CALL_CALLINAUTHENTICATEUSER_H_ 25 | #define _OGON_SMGR_CALL_CALLINAUTHENTICATEUSER_H_ 26 | 27 | #include 28 | 29 | #include "CallFactory.h" 30 | #include 31 | #include "CallIn.h" 32 | #include 33 | 34 | namespace ogon { namespace sessionmanager { namespace call { 35 | 36 | /** 37 | * @brief 38 | */ 39 | class CallInAuthenticateUser: public CallIn { 40 | public: 41 | CallInAuthenticateUser(); 42 | virtual ~CallInAuthenticateUser(); 43 | 44 | virtual unsigned long getCallType() const; 45 | virtual bool decodeRequest(); 46 | virtual bool encodeResponse(); 47 | virtual bool prepare(); 48 | virtual bool doStuff(); 49 | 50 | private: 51 | 52 | std::string mUserName; 53 | std::string mDomainName; 54 | std::string mPassword; 55 | 56 | int mAuthStatus; 57 | UINT32 mSessionId; 58 | std::string mPipeName; 59 | }; 60 | 61 | FACTORY_REGISTER_DWORD(CallFactory, CallInAuthenticateUser, ogon::sbp::AuthenticateUser); 62 | 63 | } /*call*/ } /*sessionmanager*/ } /*ogon*/ 64 | 65 | namespace callNS = ogon::sessionmanager::call; 66 | 67 | #endif /* _OGON_SMGR_CALL_CALLINAUTHENTICATEUSER_H_ */ 68 | -------------------------------------------------------------------------------- /session-manager/common/call/CallInDisconnectUserSession.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Class for rpc call DisconnectUserSession (ogon to session manager) 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_CALL_CALLINDISCONNECTUSERSESSION_H_ 25 | #define _OGON_SMGR_CALL_CALLINDISCONNECTUSERSESSION_H_ 26 | 27 | #include "CallFactory.h" 28 | #include 29 | #include "CallIn.h" 30 | #include 31 | #include 32 | 33 | namespace ogon { namespace sessionmanager { namespace call { 34 | 35 | /** 36 | * @brief 37 | */ 38 | class CallInDisconnectUserSession: public CallIn { 39 | public: 40 | CallInDisconnectUserSession(); 41 | virtual ~CallInDisconnectUserSession(); 42 | 43 | virtual unsigned long getCallType() const; 44 | virtual bool decodeRequest(); 45 | virtual bool encodeResponse(); 46 | virtual bool prepare(); 47 | virtual bool doStuff(); 48 | 49 | private: 50 | 51 | UINT32 mConnectionId; 52 | bool mDisconnected; 53 | }; 54 | 55 | FACTORY_REGISTER_DWORD(CallFactory, CallInDisconnectUserSession, ogon::icp::DisconnectUserSession); 56 | 57 | } /*call*/ } /*sessionmanager*/ } /*ogon*/ 58 | 59 | namespace callNS = ogon::sessionmanager::call; 60 | 61 | #endif /* _OGON_SMGR_CALL_CALLINDISCONNECTUSERSESSION_H_ */ 62 | -------------------------------------------------------------------------------- /session-manager/common/call/CallInEndSession.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Class for rpc call CallInEndSession (service to session manager) 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_CALL_CALLINENDSESSION_H_ 25 | #define _OGON_SMGR_CALL_CALLINENDSESSION_H_ 26 | 27 | #include "CallFactory.h" 28 | #include 29 | #include "CallIn.h" 30 | #include 31 | 32 | namespace ogon { namespace sessionmanager { namespace call { 33 | 34 | /** 35 | * @brief 36 | */ 37 | class CallInEndSession: public CallIn { 38 | public: 39 | CallInEndSession(); 40 | virtual ~CallInEndSession(); 41 | 42 | virtual unsigned long getCallType() const; 43 | virtual bool decodeRequest(); 44 | virtual bool encodeResponse(); 45 | virtual bool prepare(); 46 | virtual bool doStuff(); 47 | 48 | private: 49 | UINT32 mSessionId; 50 | bool mSuccess; 51 | }; 52 | 53 | FACTORY_REGISTER_DWORD(CallFactory, CallInEndSession, ogon::sbp::EndSession); 54 | 55 | } /*call*/ } /*sessionmanager*/ } /*ogon*/ 56 | 57 | namespace callNS = ogon::sessionmanager::call; 58 | 59 | #endif /* _OGON_SMGR_CALL_CALLINENDSESSION_H_ */ 60 | -------------------------------------------------------------------------------- /session-manager/common/call/CallInPing.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Class for ping rpc call (ogon to session manager) 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Bernhard Miklautz 10 | * Martin Haimberger 11 | * 12 | * This file may be used under the terms of the GNU Affero General 13 | * Public License version 3 as published by the Free Software Foundation 14 | * and appearing in the file LICENSE-AGPL included in the distribution 15 | * of this file. 16 | * 17 | * Under the GNU Affero General Public License version 3 section 7 the 18 | * copyright holders grant the additional permissions set forth in the 19 | * ogon Core AGPL Exceptions version 1 as published by 20 | * Thincast Technologies GmbH. 21 | * 22 | * For more information see the file LICENSE in the distribution of this file. 23 | */ 24 | 25 | #ifdef HAVE_CONFIG_H 26 | #include "config.h" 27 | #endif 28 | 29 | #include "CallInPing.h" 30 | 31 | using ogon::icp::PingRequest; 32 | using ogon::icp::PingResponse; 33 | 34 | namespace ogon { namespace sessionmanager { namespace call { 35 | 36 | CallInPing::CallInPing() { 37 | } 38 | 39 | CallInPing::~CallInPing() { 40 | } 41 | 42 | unsigned long CallInPing::getCallType() const { 43 | return ogon::icp::Ping; 44 | } 45 | 46 | bool CallInPing::decodeRequest() { 47 | // decode protocol buffers 48 | PingRequest req; 49 | 50 | if (!req.ParseFromString(mEncodedRequest)) { 51 | // failed to parse 52 | mResult = 1;// will report error with answer 53 | return false; 54 | } 55 | return true; 56 | } 57 | 58 | bool CallInPing::encodeResponse() { 59 | // encode protocol buffers 60 | PingResponse resp; 61 | resp.set_pong(true); 62 | 63 | if (!resp.SerializeToString(&mEncodedResponse)) { 64 | // failed to serialize 65 | mResult = 1; 66 | return false; 67 | } 68 | return true; 69 | } 70 | 71 | bool CallInPing::doStuff() { 72 | return true; 73 | } 74 | 75 | } /*call*/ } /*sessionmanager*/ } /*ogon*/ 76 | -------------------------------------------------------------------------------- /session-manager/common/call/CallInPing.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Class for ping rpc call (ogon to session manager) 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Bernhard Miklautz 10 | * Martin Haimberger 11 | * 12 | * This file may be used under the terms of the GNU Affero General 13 | * Public License version 3 as published by the Free Software Foundation 14 | * and appearing in the file LICENSE-AGPL included in the distribution 15 | * of this file. 16 | * 17 | * Under the GNU Affero General Public License version 3 section 7 the 18 | * copyright holders grant the additional permissions set forth in the 19 | * ogon Core AGPL Exceptions version 1 as published by 20 | * Thincast Technologies GmbH. 21 | * 22 | * For more information see the file LICENSE in the distribution of this file. 23 | */ 24 | 25 | #ifndef _OGON_SMGR_CALL_CALLINPING_H_ 26 | #define _OGON_SMGR_CALL_CALLINPING_H_ 27 | 28 | #include "CallFactory.h" 29 | #include 30 | #include "CallIn.h" 31 | #include 32 | 33 | namespace ogon { namespace sessionmanager { namespace call { 34 | 35 | /** 36 | * @brief 37 | */ 38 | class CallInPing: public CallIn { 39 | public: 40 | CallInPing(); 41 | virtual ~CallInPing(); 42 | 43 | virtual unsigned long getCallType() const; 44 | virtual bool decodeRequest(); 45 | virtual bool encodeResponse(); 46 | virtual bool doStuff(); 47 | }; 48 | 49 | FACTORY_REGISTER_DWORD(CallFactory, CallInPing, ogon::icp::Ping); 50 | 51 | } /*call*/ } /*sessionmanager*/ } /*ogon*/ 52 | 53 | namespace callNS = ogon::sessionmanager::call; 54 | 55 | #endif /* _OGON_SMGR_CALL_CALLINPING_H_ */ 56 | -------------------------------------------------------------------------------- /session-manager/common/call/CallInPropertyBool.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Class for rpc call GetPropertyBool (ogon to session manager) 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_CALL_CALLINPROPERTYBOOL_H_ 25 | #define _OGON_SMGR_CALL_CALLINPROPERTYBOOL_H_ 26 | 27 | #include "CallFactory.h" 28 | #include 29 | #include "CallIn.h" 30 | #include 31 | 32 | #include 33 | 34 | namespace ogon { namespace sessionmanager { namespace call { 35 | 36 | /** 37 | * @brief 38 | */ 39 | class CallInPropertyBool: public CallIn { 40 | public: 41 | CallInPropertyBool(); 42 | virtual ~CallInPropertyBool(); 43 | 44 | virtual unsigned long getCallType() const; 45 | virtual bool decodeRequest(); 46 | virtual bool encodeResponse(); 47 | virtual bool prepare(); 48 | virtual bool doStuff(); 49 | 50 | 51 | private: 52 | std::string mPropertyPath; 53 | UINT32 mConnectionId; 54 | bool mFound; 55 | bool mValue; 56 | }; 57 | 58 | FACTORY_REGISTER_DWORD(CallFactory, CallInPropertyBool, ogon::icp::PropertyBool); 59 | 60 | } /*call*/ } /*sessionmanager*/ } /*ogon*/ 61 | 62 | namespace callNS = ogon::sessionmanager::call; 63 | 64 | #endif /* _OGON_SMGR_CALL_CALLINPROPERTYBOOL_H_ */ 65 | -------------------------------------------------------------------------------- /session-manager/common/call/CallInPropertyNumber.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Class for rpc call GetPropertyNumber (ogon to session manager) 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_CALL_CALLINPROPERTYNUMBER_H_ 25 | #define _OGON_SMGR_CALL_CALLINPROPERTYNUMBER_H_ 26 | 27 | #include "CallFactory.h" 28 | #include 29 | #include "CallIn.h" 30 | #include 31 | 32 | #include 33 | 34 | namespace ogon { namespace sessionmanager { namespace call { 35 | 36 | /** 37 | * @brief 38 | */ 39 | class CallInPropertyNumber: public CallIn { 40 | public: 41 | CallInPropertyNumber(); 42 | virtual ~CallInPropertyNumber(); 43 | 44 | virtual unsigned long getCallType() const; 45 | virtual bool decodeRequest(); 46 | virtual bool encodeResponse(); 47 | virtual bool prepare(); 48 | virtual bool doStuff(); 49 | 50 | private: 51 | std::string mPropertyPath; 52 | UINT32 mConnectionId; 53 | bool mFound; 54 | long mValue; 55 | 56 | }; 57 | 58 | FACTORY_REGISTER_DWORD(CallFactory, CallInPropertyNumber, ogon::icp::PropertyNumber); 59 | 60 | } /*call*/ } /*sessionmanager*/ } /*ogon*/ 61 | 62 | namespace callNS = ogon::sessionmanager::call; 63 | 64 | #endif /* _OGON_SMGR_CALL_CALLINPROPERTYNUMBER_H_ */ 65 | -------------------------------------------------------------------------------- /session-manager/common/call/CallInPropertyString.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Class for rpc call GetPropertyString (ogon to session manager) 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_CALL_CALLINPROPERTYSTRING_H_ 25 | #define _OGON_SMGR_CALL_CALLINPROPERTYSTRING_H_ 26 | 27 | #include "CallFactory.h" 28 | #include 29 | #include "CallIn.h" 30 | #include 31 | 32 | #include 33 | 34 | namespace ogon { namespace sessionmanager { namespace call { 35 | 36 | /** 37 | * @brief 38 | */ 39 | class CallInPropertyString: public CallIn { 40 | public: 41 | CallInPropertyString(); 42 | virtual ~CallInPropertyString(); 43 | 44 | virtual unsigned long getCallType() const; 45 | virtual bool decodeRequest(); 46 | virtual bool encodeResponse(); 47 | virtual bool prepare(); 48 | virtual bool doStuff(); 49 | 50 | private: 51 | std::string mPropertyPath; 52 | UINT32 mConnectionId; 53 | bool mFound; 54 | std::string mValue; 55 | 56 | }; 57 | 58 | FACTORY_REGISTER_DWORD(CallFactory, CallInPropertyString, ogon::icp::PropertyString); 59 | 60 | } /*call*/ } /*sessionmanager*/ } /*ogon*/ 61 | 62 | namespace callNS = ogon::sessionmanager::call; 63 | 64 | #endif /* _OGON_SMGR_CALL_CALLINPROPERTYSTRING_H_ */ 65 | -------------------------------------------------------------------------------- /session-manager/common/call/CallInRemoteControlEnded.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Call sent from ogon when shadowing was stopped for a connection 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Bernhard Miklautz 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_CALL_CALLINREMOTECONTROLENDED_H_ 25 | #define _OGON_SMGR_CALL_CALLINREMOTECONTROLENDED_H_ 26 | 27 | #include "CallFactory.h" 28 | #include "CallIn.h" 29 | #include 30 | 31 | namespace ogon { 32 | namespace sessionmanager { 33 | namespace call { 34 | 35 | /** 36 | * @brief 37 | */ 38 | class CallInRemoteControlEnded: public CallIn { 39 | public: 40 | CallInRemoteControlEnded(); 41 | virtual ~CallInRemoteControlEnded(); 42 | 43 | virtual unsigned long getCallType() const; 44 | virtual bool decodeRequest(); 45 | virtual bool prepare(); 46 | virtual bool doStuff(); 47 | virtual bool encodeResponse(); 48 | private: 49 | UINT32 mConnectionId; 50 | UINT32 mConnectionIdTarget; 51 | bool mSuccess; 52 | }; 53 | 54 | FACTORY_REGISTER_DWORD(CallFactory, CallInRemoteControlEnded, ogon::icp::RemoteControlEnded); 55 | 56 | } /*call*/ 57 | } /*sessionmanager*/ 58 | } /*ogon*/ 59 | 60 | namespace callNS = ogon::sessionmanager::call; 61 | 62 | #endif /* _OGON_SMGR_CALL_CALLINREMOTECONTROLENDED_H_ */ 63 | -------------------------------------------------------------------------------- /session-manager/common/call/CallInSBPVersion.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Class for rpc call SBP Version (ogon to session manager) 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_CALL_CALLINSBPVERSION_H_ 25 | #define _OGON_SMGR_CALL_CALLINSBPVERSION_H_ 26 | 27 | #include "CallFactory.h" 28 | #include 29 | #include "CallIn.h" 30 | #include 31 | #include 32 | 33 | namespace ogon { namespace sessionmanager { namespace call { 34 | 35 | /** 36 | * @brief 37 | */ 38 | class CallInSBPVersion: public CallIn, public ogon::sessionmanager::session::SessionAccessor { 39 | public: 40 | CallInSBPVersion(); 41 | virtual ~CallInSBPVersion(); 42 | 43 | virtual unsigned long getCallType() const; 44 | virtual bool decodeRequest(); 45 | virtual bool encodeResponse(); 46 | virtual bool prepare(); 47 | virtual bool doStuff(); 48 | 49 | private: 50 | UINT32 mSessionId; 51 | UINT32 mVersionMajor; 52 | UINT32 mVersionMinor; 53 | }; 54 | 55 | FACTORY_REGISTER_DWORD(CallFactory, CallInSBPVersion, ogon::sbp::VersionInfo); 56 | 57 | } /*call*/ } /*sessionmanager*/ } /*ogon*/ 58 | 59 | namespace callNS = ogon::sessionmanager::call; 60 | 61 | #endif /* _OGON_SMGR_CALL_CALLINSBPVERSION_H_ */ 62 | -------------------------------------------------------------------------------- /session-manager/common/call/CallOut.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Baseclass for outgoing rpc calls (session manager to ogon) 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifdef HAVE_CONFIG_H 25 | #include "config.h" 26 | #endif 27 | 28 | #include "CallOut.h" 29 | #include 30 | #include 31 | 32 | namespace ogon { namespace sessionmanager { namespace call { 33 | 34 | CallOut::CallOut() : mAnswer(NULL) { 35 | initAnswerHandle(); 36 | } 37 | 38 | CallOut::~CallOut() { 39 | if (mAnswer) { 40 | CloseHandle(mAnswer); 41 | mAnswer = NULL; 42 | } 43 | } 44 | 45 | std::string CallOut::getEncodedRequest() const { 46 | return mEncodedRequest; 47 | } 48 | 49 | void CallOut::setEncodedeResponse(const std::string &encodedResponse) { 50 | mEncodedResponse = encodedResponse; 51 | } 52 | 53 | void CallOut::initAnswerHandle() { 54 | if (mAnswer == NULL) { 55 | if (!(mAnswer = CreateEvent(NULL, TRUE, FALSE, NULL))) { 56 | throw std::bad_alloc(); 57 | } 58 | } 59 | } 60 | 61 | HANDLE CallOut::getAnswerHandle() { 62 | return mAnswer; 63 | } 64 | 65 | void CallOut::setResult(uint32_t result) { 66 | mResult = result; 67 | SetEvent(mAnswer); 68 | } 69 | 70 | void CallOut::setErrorDescription(const std::string &error) { 71 | mErrorDescription = error; 72 | } 73 | 74 | } /*call*/ } /*sessionmanager*/ } /*ogon*/ 75 | -------------------------------------------------------------------------------- /session-manager/common/call/CallOut.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Baseclass for outgoing rpc calls (session manager to ogon) 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_CALL_CALLOUT_H_ 25 | #define _OGON_SMGR_CALL_CALLOUT_H_ 26 | 27 | #include 28 | #include 29 | 30 | namespace ogon { namespace sessionmanager { namespace call { 31 | 32 | class CallOut : public Call { 33 | public: 34 | CallOut(); 35 | ~CallOut(); 36 | 37 | virtual bool encodeRequest() = 0; 38 | std::string getEncodedRequest() const; 39 | 40 | void setEncodedeResponse(const std::string &encodedResponse); 41 | virtual bool decodeResponse() = 0; 42 | 43 | void initAnswerHandle(); 44 | HANDLE getAnswerHandle(); 45 | 46 | void setResult(uint32_t result); 47 | void setErrorDescription(const std::string &error); 48 | 49 | private : 50 | HANDLE mAnswer; 51 | }; 52 | 53 | typedef std::shared_ptr CallOutPtr; 54 | 55 | } /*call*/ } /*sessionmanager*/ } /*ogon*/ 56 | 57 | namespace callNS = ogon::sessionmanager::call; 58 | 59 | 60 | #endif /* _OGON_SMGR_CALL_CALLOUT_H_ */ 61 | -------------------------------------------------------------------------------- /session-manager/common/call/CallOutDisconnectUserSession.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Class for rpc call DisconnectUserSession (session manager to ogon) 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_CALL_CALLOUTDISCONNECTUSERSESSION_H_ 25 | #define _OGON_SMGR_CALL_CALLOUTDISCONNECTUSERSESSION_H_ 26 | 27 | #include 28 | #include "CallOut.h" 29 | #include 30 | 31 | namespace ogon { namespace sessionmanager { namespace call { 32 | 33 | /** 34 | * @brief 35 | */ 36 | class CallOutDisconnectUserSession: public CallOut { 37 | public: 38 | CallOutDisconnectUserSession(); 39 | virtual ~CallOutDisconnectUserSession(); 40 | 41 | virtual unsigned long getCallType() const; 42 | virtual bool encodeRequest(); 43 | virtual bool decodeResponse(); 44 | 45 | void setConnectionId(UINT32 connectionId); 46 | bool isDisconnected(); 47 | 48 | private: 49 | UINT32 mConnectionId; 50 | bool mDisconnected; 51 | }; 52 | 53 | typedef std::shared_ptr CallOutDisconnectUserSessionPtr; 54 | 55 | } /*call*/ } /*sessionmanager*/ } /*ogon*/ 56 | 57 | namespace callNS = ogon::sessionmanager::call; 58 | 59 | #endif /* _OGON_SMGR_CALL_CALLOUTDISCONNECTUSERSESSION_H_ */ 60 | -------------------------------------------------------------------------------- /session-manager/common/call/CallOutLogOffUserSession.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Class for rpc call LogOffUserSession (session manager to ogon) 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_CALL_CALLOUTLOGOFFUSERSESSION_H_ 25 | #define _OGON_SMGR_CALL_CALLOUTLOGOFFUSERSESSION_H_ 26 | 27 | #include 28 | #include "CallOut.h" 29 | #include 30 | 31 | namespace ogon { namespace sessionmanager { namespace call { 32 | 33 | /** 34 | * @brief 35 | */ 36 | class CallOutLogOffUserSession: public CallOut { 37 | public: 38 | CallOutLogOffUserSession(); 39 | virtual ~CallOutLogOffUserSession(); 40 | 41 | virtual unsigned long getCallType() const; 42 | virtual bool encodeRequest(); 43 | virtual bool decodeResponse(); 44 | 45 | void setConnectionId(UINT32 connectionId); 46 | bool isLoggedOff(); 47 | 48 | private: 49 | UINT32 mConnectionId; 50 | bool mLoggedOff; 51 | }; 52 | 53 | typedef std::shared_ptr CallOutLogOffUserSessionPtr; 54 | 55 | } /*call*/ } /*sessionmanager*/ } /*ogon*/ 56 | 57 | namespace callNS = ogon::sessionmanager::call; 58 | 59 | #endif /* _OGON_SMGR_CALL_CALLOUTLOGOFFUSERSESSION_H_ */ 60 | -------------------------------------------------------------------------------- /session-manager/common/call/CallOutOtsApiStartRemoteControl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Class for rpc call StartRemoteControl (session manager to ogon) 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_CALL_CALLOUTOTSAPISTARTREMOTECONTROL_H_ 25 | #define _OGON_SMGR_CALL_CALLOUTOTSAPISTARTREMOTECONTROL_H_ 26 | 27 | #include 28 | #include "CallOut.h" 29 | #include 30 | 31 | namespace ogon { namespace sessionmanager { namespace call { 32 | 33 | /** 34 | * @brief 35 | */ 36 | class CallOutOtsStartRemoteControl: public CallOut { 37 | public: 38 | CallOutOtsStartRemoteControl(); 39 | virtual ~CallOutOtsStartRemoteControl(); 40 | 41 | virtual unsigned long getCallType() const; 42 | 43 | virtual bool encodeRequest(); 44 | virtual bool decodeResponse(); 45 | 46 | void setConnectionId(UINT32 connectionId); 47 | void setTargetConnectionId(UINT32 connectionId); 48 | void setHotkeyVk(BYTE hotkey); 49 | void setHotkeyModifiers(UINT16 modifier); 50 | void setFlags(DWORD flags); 51 | 52 | bool isSuccess(); 53 | 54 | private: 55 | UINT32 mConnectionId; 56 | UINT32 mTargetConnectionId; 57 | BYTE mHotkey; 58 | UINT16 mModifiers; 59 | DWORD mFlags; 60 | 61 | bool mSuccess; 62 | }; 63 | 64 | typedef std::shared_ptr CallOutOtsStartRemoteControlPtr; 65 | 66 | } /*call*/ } /*sessionmanager*/ } /*ogon*/ 67 | 68 | namespace callNS = ogon::sessionmanager::call; 69 | 70 | #endif /* _OGON_SMGR_CALL_CALLOUTOTSAPISTARTREMOTECONTROL_H_ */ 71 | -------------------------------------------------------------------------------- /session-manager/common/call/CallOutOtsApiStopRemoteControl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Class for rpc call StopRemoteControl (session manager to ogon) 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_CALL_CALLOUTOTSAPISTOPREMOTECONTROL_H_ 25 | #define _OGON_SMGR_CALL_CALLOUTOTSAPISTOPREMOTECONTROL_H_ 26 | 27 | #include 28 | #include "CallOut.h" 29 | #include 30 | 31 | namespace ogon { namespace sessionmanager { namespace call { 32 | 33 | /** 34 | * @brief 35 | */ 36 | class CallOutOtsApiStopRemoteControl: public CallOut { 37 | public: 38 | CallOutOtsApiStopRemoteControl(); 39 | virtual ~CallOutOtsApiStopRemoteControl(); 40 | 41 | virtual unsigned long getCallType() const; 42 | 43 | virtual bool encodeRequest(); 44 | virtual bool decodeResponse(); 45 | 46 | void setConnectionId(UINT32 connectionId); 47 | bool isSuccess(); 48 | 49 | private: 50 | UINT32 mConnectionId; 51 | bool mSuccess; 52 | }; 53 | 54 | typedef std::shared_ptr CallOutOtsApiStopRemoteControlPtr; 55 | 56 | } /*call*/ } /*sessionmanager*/ } /*ogon*/ 57 | 58 | namespace callNS = ogon::sessionmanager::call; 59 | 60 | #endif /* _OGON_SMGR_CALL_CALLOUTOTSAPISTOPREMOTECONTROL_H_ */ 61 | -------------------------------------------------------------------------------- /session-manager/common/call/CallOutOtsApiVirtualChannelClose.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Class for rpc call CallOutOtsApiVirtualChannelClose (session manager to ogon) 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_CALL_CALLOUTOTSAPIVIRTUALCHANNELCLOSE_H_ 25 | #define _OGON_SMGR_CALL_CALLOUTOTSAPIVIRTUALCHANNELCLOSE_H_ 26 | 27 | #include 28 | #include "CallOut.h" 29 | #include 30 | 31 | namespace ogon { namespace sessionmanager { namespace call { 32 | 33 | /** 34 | * @brief 35 | */ 36 | class CallOutOtsApiVirtualChannelClose: public CallOut { 37 | public: 38 | CallOutOtsApiVirtualChannelClose(); 39 | virtual ~CallOutOtsApiVirtualChannelClose(); 40 | 41 | virtual unsigned long getCallType() const; 42 | 43 | virtual bool encodeRequest(); 44 | virtual bool decodeResponse(); 45 | 46 | void setConnectionID(UINT32 ConnectionID); 47 | void setVirtualName(const std::string &virtualName); 48 | void setInstance(DWORD instance); 49 | bool getSuccess() const; 50 | 51 | private: 52 | UINT32 mConnectionID; 53 | std::string mVirtualName; 54 | DWORD mInstance; 55 | bool mSuccess; 56 | }; 57 | 58 | typedef std::shared_ptr CallOutOtsApiVirtualChannelClosePtr; 59 | 60 | } /*call*/ } /*sessionmanager*/ } /*ogon*/ 61 | 62 | namespace callNS = ogon::sessionmanager::call; 63 | 64 | #endif /* _OGON_SMGR_CALL_CALLOUTOTSAPIVIRTUALCHANNELCLOSE_H_ */ 65 | -------------------------------------------------------------------------------- /session-manager/common/call/CallOutPing.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Class for ping rpc call (session manager to ogon) 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifdef HAVE_CONFIG_H 25 | #include "config.h" 26 | #endif 27 | 28 | #include "CallOutPing.h" 29 | 30 | using ogon::icp::PingRequest; 31 | using ogon::icp::PingResponse; 32 | 33 | namespace ogon { namespace sessionmanager { namespace call { 34 | 35 | CallOutPing::CallOutPing() { 36 | mPong = false; 37 | } 38 | 39 | CallOutPing::~CallOutPing(){ 40 | } 41 | 42 | unsigned long CallOutPing::getCallType() const { 43 | return ogon::icp::Ping; 44 | } 45 | 46 | bool CallOutPing::encodeRequest() { 47 | // decode protocol buffers 48 | PingRequest req; 49 | 50 | if (!req.SerializeToString(&mEncodedRequest)) { 51 | // failed to serialize 52 | mResult = 1; 53 | return false; 54 | } 55 | return true; 56 | } 57 | 58 | bool CallOutPing::decodeResponse() { 59 | // encode protocol buffers 60 | PingResponse resp; 61 | 62 | if (!resp.ParseFromString(mEncodedResponse)) { 63 | // failed to serialize 64 | mResult = 1; 65 | return false; 66 | } 67 | mPong = resp.pong(); 68 | return true; 69 | } 70 | 71 | bool CallOutPing::getPong() { 72 | return mPong; 73 | } 74 | 75 | } /*call*/ } /*sessionmanager*/ } /*ogon*/ 76 | -------------------------------------------------------------------------------- /session-manager/common/call/CallOutPing.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Class for rpc call Ping (session manager to ogon) 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_CALL_CALLOUTPING_H_ 25 | #define _OGON_SMGR_CALL_CALLOUTPING_H_ 26 | 27 | #include 28 | #include "CallOut.h" 29 | #include 30 | 31 | namespace ogon { namespace sessionmanager { namespace call { 32 | 33 | /** 34 | * @brief 35 | */ 36 | class CallOutPing: public CallOut { 37 | public: 38 | CallOutPing(); 39 | virtual ~CallOutPing(); 40 | 41 | virtual unsigned long getCallType() const; 42 | 43 | virtual bool encodeRequest(); 44 | virtual bool decodeResponse(); 45 | 46 | bool getPong(); 47 | 48 | private: 49 | bool mPong; 50 | }; 51 | 52 | } /*call*/ } /*sessionmanager*/ } /*ogon*/ 53 | 54 | namespace callNS = ogon::sessionmanager::call; 55 | 56 | #endif /* _OGON_SMGR_CALL_CALLOUTPING_H_ */ 57 | -------------------------------------------------------------------------------- /session-manager/common/call/CallOutSwitchTo.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Class for rpc call SwitchTo (session manager to ogon) 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_CALL_CALLOUTSWITCHTO_H_ 25 | #define _OGON_SMGR_CALL_CALLOUTSWITCHTO_H_ 26 | 27 | #include 28 | #include "CallOut.h" 29 | #include 30 | 31 | namespace ogon { namespace sessionmanager { namespace call { 32 | 33 | /** 34 | * @brief 35 | */ 36 | class CallOutSwitchTo: public CallOut { 37 | public: 38 | CallOutSwitchTo(); 39 | virtual ~CallOutSwitchTo(); 40 | 41 | virtual unsigned long getCallType() const; 42 | 43 | virtual bool encodeRequest(); 44 | virtual bool decodeResponse(); 45 | 46 | void setConnectionId(UINT32 connectionId); 47 | void setServiceEndpoint(const std::string &serviceEndpoint, const std::string &ogonCookie, 48 | const std::string &backendCookie); 49 | void setMaxWidth(long width); 50 | void setMaxHeight(long height); 51 | 52 | bool isSuccess(); 53 | 54 | private: 55 | UINT32 mConnectionId; 56 | long mMaxWidth; 57 | long mMaxHeight; 58 | std::string mServiceEndpoint; 59 | std::string mOgonCookie; 60 | std::string mBackendCookie; 61 | bool mSuccess; 62 | }; 63 | 64 | typedef std::shared_ptr CallOutSwitchToPtr; 65 | 66 | } /*call*/ } /*sessionmanager*/ } /*ogon*/ 67 | 68 | namespace callNS = ogon::sessionmanager::call; 69 | 70 | #endif /* _OGON_SMGR_CALL_CALLOUTSWITCHTO_H_ */ 71 | -------------------------------------------------------------------------------- /session-manager/common/call/TaskAuthenticateUser.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * call task for authenticating a user 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_CALL_TASKCALLINAUTHENTICATEUSER_H_ 25 | #define _OGON_SMGR_CALL_TASKCALLINAUTHENTICATEUSER_H_ 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | namespace ogon { namespace sessionmanager { namespace call { 32 | 33 | enum AUTH_RESULT{ 34 | AUTH_SUCCESSFUL = 0, 35 | AUTH_BAD_CREDENTIALS = 1, 36 | AUTH_WRONG_SESSION_STATE = 2, 37 | AUTH_UNKNOWN_ERROR = 3, 38 | }; 39 | 40 | class TaskAuthenticateUser: public taskNS::Task, sessionNS::SessionAccessor { 41 | public: 42 | TaskAuthenticateUser(const std::string &username, const std::string &domainName, 43 | const std::string &password, UINT32 sessionid); 44 | virtual void run(); 45 | int getResult(int &authStatus); 46 | 47 | private: 48 | 49 | int authenticateUser(); 50 | int getUserSession(); 51 | int switchToInSameSession(sessionNS::SessionPtr session); 52 | 53 | std::string mUserName; 54 | std::string mDomainName; 55 | std::string mPassword; 56 | UINT32 mSessionId; 57 | 58 | int mAuthStatus; 59 | uint32_t mResult; 60 | }; 61 | 62 | typedef std::shared_ptr TaskAuthenticateUserPtr; 63 | 64 | } /*call*/ } /*sessionmanager*/ } /*ogon*/ 65 | 66 | namespace callNS = ogon::sessionmanager::call; 67 | 68 | #endif /* _OGON_SMGR_CALL_TASKCALLINAUTHENTICATEUSER_H_ */ 69 | -------------------------------------------------------------------------------- /session-manager/common/call/TaskCallInLogonUser.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * call task for Logging on a user. 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifdef HAVE_CONFIG_H 25 | #include "config.h" 26 | #endif 27 | 28 | #include "TaskCallInLogonUser.h" 29 | #include 30 | #include 31 | 32 | 33 | namespace ogon { namespace sessionmanager { namespace call { 34 | 35 | void TaskCallInLogonUser::run() { 36 | if (mCall == NULL) { 37 | return; 38 | } 39 | mCall->doStuff(); 40 | APP_CONTEXT.getRpcOutgoingQueue()->addElement(mCall); 41 | return; 42 | } 43 | 44 | void TaskCallInLogonUser::setCallIn(CallInPtr call) { 45 | mCall = call; 46 | } 47 | 48 | } /*call*/ } /*sessionmanager*/ } /*ogon*/ 49 | -------------------------------------------------------------------------------- /session-manager/common/call/TaskCallInLogonUser.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * call task for Logging on a user. 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_CALL_TASKCALLINLOGONUSER_H_ 25 | #define _OGON_SMGR_CALL_TASKCALLINLOGONUSER_H_ 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | namespace ogon { namespace sessionmanager { namespace call { 32 | 33 | class TaskCallInLogonUser: public taskNS::ThreadTask { 34 | public: 35 | virtual void run(); 36 | void setCallIn(CallInPtr call); 37 | 38 | private: 39 | CallInPtr mCall; 40 | }; 41 | 42 | typedef std::shared_ptr TaskCallInLogonUserPtr; 43 | 44 | } /*call*/ } /*sessionmanager*/ } /*ogon*/ 45 | 46 | namespace callNS = ogon::sessionmanager::call; 47 | 48 | #endif /* _OGON_SMGR_CALL_TASKCALLINLOGONUSER_H_ */ 49 | -------------------------------------------------------------------------------- /session-manager/common/call/TaskEndRemoteControl.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * call task for stopping remote control (shadowing) 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Bernhard Miklautz 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifdef HAVE_CONFIG_H 25 | #include "config.h" 26 | #endif 27 | 28 | #include "TaskEndRemoteControl.h" 29 | #include 30 | 31 | namespace ogon { namespace sessionmanager { namespace call { 32 | 33 | TaskEndRemoteControl::TaskEndRemoteControl(UINT32 connectionId) : mResult(false) { 34 | mConnectionId = connectionId; 35 | } 36 | 37 | void TaskEndRemoteControl::run() { 38 | sessionNS::ConnectionPtr currentConnection = APP_CONTEXT.getConnectionStore()->getConnection(mConnectionId); 39 | if ((currentConnection == NULL) || (currentConnection->getSessionId() == 0)) { 40 | mResult = false; 41 | return; 42 | } 43 | 44 | sessionNS::SessionPtr currentSession = APP_CONTEXT.getSessionStore()->getSession(currentConnection->getSessionId()); 45 | 46 | if (!currentSession) { 47 | mResult = false; 48 | return; 49 | } 50 | setAccessorSession(currentSession); 51 | stopRemoteControl(); 52 | mResult = true; 53 | } 54 | 55 | bool TaskEndRemoteControl::getResult() { 56 | return mResult; 57 | } 58 | 59 | } /*call*/ } /*sessionmanager*/ } /*ogon*/ 60 | -------------------------------------------------------------------------------- /session-manager/common/call/TaskEndRemoteControl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * call task for stopping remote control (shadowing) 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Bernhard Miklautz 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_CALL_TASKENDREMOTECONTROL_H_ 25 | #define _OGON_SMGR_CALL_TASKENDREMOTECONTROL_H_ 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | namespace ogon { namespace sessionmanager { namespace call { 32 | 33 | class TaskEndRemoteControl : public taskNS::Task, sessionNS::SessionAccessor { 34 | 35 | public: 36 | TaskEndRemoteControl(UINT32 connectionId); 37 | virtual void run(); 38 | bool getResult(); 39 | 40 | private: 41 | UINT32 mConnectionId; 42 | bool mResult; 43 | 44 | }; 45 | 46 | } /*call*/ } /*sessionmanager*/ } /*ogon*/ 47 | 48 | namespace callNS = ogon::sessionmanager::call; 49 | 50 | #endif /* _OGON_SMGR_CALL_ENDREMOTECONTROL_H_ */ 51 | -------------------------------------------------------------------------------- /session-manager/common/config/PropertyCWrapper.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Wrapper to access Property Manager from C 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #include "PropertyCWrapper.h" 25 | 26 | #include 27 | #include 28 | 29 | bool getPropertyBool(UINT32 sessionID, const char *path, bool *value) { 30 | return APP_CONTEXT.getPropertyManager()->getPropertyBool(sessionID, std::string(path), *value); 31 | } 32 | 33 | bool getPropertyNumber(UINT32 sessionID, const char *path, long *value) { 34 | return APP_CONTEXT.getPropertyManager()->getPropertyNumber(sessionID, std::string(path), *value); 35 | } 36 | 37 | bool getPropertyString(UINT32 sessionID, const char *path, char *value, unsigned int valueLength) 38 | { 39 | std::string stdvalue; 40 | bool retValue = APP_CONTEXT.getPropertyManager()->getPropertyString(sessionID, std::string(path), stdvalue); 41 | 42 | if (!retValue) { 43 | return false; 44 | } 45 | 46 | if (stdvalue.size() + 1 > valueLength) { 47 | return false; 48 | } 49 | 50 | memcpy(value, stdvalue.c_str(), stdvalue.size() + 1); 51 | return true; 52 | } 53 | 54 | bool setPropertyBool(PROPERTY_LEVEL /*level*/, UINT32 /*sessionID*/, const char* /*path*/, bool /*value*/) { 55 | return false; 56 | } 57 | 58 | bool setPropertyNumber(PROPERTY_LEVEL /*level*/, UINT32 /*sessionID*/, const char* /*path*/, long /*value*/) { 59 | return false; 60 | } 61 | 62 | bool setPropertyString(PROPERTY_LEVEL /*level*/, UINT32 /*sessionID*/, const char* /*path*/, char* /*value*/) { 63 | return false; 64 | } 65 | -------------------------------------------------------------------------------- /session-manager/common/config/PropertyCWrapper.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Wrapper to access Property Manager from C 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_PROPERTYCWRAPPER_H_ 25 | #define _OGON_SMGR_PROPERTYCWRAPPER_H_ 26 | 27 | #include 28 | #include "PropertyLevel.h" 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | #include 34 | 35 | bool getPropertyBool(UINT32 sessionID, const char *path, bool *value); 36 | bool getPropertyNumber(UINT32 sessionID, const char *path, long *value); 37 | bool getPropertyString(UINT32 sessionID, const char *path, char *value, unsigned int valueLength); 38 | 39 | bool setPropertyBool(PROPERTY_LEVEL level, UINT32 sessionID, const char *path, bool value); 40 | bool setPropertyNumber(PROPERTY_LEVEL level, UINT32 sessionID, const char *path, long value); 41 | bool setPropertyString(PROPERTY_LEVEL level, UINT32 sessionID, const char *path, char *value); 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif /* _OGON_SMGR_PROPERTYCWRAPPER_H_ */ 48 | -------------------------------------------------------------------------------- /session-manager/common/config/PropertyLevel.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Property levels 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_PROPERTYLEVEL_H_ 25 | #define _OGON_SMGR_PROPERTYLEVEL_H_ 26 | 27 | #include 28 | 29 | typedef enum _PROPERTY_LEVEL 30 | { 31 | Global = 1, 32 | UserGroup = 2, 33 | User = 3 34 | } 35 | PROPERTY_LEVEL, *PPROPERTY_LEVEL; 36 | 37 | typedef enum _PROPERTY_STORE_TYPE 38 | { 39 | BoolType = 1, 40 | NumberType = 2, 41 | StringType = 3 42 | } PROPERTY_STORE_TYPE, *PPROPERTY_STORE_TYPE; 43 | 44 | 45 | typedef struct _PROPERTY_STORE_HELPER { 46 | PROPERTY_STORE_TYPE type; 47 | bool boolValue; 48 | long numberValue; 49 | std::string stringValue; 50 | } PROPERTY_STORE_HELPER, *PPROPERTY_STORE_HELPER; 51 | 52 | #endif /* _OGON_SMGR_PROPERTYLEVEL_H_ */ 53 | -------------------------------------------------------------------------------- /session-manager/common/module/AuthModule.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * AuthModule 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_AUTHMODULE_H_ 25 | #define _OGON_SMGR_AUTHMODULE_H_ 26 | 27 | #include "../../auth.h" 28 | #include "Module.h" 29 | #include 30 | #include 31 | 32 | namespace ogon { namespace sessionmanager { namespace module { 33 | 34 | /** 35 | * @brief 36 | */ 37 | class AuthModule { 38 | public: 39 | AuthModule(); 40 | int initModule(const std::string &moduleFileName, RDS_AUTH_MODULE_ENTRY_POINTS *entrypoints); 41 | virtual ~AuthModule(); 42 | std::string getName(); 43 | 44 | rdsAuthModule * newContext(); 45 | void freeContext(rdsAuthModule *context); 46 | 47 | /* the domain can be modified by an auth module 48 | * this is the case if the authmodule does not support domains 49 | * then the authmodule should set the domain to the same value 50 | * or "". */ 51 | 52 | int logonUser(rdsAuthModule *context, const std::string &username, std::string &domain, 53 | const std::string &password); 54 | 55 | private: 56 | pRdsAuthModuleNew mfpNew; 57 | pRdsAuthModuleFree mfpFree; 58 | 59 | pRdsAuthLogonUser mfpLogonUser; 60 | 61 | std::string mModuleFile; 62 | std::string mModuleName; 63 | HMODULE mLoadedLib; 64 | }; 65 | 66 | } /*module*/ } /*sessionmanager*/ } /*ogon*/ 67 | 68 | namespace moduleNS = ogon::sessionmanager::module; 69 | 70 | #endif /* _OGON_SMGR_AUTHMODULE_H_ */ 71 | -------------------------------------------------------------------------------- /session-manager/common/module/CallBacks.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Callback Handlers for Modules 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifdef HAVE_CONFIG_H 25 | #include "config.h" 26 | #endif 27 | 28 | #include "CallBacks.h" 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | namespace ogon { namespace sessionmanager { namespace module { 35 | 36 | void CallBacks::addMonitoringProcess(DWORD processId, UINT32 sessionId, bool terminateSession, RDS_MODULE_COMMON *context) { 37 | APP_CONTEXT.getProcessMonitor()->addProcess(processId, sessionId, terminateSession, context); 38 | } 39 | bool CallBacks::removeMonitoringProcess(DWORD processId) { 40 | return APP_CONTEXT.getProcessMonitor()->removeProcess(processId); 41 | } 42 | 43 | 44 | } /*module*/ } /*sessionmanager*/ } /*ogon*/ 45 | -------------------------------------------------------------------------------- /session-manager/common/module/CallBacks.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Callback Handlers for Modules 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_MODULE_CALLBACKS_H_ 25 | #define _OGON_SMGR_MODULE_CALLBACKS_H_ 26 | 27 | #include 28 | 29 | namespace ogon { namespace sessionmanager { namespace module { 30 | 31 | class CallBacks { 32 | public: 33 | static void addMonitoringProcess(DWORD processId, UINT32 sessionId, bool terminateSession, RDS_MODULE_COMMON *context); 34 | static bool removeMonitoringProcess(DWORD processId); 35 | }; 36 | 37 | } /*module*/ } /*sessionmanager*/ } /*ogon*/ 38 | 39 | #endif /* _OGON_SMGR_MODULE_CALLBACKS_H_ */ 40 | -------------------------------------------------------------------------------- /session-manager/common/module/LocalModule.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * LocalModule Class 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_LOCALMODULE_H_ 25 | #define _OGON_SMGR_LOCALMODULE_H_ 26 | 27 | #include "Module.h" 28 | 29 | namespace ogon { namespace sessionmanager { namespace module { 30 | 31 | /** 32 | * @brief 33 | */ 34 | class LocalModule: public Module { 35 | public: 36 | LocalModule(); 37 | virtual int initModule(const std::string &moduleFileName, RDS_MODULE_ENTRY_POINTS *entrypoints); 38 | virtual ~LocalModule(); 39 | 40 | virtual RDS_MODULE_COMMON *newContext(); 41 | virtual void freeContext(RDS_MODULE_COMMON *context); 42 | 43 | virtual std::string start(RDS_MODULE_COMMON *context); 44 | virtual int stop(RDS_MODULE_COMMON *context); 45 | 46 | virtual int connect(RDS_MODULE_COMMON *context); 47 | virtual int disconnect(RDS_MODULE_COMMON *context); 48 | 49 | virtual std::string getWinstationName(RDS_MODULE_COMMON *context); 50 | 51 | private: 52 | pRdsModuleInit mfpInit; 53 | pRdsModuleNew mfpNew; 54 | pRdsModuleFree mfpFree; 55 | 56 | pRdsModuleStart mfpStart; 57 | pRdsModuleStop mfpStop; 58 | pRdsModuleDestroy mfpDestroy; 59 | pRdsModuleGetCustomInfo mfpGetCustomInfo; 60 | pRdsModuleConnect mfpConnect; 61 | pRdsModuleDisconnect mfpDisconnect; 62 | HMODULE mLoadedLib; 63 | 64 | }; 65 | 66 | } /*module*/ } /*sessionmanager*/ } /*ogon*/ 67 | 68 | namespace moduleNS = ogon::sessionmanager::module; 69 | 70 | #endif /* _OGON_SMGR_LOCALMODULE_H_ */ 71 | -------------------------------------------------------------------------------- /session-manager/common/otsapi/OTSApiServer.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * OTSApiServer 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_OTSAPI_OTSAPISERVER_H_ 25 | #define _OGON_SMGR_OTSAPI_OTSAPISERVER_H_ 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | namespace ogon{ namespace sessionmanager{ namespace otsapi { 33 | 34 | class OTSApiServer { 35 | public: 36 | OTSApiServer(); 37 | virtual ~OTSApiServer(); 38 | 39 | static void serverThread( void * parameter); 40 | bool startOTSApi(); 41 | bool stopOTSApi(); 42 | 43 | void setPort(DWORD port); 44 | DWORD getPort(); 45 | 46 | void setServer(std::shared_ptr server); 47 | CRITICAL_SECTION * getCritSection(); 48 | void setSuccess(bool success); 49 | 50 | private: 51 | static std::shared_ptr 52 | getSSLSocketFactory(std::string certFile, std::string keyFile); 53 | 54 | CRITICAL_SECTION mCSection; 55 | HANDLE mhStarted; 56 | std::shared_ptr mServer; 57 | HANDLE mServerThread; 58 | DWORD mPort; 59 | bool mSuccess; 60 | }; 61 | 62 | } /*otsapi*/ } /*sessionmanager*/ } /*ogon*/ 63 | 64 | namespace otsapiNS = ogon::sessionmanager::otsapi; 65 | 66 | #endif /* _OGON_SMGR_OTSAPI_OTSAPISERVER_H_ */ 67 | -------------------------------------------------------------------------------- /session-manager/common/otsapi/TaskDisconnect.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * otsapi task for disconnecting a user 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_OTSAPI_TASKDISCONNECT_H_ 25 | #define _OGON_SMGR_OTSAPI_TASKDISCONNECT_H_ 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | namespace ogon { namespace sessionmanager { namespace otsapi { 32 | 33 | class TaskDisconnect: public taskNS::InformableTask, sessionNS::SessionAccessor{ 34 | public: 35 | TaskDisconnect(UINT32 sessionId, BOOL wait, DWORD timeout); 36 | virtual ~TaskDisconnect(){}; 37 | virtual void run(); 38 | BOOL getResults(); 39 | virtual void abortTask(); 40 | 41 | private: 42 | BOOL disconnectSession(); 43 | UINT32 mSessionId; 44 | BOOL mWait; 45 | DWORD mTimeout; 46 | bool mDisconnected; 47 | }; 48 | 49 | typedef std::shared_ptr TaskDisconnectPtr; 50 | 51 | } /*otsapi*/ } /*sessionmanager*/ } /*ogon*/ 52 | 53 | namespace otsapiNS = ogon::sessionmanager::otsapi; 54 | 55 | #endif /* _OGON_SMGR_OTSAPI_TASKDISCONNECT_H_ */ 56 | -------------------------------------------------------------------------------- /session-manager/common/otsapi/TaskLogoff.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * otsapi task for logging off a user 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_OTSAPI_TASKLOGOFF_H_ 25 | #define _OGON_SMGR_OTSAPI_TASKLOGOFF_H_ 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | namespace ogon { namespace sessionmanager { namespace otsapi { 32 | 33 | class TaskLogoff: public taskNS::InformableTask { 34 | public: 35 | TaskLogoff(UINT32 sessionId, BOOL wait, DWORD timeout); 36 | virtual ~TaskLogoff(){}; 37 | virtual void run(); 38 | BOOL getResults(); 39 | virtual void abortTask(); 40 | 41 | 42 | private: 43 | BOOL logoff(); 44 | UINT32 mSessionId; 45 | BOOL mWait; 46 | DWORD mTimeout; 47 | bool mLoggedoff; 48 | }; 49 | 50 | typedef std::shared_ptr TaskLogoffPtr; 51 | 52 | } /*otsapi*/ } /*sessionmanager*/ } /*ogon*/ 53 | 54 | namespace otsapiNS = ogon::sessionmanager::otsapi; 55 | 56 | #endif /* _OGON_SMGR_OTSAPI_TASKLOGOFF_H_ */ 57 | -------------------------------------------------------------------------------- /session-manager/common/otsapi/TaskStopRemoteControl.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * otsapi task for stopping remote control (shadowing) 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_OTSAPI_TASKSTOPREMOTECONTROL_H_ 25 | #define _OGON_SMGR_OTSAPI_TASKSTOPREMOTECONTROL_H_ 26 | 27 | #include 28 | #include 29 | 30 | namespace ogon { namespace sessionmanager { namespace otsapi { 31 | 32 | class TaskStopRemoteControl: public taskNS::InformableTask, sessionNS::SessionAccessor { 33 | public: 34 | TaskStopRemoteControl(UINT32 sessionId, UINT32 timeout); 35 | virtual ~TaskStopRemoteControl(){}; 36 | virtual void run(); 37 | BOOL getResults(); 38 | virtual void abortTask(); 39 | 40 | private: 41 | UINT32 mSessionId; 42 | BOOL mResult; 43 | UINT32 mTimeOut; 44 | }; 45 | 46 | typedef std::shared_ptr TaskStopRemoteControlPtr; 47 | 48 | } /*otsapi*/ } /*sessionmanager*/ } /*ogon*/ 49 | 50 | namespace otsapiNS = ogon::sessionmanager::otsapi; 51 | 52 | #endif /* _OGON_SMGR_OTSAPI_TASKSTOPREMOTECONTROL_H_ */ 53 | -------------------------------------------------------------------------------- /session-manager/common/permission/LogonPermission.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Logon permission class 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifdef HAVE_CONFIG_H 25 | #include "config.h" 26 | #endif 27 | 28 | #include "LogonPermission.h" 29 | 30 | namespace ogon { namespace sessionmanager { namespace permission { 31 | 32 | LogonPermission::LogonPermission(const std::string &username, const std::string &domain, 33 | DWORD permission) 34 | { 35 | mUsername = username; 36 | mDomain = domain; 37 | mPermission = permission; 38 | } 39 | 40 | std::string LogonPermission::getUsername() const { 41 | return mUsername; 42 | } 43 | 44 | std::string LogonPermission::getDomain() const { 45 | return mDomain; 46 | } 47 | 48 | DWORD LogonPermission::getPermission() const { 49 | return mPermission; 50 | } 51 | } /*permission*/ } /*sessionmanager*/ } /*ogon*/ 52 | 53 | -------------------------------------------------------------------------------- /session-manager/common/permission/LogonPermission.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Logon permission class 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_LOGONPERMISSION_H_ 25 | #define _OGON_SMGR_LOGONPERMISSION_H_ 26 | 27 | #include 28 | 29 | #include 30 | 31 | #include 32 | 33 | namespace ogon { namespace sessionmanager { namespace permission { 34 | 35 | /** 36 | * @brief 37 | */ 38 | class LogonPermission { 39 | public: 40 | LogonPermission(const std::string &username, const std::string &domain, DWORD permission); 41 | 42 | std::string getUsername() const; 43 | std::string getDomain() const; 44 | DWORD getPermission() const; 45 | 46 | private: 47 | std::string mUsername; 48 | std::string mDomain; 49 | DWORD mPermission; 50 | }; 51 | 52 | typedef std::shared_ptr LogonPermissionPtr; 53 | 54 | } /*permission*/ } /*sessionmanager*/ } /*ogon*/ 55 | 56 | namespace permissionNS = ogon::sessionmanager::permission; 57 | 58 | #endif /* _OGON_SMGR_LOGONPERMISSION_H_ */ 59 | -------------------------------------------------------------------------------- /session-manager/common/permission/permission.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * WTS Permission Flags 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_PERMISSION_H_ 25 | #define _OGON_SMGR_PERMISSION_H_ 26 | 27 | #define WTS_PERM_FLAGS_QUERY_INFORMATION 0x0001 28 | #define WTS_PERM_FLAGS_SET_INFORMATION 0x0002 29 | #define WTS_PERM_FLAGS_REMOTE_CONTROL 0x0004 30 | #define WTS_PERM_FLAGS_LOGON 0x0008 31 | #define WTS_PERM_FLAGS_LOGOFF 0x0010 32 | #define WTS_PERM_FLAGS_MESSAGE 0x0020 33 | #define WTS_PERM_FLAGS_CONNECT 0x0040 34 | #define WTS_PERM_FLAGS_DISCONNECT 0x0080 35 | #define WTS_PERM_FLAGS_VIRTUAL_CHANNEL 0x0100 36 | 37 | #define WTS_PERM_FLAGS_FULL 0x01FF /* all permissions */ 38 | #define WTS_PERM_FLAGS_USER 0x0049 /* WTS_PERM_FLAGS_CONNECT | WTS_PERM_FLAGS_QUERY_INFORMATION | WTS_PERM_FLAGS_LOGON */ 39 | #define WTS_PERM_FLAGS_GUEST 0x0008 /* WTS_PERM_FLAGS_LOGON */ 40 | 41 | #endif /* _OGON_SMGR_PERMISSION_H_ */ 42 | -------------------------------------------------------------------------------- /session-manager/common/process/ProcessMonitor.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Global process watcher 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_PROCESSMONITOR_H_ 25 | #define _OGON_SMGR_PROCESSMONITOR_H_ 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | namespace ogon { namespace sessionmanager { namespace process { 33 | 34 | /** 35 | * @brief 36 | */ 37 | struct _RDS_PROCESS_INFO { 38 | DWORD processId; 39 | UINT32 sessionId; 40 | bool terminateSessionOnExit; 41 | RDS_MODULE_COMMON *context; 42 | }; 43 | 44 | typedef struct _RDS_PROCESS_INFO RDS_PROCESS_INFO; 45 | 46 | /** 47 | * @brief 48 | */ 49 | class ProcessMonitor { 50 | public: 51 | ProcessMonitor(); 52 | ~ProcessMonitor(); 53 | 54 | bool start(); 55 | bool stop(); 56 | 57 | void run(); 58 | 59 | void addProcess(DWORD processId, UINT32 sessionId, bool terminateSessionOnExit, RDS_MODULE_COMMON *context); 60 | bool removeProcess(DWORD processId); 61 | 62 | 63 | private: 64 | static void* execThread(void *arg); 65 | 66 | private: 67 | CRITICAL_SECTION mCSection; 68 | HANDLE mhStopEvent; 69 | HANDLE mhServerThread; 70 | bool mRunning; 71 | std::list mProcessInfos; 72 | }; 73 | 74 | } /*process*/ } /*sessionmanager*/ } /*ogon*/ 75 | 76 | namespace processNS = ogon::sessionmanager::process; 77 | 78 | #endif /* _OGON_SMGR_PROCESSMONITOR_H_ */ 79 | -------------------------------------------------------------------------------- /session-manager/common/session/ConnectionStore.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Connection store class 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | 25 | #ifndef _OGON_SMGR_SESSION_CONNECTIONSTORE_H_ 26 | #define _OGON_SMGR_SESSION_CONNECTIONSTORE_H_ 27 | 28 | #include "Connection.h" 29 | 30 | #include 31 | #include 32 | #include 33 | 34 | namespace ogon { namespace sessionmanager { namespace session { 35 | 36 | typedef std::map TConnectionMap; 37 | typedef std::pair TConnectionPair; 38 | 39 | 40 | /** 41 | * @brief 42 | */ 43 | class ConnectionStore { 44 | public: 45 | ConnectionStore(); 46 | ~ConnectionStore(); 47 | 48 | ConnectionPtr getOrCreateConnection(UINT32 connectionID); 49 | ConnectionPtr getConnection(UINT32 connectionID); 50 | ConnectionPtr getConnectionForSessionId(UINT32 mSessionId); 51 | int removeConnection(UINT32 connectionID); 52 | 53 | UINT32 getConnectionIdForSessionId(UINT32 mSessionId); 54 | 55 | void reset(); 56 | 57 | private: 58 | TConnectionMap mConnectionMap; 59 | CRITICAL_SECTION mCSection; 60 | }; 61 | 62 | } /*session*/ } /*sessionmanager*/ } /*ogon*/ 63 | 64 | namespace sessionNS = ogon::sessionmanager::session; 65 | 66 | #endif /* _OGON_SMGR_SESSION_CONNECTIONSTORE_H_ */ 67 | -------------------------------------------------------------------------------- /session-manager/common/session/SessionNotifier.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * SessionNotifier class 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | 25 | #ifndef _OGON_SMGR_SESSION_SESSIONNOTIFIER_H_ 26 | #define _OGON_SMGR_SESSION_SESSIONNOTIFIER_H_ 27 | 28 | #include "Connection.h" 29 | 30 | #include 31 | #include 32 | 33 | #include 34 | 35 | namespace ogon { namespace sessionmanager { namespace session { 36 | 37 | class SessionNotifier { 38 | public: 39 | SessionNotifier(); 40 | ~SessionNotifier(); 41 | 42 | bool init(); 43 | bool notify(DWORD reason, UINT32 sessionId); 44 | bool shutdown(); 45 | 46 | private: 47 | const char *wtsNotificationToString(int signal); 48 | DBusConnection *mDBusConn; 49 | CRITICAL_SECTION mCSection; 50 | }; 51 | 52 | } /*session*/ } /*sessionmanager*/ } /*ogon*/ 53 | 54 | namespace sessionNS = ogon::sessionmanager::session; 55 | 56 | #endif /* _OGON_SMGR_SESSION_SESSIONNOTIFIER_H_ */ 57 | -------------------------------------------------------------------------------- /session-manager/common/session/TaskCallIn.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Task for async Calls 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifdef HAVE_CONFIG_H 25 | #include "config.h" 26 | #endif 27 | 28 | #include "TaskCallIn.h" 29 | #include 30 | #include 31 | 32 | 33 | namespace ogon { namespace sessionmanager { namespace session { 34 | 35 | void TaskCallIn::run() { 36 | if (mCall == NULL) { 37 | return; 38 | } 39 | mCall->doStuff(); 40 | APP_CONTEXT.getRpcOutgoingQueue()->addElement(mCall); 41 | return; 42 | } 43 | 44 | void TaskCallIn::setCallIn(callNS::CallInPtr call) { 45 | mCall = call; 46 | } 47 | 48 | void TaskCallIn::abortTask() { 49 | mCall->abort(); 50 | APP_CONTEXT.getRpcOutgoingQueue()->addElement(mCall); 51 | } 52 | 53 | 54 | } /*call*/ } /*sessionmanager*/ } /*ogon*/ 55 | -------------------------------------------------------------------------------- /session-manager/common/session/TaskCallIn.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Task for async Calls 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_SESSION_TASKCALLIN_H_ 25 | #define _OGON_SMGR_SESSION_TASKCALLIN_H_ 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | namespace ogon { namespace sessionmanager { namespace session { 32 | 33 | class TaskCallIn: public taskNS::Task { 34 | public: 35 | virtual void run(); 36 | void setCallIn(callNS::CallInPtr call); 37 | virtual void abortTask(); 38 | 39 | private: 40 | callNS::CallInPtr mCall; 41 | }; 42 | 43 | typedef std::shared_ptr TaskCallInPtr; 44 | 45 | } /*session*/ } /*sessionmanager*/ } /*ogon*/ 46 | 47 | namespace callNS = ogon::sessionmanager::call; 48 | 49 | #endif /* _OGON_SMGR_SESSION_TASKCALLIN_H_ */ 50 | -------------------------------------------------------------------------------- /session-manager/common/session/TaskDisconnect.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Task to disconnect a session. 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_SESSION_TASKDISCONNECT_H_ 25 | #define _OGON_SMGR_SESSION_TASKDISCONNECT_H_ 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | namespace ogon { namespace sessionmanager { namespace session { 32 | 33 | class TaskDisconnect: public taskNS::InformableTask, sessionNS::SessionAccessor { 34 | public: 35 | TaskDisconnect(UINT32 connectionId, UINT32 sessionId = 0); 36 | virtual ~TaskDisconnect(){}; 37 | virtual void run(); 38 | UINT32 getResults(bool &disconnected); 39 | virtual void abortTask(); 40 | 41 | 42 | private: 43 | UINT32 disconnect_Connection(); 44 | UINT32 disconnect_Session(); 45 | UINT32 mConnectionId; 46 | UINT32 mSessionId; 47 | bool mDisconnected; 48 | UINT32 mResult; 49 | }; 50 | 51 | typedef std::shared_ptr TaskDisconnectPtr; 52 | 53 | } /*session*/ } /*sessionmanager*/ } /*ogon*/ 54 | 55 | namespace sessionNS = ogon::sessionmanager::session; 56 | 57 | #endif /* _OGON_SMGR_SESSION_TASKDISCONNECT_H_ */ 58 | -------------------------------------------------------------------------------- /session-manager/common/session/TaskEnd.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Task to end a session 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_SESSION_TASKENDSESSION_H_ 25 | #define _OGON_SMGR_SESSION_TASKENDSESSION_H_ 26 | 27 | #include 28 | #define SHUTDOWN_TIME_OUT (10*1000) 29 | 30 | namespace ogon { namespace sessionmanager { namespace session { 31 | 32 | class TaskEnd: public taskNS::InformableTask { 33 | public: 34 | TaskEnd(); 35 | virtual void run(); 36 | void setSessionId(UINT32 sessionId); 37 | bool getResults(); 38 | virtual void abortTask(); 39 | 40 | private: 41 | void stopSession(); 42 | UINT32 mSessionId; 43 | bool mSuccess; 44 | }; 45 | 46 | typedef std::shared_ptr TaskEndPtr; 47 | 48 | } /*session*/ } /*sessionmanager*/ } /*ogon*/ 49 | 50 | namespace sessionNS = ogon::sessionmanager::session; 51 | 52 | #endif /* _OGON_SMGR_SESSION_TASKENDSESSION_H_ */ 53 | -------------------------------------------------------------------------------- /session-manager/common/session/TaskSessionTimeout.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Task for session timeout 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_SESSION_TASKSESSIONTIMEOUT_H_ 25 | #define _OGON_SMGR_SESSION_TASKSESSIONTIMEOUT_H_ 26 | 27 | #include 28 | 29 | namespace ogon { namespace sessionmanager { namespace session { 30 | 31 | class TaskSessionTimeout: public taskNS::ThreadTask { 32 | public: 33 | virtual void run(); 34 | virtual bool isThreaded(); 35 | }; 36 | 37 | typedef std::shared_ptr TaskSessionTimeoutPtr; 38 | 39 | } /*session*/ } /*sessionmanager*/ } /*ogon*/ 40 | 41 | namespace sessionNS = ogon::sessionmanager::session; 42 | 43 | #endif /* _OGON_SMGR_SESSION_TASKSESSIONTIMEOUT_H_ */ 44 | -------------------------------------------------------------------------------- /session-manager/common/session/TaskShutdown.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Task for shutting down a session (internally used by session) 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifdef HAVE_CONFIG_H 25 | #include "config.h" 26 | #endif 27 | 28 | #include "TaskShutdown.h" 29 | #include 30 | #include 31 | 32 | 33 | namespace ogon { namespace sessionmanager { namespace session { 34 | 35 | TaskShutdown::TaskShutdown(sessionNS::SessionPtr session) { 36 | setAccessorSession(session); 37 | } 38 | 39 | void TaskShutdown::run() { 40 | destroyAuthBackend(); 41 | switch (getAccessorSession()->getConnectState()) { 42 | case WTSActive: 43 | setConnectState(WTSDisconnected); 44 | /* no break */ 45 | case WTSConnected: 46 | setConnectState(WTSDown); 47 | break; 48 | case WTSDisconnected: 49 | setConnectState(WTSDown); 50 | break; 51 | default: 52 | break; 53 | } 54 | stopModule(); 55 | 56 | unregisterSession(); 57 | removeAuthToken(); 58 | getAccessorSession()->stopExecutorThread(false); 59 | } 60 | 61 | } /*session*/ } /*sessionmanager*/ } /*ogon*/ 62 | -------------------------------------------------------------------------------- /session-manager/common/session/TaskShutdown.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Task for shutting down a session (internally used by session) 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_SESSION_TASKSHUTDOWN_H_ 25 | #define _OGON_SMGR_SESSION_TASKSHUTDOWN_H_ 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | namespace ogon { namespace sessionmanager { namespace session { 32 | 33 | class TaskShutdown: public taskNS::Task, sessionNS::SessionAccessor{ 34 | public: 35 | TaskShutdown(sessionNS::SessionPtr session); 36 | virtual ~TaskShutdown(){}; 37 | virtual void run(); 38 | }; 39 | 40 | typedef std::shared_ptr TaskShutdownPtr; 41 | 42 | } /*session*/ } /*sessionmanager*/ } /*ogon*/ 43 | 44 | namespace sessionNS = ogon::sessionmanager::session; 45 | 46 | #endif /* _OGON_SMGR_SESSION_TASKSHUTDOWN_H_ */ 47 | -------------------------------------------------------------------------------- /session-manager/common/session/TaskSwitchTo.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Task for switching to another session 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_SESSION_TASKSWITCHTO_H_ 25 | #define _OGON_SMGR_SESSION_TASKSWITCHTO_H_ 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | namespace ogon { namespace sessionmanager { namespace session { 32 | 33 | class TaskSwitchTo: public taskNS::InformableTask, sessionNS::SessionAccessor{ 34 | public: 35 | TaskSwitchTo(UINT32 connectionId, UINT32 sessionId); 36 | virtual ~TaskSwitchTo(){}; 37 | virtual void run(); 38 | UINT32 getResults(bool &disconnected); 39 | virtual void abortTask(); 40 | 41 | private: 42 | UINT32 mConnectionId; 43 | UINT32 mSessionId; 44 | bool mSuccess; 45 | UINT32 mResult; 46 | }; 47 | 48 | typedef std::shared_ptr TaskSwitchToPtr; 49 | 50 | } /*session*/ } /*sessionmanager*/ } /*ogon*/ 51 | 52 | namespace sessionNS = ogon::sessionmanager::session; 53 | 54 | #endif /* _OGON_SMGR_SESSION_TASKSWITCHTO_H_ */ 55 | -------------------------------------------------------------------------------- /session-manager/common/task/Executor.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Global Executor which runs Task objects 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_EXECUTOR_H_ 25 | #define _OGON_SMGR_EXECUTOR_H_ 26 | 27 | #include "Task.h" 28 | #include 29 | #include 30 | 31 | #define PIPE_BUFFER_SIZE 0xFFFF 32 | 33 | namespace ogon { namespace sessionmanager { namespace task { 34 | 35 | class Executor { 36 | public: 37 | Executor(); 38 | ~Executor(); 39 | 40 | bool start(); 41 | bool stop(); 42 | 43 | void runExecutor(); 44 | 45 | bool addTask(TaskPtr task); 46 | 47 | 48 | private: 49 | static void* execThread(void *arg); 50 | static void* execTask(void *arg); 51 | 52 | bool checkThreadHandles(const HANDLE value) const; 53 | bool waitThreadHandles(const HANDLE value) const; 54 | 55 | private: 56 | HANDLE mhStopEvent; 57 | HANDLE mhServerThread; 58 | 59 | HANDLE mhStopThreads; 60 | HANDLE mhTaskThreadStarted; 61 | 62 | bool mRunning; 63 | 64 | std::list mTaskThreadList; 65 | CRITICAL_SECTION mCSection; 66 | SignalingQueue mTasks; 67 | }; 68 | 69 | } /*task*/ } /*sessionmanager*/ } /*ogon*/ 70 | 71 | namespace taskNS = ogon::sessionmanager::task; 72 | 73 | #endif /* _OGON_SMGR_EXECUTOR_H_ */ 74 | -------------------------------------------------------------------------------- /session-manager/common/task/InformableTask.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Task Object for an Executor 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_INFORMABLETASK_H_ 25 | #define _OGON_SMGR_INFORMABLETASK_H_ 26 | 27 | #include 28 | #include 29 | 30 | namespace ogon { namespace sessionmanager { namespace task { 31 | 32 | /** 33 | * @brief 34 | */ 35 | class InformableTask: public Task { 36 | public: 37 | InformableTask(){ 38 | if (!(mhDone = CreateEvent(NULL, TRUE, FALSE, NULL))) { 39 | throw std::bad_alloc(); 40 | } 41 | } 42 | virtual ~InformableTask() { 43 | CloseHandle(mhDone); 44 | } 45 | virtual void run() = 0; 46 | virtual void postProcess(){ 47 | informDone(); 48 | }; 49 | 50 | virtual void informDone() { 51 | SetEvent(mhDone); 52 | } 53 | HANDLE getHandle() { 54 | return mhDone; 55 | } 56 | 57 | virtual void abortTask(){ 58 | SetEvent(mhDone); 59 | }; 60 | 61 | private: 62 | HANDLE mhDone; 63 | }; 64 | 65 | typedef std::shared_ptr InformableTaskPtr; 66 | 67 | } /*task*/ } /*sessionmanager*/ } /*ogon*/ 68 | 69 | namespace taskNS = ogon::sessionmanager::task; 70 | 71 | #endif /* _OGON_SMGR_INFORMABLETASK_H_ */ 72 | -------------------------------------------------------------------------------- /session-manager/common/task/Task.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Task Object for an Executor 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_TASK_H_ 25 | #define _OGON_SMGR_TASK_H_ 26 | 27 | #include 28 | #include 29 | 30 | namespace ogon { namespace sessionmanager { namespace task { 31 | 32 | class Task { 33 | public: 34 | Task(){} 35 | virtual ~Task() {} 36 | virtual void run() = 0; 37 | virtual void preProcess(){}; 38 | virtual void postProcess(){}; 39 | virtual void abortTask(){}; 40 | }; 41 | 42 | typedef std::shared_ptr TaskPtr; 43 | 44 | } /*task*/ } /*sessionmanager*/ } /*ogon*/ 45 | 46 | namespace taskNS = ogon::sessionmanager::task; 47 | 48 | #endif /* _OGON_SMGR_TASK_H_ */ 49 | -------------------------------------------------------------------------------- /session-manager/common/task/ThreadTask.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Task Object for an Executor 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_THREADTASK_H_ 25 | #define _OGON_SMGR_THREADTASK_H_ 26 | 27 | #include 28 | 29 | namespace ogon { namespace sessionmanager { namespace task { 30 | 31 | class ThreadTask: public Task { 32 | public: 33 | ThreadTask():mhStarted(0), mhStop(0){} 34 | virtual ~ThreadTask() {} 35 | virtual void run() = 0; 36 | 37 | void setHandles(HANDLE stopHandle,HANDLE startedHandle) { 38 | mhStop = stopHandle; 39 | mhStarted = startedHandle; 40 | } 41 | 42 | virtual void preProcess(){ 43 | informStarted(); 44 | }; 45 | 46 | void informStarted() { 47 | SetEvent(mhStarted); 48 | } 49 | 50 | private: 51 | HANDLE mhStarted; 52 | protected: 53 | HANDLE mhStop; 54 | }; 55 | 56 | typedef std::shared_ptr ThreadTaskPtr; 57 | 58 | } /*task*/ } /*sessionmanager*/ } /*ogon*/ 59 | 60 | namespace taskNS = ogon::sessionmanager::task; 61 | 62 | #endif /* _OGON_SMGR_THREADTASK_H_ */ 63 | -------------------------------------------------------------------------------- /session-manager/common/utils/CSGuard.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Guard object for critical sections 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_CSGUARD_H_ 25 | #define _OGON_SMGR_CSGUARD_H_ 26 | 27 | #include 28 | 29 | class CSGuard { 30 | public: 31 | CSGuard(CRITICAL_SECTION *criticalSection) { 32 | mCriticalSection = criticalSection; 33 | EnterCriticalSection(mCriticalSection); 34 | } 35 | 36 | void leaveGuard() { 37 | LeaveCriticalSection(mCriticalSection); 38 | mCriticalSection = NULL; 39 | } 40 | 41 | ~CSGuard() { 42 | if (mCriticalSection != NULL) { 43 | LeaveCriticalSection(mCriticalSection); 44 | } 45 | } 46 | 47 | private: 48 | CRITICAL_SECTION *mCriticalSection; 49 | 50 | }; 51 | 52 | 53 | #endif /* _OGON_SMGR_CSGUARD_H_ */ 54 | -------------------------------------------------------------------------------- /session-manager/common/utils/MakeCert.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * makecert helper 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_MAKECERT_H_ 25 | #define _OGON_SMGR_MAKECERT_H_ 26 | 27 | #include 28 | 29 | int ogon_generate_certificate(std::string &certFile, std::string &keyFile); 30 | 31 | #endif //_OGON_SMGR_MAKECERT_H_ 32 | -------------------------------------------------------------------------------- /session-manager/common/utils/SignalingQueue.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Signaling queue template 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_SIGNALINGQUEUE_H_ 25 | #define _OGON_SMGR_SIGNALINGQUEUE_H_ 26 | 27 | #include 28 | #include 29 | 30 | template class SignalingQueue 31 | { 32 | public: 33 | SignalingQueue(){ 34 | if (!InitializeCriticalSectionAndSpinCount(&mCSection, 0x00000400)) { 35 | throw std::bad_alloc(); 36 | } 37 | if (!(mSignalHandle = CreateEvent(NULL, TRUE, FALSE, NULL))) { 38 | throw std::bad_alloc(); 39 | } 40 | } 41 | 42 | ~SignalingQueue() { 43 | mlist.clear(); 44 | CloseHandle(mSignalHandle); 45 | DeleteCriticalSection(&mCSection); 46 | } 47 | 48 | HANDLE getSignalHandle() { 49 | return mSignalHandle; 50 | } 51 | 52 | void addElement(QueueElement element) { 53 | EnterCriticalSection(&mCSection); 54 | mlist.push_back(element); 55 | SetEvent(mSignalHandle); 56 | LeaveCriticalSection(&mCSection); 57 | } 58 | 59 | std::list getAllElements() { 60 | std::list all; 61 | EnterCriticalSection(&mCSection); 62 | all = mlist; 63 | mlist.clear(); 64 | ResetEvent(mSignalHandle); 65 | LeaveCriticalSection(&mCSection); 66 | return all; 67 | } 68 | 69 | private: 70 | HANDLE mSignalHandle; 71 | CRITICAL_SECTION mCSection; 72 | std::list mlist; 73 | }; 74 | 75 | #endif /* _OGON_SMGR_SIGNALINGQUEUE_H_ */ 76 | -------------------------------------------------------------------------------- /session-manager/common/utils/StringHelpers.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * helper templates for strings 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #include "StringHelpers.h" 25 | 26 | namespace std{ 27 | 28 | bool stringEndsWith(const string &compString, const string &suffix) 29 | { 30 | return compString.rfind(suffix) == (compString.size()-suffix.size()); 31 | } 32 | 33 | bool stringStartsWith(const string &string2comp, const string &startswith) 34 | { 35 | return string2comp.size() >= startswith.size() 36 | && equal(startswith.begin(), startswith.end(), string2comp.begin()); 37 | } 38 | 39 | } 40 | 41 | 42 | 43 | namespace boost { 44 | template<> bool lexical_cast(const std::string &arg) { 45 | std::istringstream ss(arg); 46 | bool b; 47 | ss >> std::boolalpha >> b; 48 | return b; 49 | } 50 | 51 | template<> std::string lexical_cast(const bool &b) { 52 | std::ostringstream ss; 53 | ss << std::boolalpha << b; 54 | return ss.str(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /session-manager/common/utils/StringHelpers.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * helper templates for strings 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_STRINGHELPERS_H_ 25 | #define _OGON_SMGR_STRINGHELPERS_H_ 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | template 32 | std::vector 33 | split(const T & str, const T & delimiters) { 34 | std::vector v; 35 | typename T::size_type start = 0; 36 | typename T::size_type pos = str.find_first_of(delimiters, start); 37 | while (pos != T::npos) { 38 | if(pos != start) // ignore empty tokens 39 | v.push_back(str.substr(start, pos - start)); 40 | start = pos + 1; 41 | pos = str.find_first_of(delimiters, start); 42 | } 43 | if(start < str.length()) {// ignore trailing delimiter 44 | v.push_back(str.substr(start, str.length() - start)); 45 | } 46 | return v; 47 | } 48 | 49 | namespace std{ 50 | 51 | bool stringEndsWith(const string &compString, const string &suffix); 52 | bool stringStartsWith(const string &string2comp, const string &startswith); 53 | inline std::string trim(std::string &str) { 54 | str.erase(0, str.find_first_not_of(' ')); //prefixing spaces 55 | str.erase(str.find_last_not_of(' ') +1 ); //surfixing spaces 56 | return str; 57 | } 58 | } 59 | 60 | namespace boost { 61 | template<> bool lexical_cast(const std::string &arg); 62 | template<> std::string lexical_cast(const bool &b); 63 | } 64 | 65 | #endif /* _OGON_SMGR_STRINGHELPERS_H_ */ 66 | -------------------------------------------------------------------------------- /session-manager/common/utils/TimeHelpers.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * helper functions for time 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #include "TimeHelpers.h" 25 | 26 | void GetUnixTimeAsFileTime(time_t t, LPFILETIME lpSystemTimeAsFileTime) 27 | { 28 | ULARGE_INTEGER time64; 29 | 30 | time64.u.HighPart = 0; 31 | 32 | /* time represented in tenths of microseconds since midnight of January 1, 1601 */ 33 | 34 | time64.QuadPart = t + 11644473600LL; /* Seconds since January 1, 1601 */ 35 | time64.QuadPart *= 10000000; /* Convert timestamp to tenths of a microsecond */ 36 | 37 | lpSystemTimeAsFileTime->dwLowDateTime = time64.u.LowPart; 38 | lpSystemTimeAsFileTime->dwHighDateTime = time64.u.HighPart; 39 | } 40 | 41 | time_t to_time_t(boost::posix_time::ptime t) 42 | { 43 | using namespace boost::posix_time; 44 | boost::posix_time::ptime epoch(boost::gregorian::date(1970, boost::gregorian::Jan, 1)); 45 | boost::posix_time::time_duration::sec_type x = (t - epoch).total_seconds(); 46 | return time_t(x); 47 | } 48 | 49 | 50 | __uint64 convertFileTimeToint64(const FILETIME &fileTime) 51 | { 52 | ULARGE_INTEGER lv_Large ; 53 | 54 | lv_Large.u.LowPart = fileTime.dwLowDateTime; 55 | lv_Large.u.HighPart = fileTime.dwHighDateTime; 56 | 57 | return lv_Large.QuadPart ; 58 | } 59 | -------------------------------------------------------------------------------- /session-manager/common/utils/TimeHelpers.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * helper functions for time 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_TIMEHELPERS_H_ 25 | #define _OGON_SMGR_TIMEHELPERS_H_ 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | void GetUnixTimeAsFileTime(time_t t, LPFILETIME lpSystemTimeAsFileTime); 32 | time_t to_time_t(boost::posix_time::ptime t); 33 | __uint64 convertFileTimeToint64( const FILETIME &fileTime); 34 | 35 | #endif /* _OGON_SMGR_TIMEHELPERS_H_ */ 36 | -------------------------------------------------------------------------------- /session-manager/config/ReadMe.txt: -------------------------------------------------------------------------------- 1 | firRDS Sessionmanager DBUS configuration: 2 | 3 | to allow the session manager to use the dbus for session change notification, 4 | put the config file ogon.SessionManager.conf in the system.d directory 5 | of our local dbus installation. 6 | 7 | On Ubuntu 13.10 the path is /etc/dbus-1/system.d/ -------------------------------------------------------------------------------- /session-manager/config/ogon.SessionManager.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /session-manager/module/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(X11) 2 | add_subdirectory(Qt) 3 | add_subdirectory(Weston) 4 | -------------------------------------------------------------------------------- /session-manager/module/Qt/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(MODULE_NAME "ogon-mod-qt") 2 | set(MODULE_PREFIX "OGON_MODULE_QT") 3 | 4 | set(${MODULE_PREFIX}_SRCS 5 | qt_module.cpp 6 | qt_module.h 7 | ../common/module_helper.cpp 8 | ../common/module_helper.h) 9 | 10 | add_library(${MODULE_NAME} SHARED ${${MODULE_PREFIX}_SRCS}) 11 | 12 | set(${MODULE_PREFIX}_LIBS "") 13 | list(APPEND ${MODULE_PREFIX}_LIBS ogon-backend) 14 | list(APPEND ${MODULE_PREFIX}_LIBS winpr) 15 | 16 | target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) 17 | 18 | install(TARGETS ${MODULE_NAME} DESTINATION ${OGON_MODULE_LIB_PATH}) 19 | -------------------------------------------------------------------------------- /session-manager/module/Qt/qt_module.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Qt Backend Module Header 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * David Fort 10 | * Martin Haimberger 11 | * 12 | * This file may be used under the terms of the GNU Affero General 13 | * Public License version 3 as published by the Free Software Foundation 14 | * and appearing in the file LICENSE-AGPL included in the distribution 15 | * of this file. 16 | * 17 | * Under the GNU Affero General Public License version 3 section 7 the 18 | * copyright holders grant the additional permissions set forth in the 19 | * ogon Core AGPL Exceptions version 1 as published by 20 | * Thincast Technologies GmbH. 21 | * 22 | * For more information see the file LICENSE in the distribution of this file. 23 | */ 24 | 25 | #ifndef _OGON_SMGR_QTMODULE_H_ 26 | #define _OGON_SMGR_QTMODULE_H_ 27 | 28 | #include 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | int RdsModuleEntry(RDS_MODULE_ENTRY_POINTS* pEntryPoints); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | #endif /* _OGON_SMGR_QTMODULE_H_ */ 41 | -------------------------------------------------------------------------------- /session-manager/module/Weston/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(MODULE_NAME "ogon-mod-weston") 2 | set(MODULE_PREFIX "OGON_MODULE_WESTON") 3 | 4 | set(${MODULE_PREFIX}_SRCS 5 | weston_module.cpp 6 | weston_module.h 7 | ../common/module_helper.cpp 8 | ../common/module_helper.h) 9 | 10 | add_library(${MODULE_NAME} SHARED ${${MODULE_PREFIX}_SRCS}) 11 | 12 | list(APPEND ${MODULE_PREFIX}_LIBS ogon-backend) 13 | list(APPEND ${MODULE_PREFIX}_LIBS winpr) 14 | 15 | target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) 16 | 17 | install(TARGETS ${MODULE_NAME} DESTINATION ${OGON_MODULE_LIB_PATH}) 18 | -------------------------------------------------------------------------------- /session-manager/module/Weston/weston_module.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Weston Backend Module Header 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * David Fort 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_WESTONMODULE_H_ 25 | #define _OGON_SMGR_WESTONMODULE_H_ 26 | 27 | #include 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | int RdsModuleEntry(RDS_MODULE_ENTRY_POINTS* pEntryPoints); 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | 39 | #endif /* _OGON_SMGR_WESTONMODULE_H_ */ 40 | -------------------------------------------------------------------------------- /session-manager/module/X11/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(MODULE_NAME "ogon-mod-x11") 2 | set(MODULE_PREFIX "OGON_MODULE_X11") 3 | 4 | set(${MODULE_PREFIX}_SRCS 5 | x11_module.cpp 6 | x11_module.h 7 | ../common/module_helper.cpp 8 | ../common/module_helper.h) 9 | 10 | add_library(${MODULE_NAME} SHARED ${${MODULE_PREFIX}_SRCS}) 11 | 12 | list(APPEND ${MODULE_PREFIX}_LIBS ogon-backend) 13 | list(APPEND ${MODULE_PREFIX}_LIBS winpr) 14 | list(APPEND ${MODULE_PREFIX}_LIBS ${X11_Xau_LIB}) 15 | 16 | target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) 17 | include_directories(${X11_Xau_INCLUDE_PATH}) 18 | 19 | install(TARGETS ${MODULE_NAME} DESTINATION ${OGON_MODULE_LIB_PATH}) 20 | -------------------------------------------------------------------------------- /session-manager/module/X11/x11_module.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * X11 Backend Module Header 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_X11MODULE_H_ 25 | #define _OGON_SMGR_X11MODULE_H_ 26 | 27 | #include 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | int RdsModuleEntry(RDS_MODULE_ENTRY_POINTS* pEntryPoints); 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | 39 | #endif /* _OGON_SMGR_X11MODULE_H_ */ 40 | -------------------------------------------------------------------------------- /session-manager/module/common/module_helper.h: -------------------------------------------------------------------------------- 1 | /** 2 | * ogon - Free Remote Desktop Services 3 | * Session Manager 4 | * Module Helper 5 | * 6 | * Copyright (c) 2013-2018 Thincast Technologies GmbH 7 | * 8 | * Authors: 9 | * Martin Haimberger 10 | * 11 | * This file may be used under the terms of the GNU Affero General 12 | * Public License version 3 as published by the Free Software Foundation 13 | * and appearing in the file LICENSE-AGPL included in the distribution 14 | * of this file. 15 | * 16 | * Under the GNU Affero General Public License version 3 section 7 the 17 | * copyright holders grant the additional permissions set forth in the 18 | * ogon Core AGPL Exceptions version 1 as published by 19 | * Thincast Technologies GmbH. 20 | * 21 | * For more information see the file LICENSE in the distribution of this file. 22 | */ 23 | 24 | #ifndef _OGON_SMGR_MODULEHELPER_H_ 25 | #define _OGON_SMGR_MODULEHELPER_H_ 26 | 27 | #include 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | void initResolutions(RDS_MODULE_CONFIG_CALLBACKS* config, UINT32 sessionId , long* xres, long* yres, long* colordepth); 34 | 35 | bool getPropertyBoolWrapper(const char* basePath, RDS_MODULE_CONFIG_CALLBACKS* config, UINT32 sessionID, const char* path, bool* value); 36 | bool getPropertyNumberWrapper(const char* basePath, RDS_MODULE_CONFIG_CALLBACKS* config, UINT32 sessionID, const char* path, long* value); 37 | bool getPropertyStringWrapper(const char* basePath, RDS_MODULE_CONFIG_CALLBACKS* config, UINT32 sessionID, const char* path, char* value, unsigned int valueLength); 38 | bool TerminateChildProcessAfterTimeout(DWORD dwProcessId, DWORD dwMilliseconds, int* pExitCode, UINT32 sessionID = 0); 39 | bool TerminateChildProcess(DWORD dwProcessId, DWORD dwTimeout, int* pExitCode, UINT32 sessionID); 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | #endif /* _OGON_SMGR_MODULEHELPER_H_ */ 46 | -------------------------------------------------------------------------------- /session-manager/otsapi/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(MODULE_NAME "ogon-otsapi") 2 | set(MODULE_PREFIX "OGON_OTSAPI") 3 | 4 | set(${MODULE_PREFIX}_SRCS otsapi_thrift.cpp) 5 | 6 | add_library(${MODULE_NAME} SHARED ${${MODULE_PREFIX}_SRCS}) 7 | set(${MODULE_PREFIX}_LIBS otsapi-thrift) 8 | list(APPEND ${MODULE_PREFIX}_LIBS winpr) 9 | 10 | target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) 11 | set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "lib") 12 | 13 | install(TARGETS ${MODULE_NAME} DESTINATION ${OGON_APP_LIB_PATH}) 14 | -------------------------------------------------------------------------------- /snmon/.gitignore: -------------------------------------------------------------------------------- 1 | ogon-snmon 2 | -------------------------------------------------------------------------------- /snmon/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | set(MODULE_NAME "ogon-snmon") 3 | set(MODULE_PREFIX "OGON_SNMON") 4 | 5 | set(${MODULE_PREFIX}_SRCS 6 | snmon.cpp) 7 | 8 | include_directories(${DBUS_INCLUDE_DIR}) 9 | include_directories(${DBUS_ARCH_INCLUDE_DIR}) 10 | 11 | add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) 12 | 13 | target_link_libraries(${MODULE_NAME} winpr ${DBUS_LIBRARIES}) 14 | 15 | install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) 16 | 17 | -------------------------------------------------------------------------------- /utils/astylerc: -------------------------------------------------------------------------------- 1 | 2 | # /* *INDENT-OFF* */ 3 | # /* *INDENT-ON* */ 4 | # http://astyle.sourceforge.net/astyle.html#_Options 5 | 6 | 7 | # set the maximum code lenght 8 | --max-code-length=80 9 | 10 | # set mode for c/c++ 11 | --mode=c 12 | 13 | # attached brackets 14 | # --style=google (the google style also sets some ident modifiers) 15 | --style=java 16 | 17 | # intend with tab and use space for continuation line alignment 18 | --indent=tab 19 | 20 | # attach the brackets to the namespace 21 | --attach-namespaces 22 | 23 | # attach the brackets to classes 24 | --indent-classes 25 | 26 | # attach the brackets to extern "C" 27 | --attach-extern-c 28 | 29 | # intend one line comments to the code level 30 | --indent-col1-comments 31 | 32 | # when having multiline conditions indent the next line at least one ident 33 | --min-conditional-indent=1 34 | 35 | # 36 | --max-instatement-indent=40 37 | 38 | # TODO 39 | --indent-switches 40 | 41 | # pad operators 42 | --pad-oper 43 | 44 | # insert space between if, for and while 45 | --pad-header 46 | 47 | # alingn pointer at the name like char *xx 48 | --align-pointer=name 49 | 50 | # align reference on their name 51 | --align-reference=name 52 | 53 | # add brackets even for signle lines 54 | --add-brackets 55 | 56 | # break after logical conjunctions 57 | --break-after-logical 58 | 59 | ## general options 60 | # preserve the date 61 | --preserve-date 62 | # force linux line endings 63 | --lineend=linux 64 | # don't save the original file as we are in git anyways 65 | --suffix=none 66 | --------------------------------------------------------------------------------