|
Hermes 0.7.0
Linux game streaming host
|
Miscellaneous definitions for Linux. More...
#include <fstream>#include <iostream>#include <cstdio>#include <cerrno>#include <csignal>#include <cstring>#include <algorithm>#include <array>#include <chrono>#include <climits>#include <cstdint>#include <ctime>#include <mutex>#include <thread>#include <string_view>#include <utility>#include <arpa/inet.h>#include <dlfcn.h>#include <ifaddrs.h>#include <netinet/udp.h>#include <pwd.h>#include <boost/algorithm/string/case_conv.hpp>#include <boost/asio/ip/address.hpp>#include <boost/asio/ip/host_name.hpp>#include <boost/process/v1/group.hpp>#include <boost/process/v1/child.hpp>#include <boost/process/v1/env.hpp>#include <boost/process/v1/environment.hpp>#include <boost/process/v1/handles.hpp>#include <boost/process/v1/io.hpp>#include <boost/process/v1/search_path.hpp>#include <boost/process/v1/start_dir.hpp>#include <fcntl.h>#include <sys/wait.h>#include <unistd.h>#include <xf86drm.h>#include "clipboard_process.h"#include "graphics.h"#include "misc.h"#include "process_group.h"#include "service_lifecycle.h"#include "session_attach.h"#include "src/config.h"#include "src/entry_handler.h"#include "src/logging.h"#include "src/network.h"#include "src/platform/common.h"#include "src/video.h"#include "vaapi.h"#include "virtual_display.h"#include <linux/rtnetlink.h>Go to the source code of this file.
Classes | |
| class | platf::qos_t |
| class | platf::linux_high_precision_timer |
Macros | |
| #define | _GNU_SOURCE 1 |
| #define | HERMES_GNUC_EXTENSION |
Typedefs | |
| using | platf::ifaddr_t = util::safe_ptr<ifaddrs, freeifaddrs> |
Enumerations | |
| enum | platf::source::source_e : std::size_t { platf::source::WAYLAND , platf::source::MAX_FLAGS } |
Functions | |
| void * | dyn::handle (const std::vector< const char * > &libs) |
| int | dyn::load (void *handle, const std::vector< std::tuple< apiproc *, const char * > > &funcs, bool strict) |
| int | platf::open_drm_node (const char *path, int flags) |
| Open a DRM device node without becoming its DRM master. | |
| bool | platf::touch_binds_to_output () |
| Whether the session binds a touchscreen or a pen to one output. | |
| ifaddr_t | platf::get_ifaddrs () |
| std::filesystem::path | platf::appdata () |
| Performs migration if necessary, then returns the appdata directory. | |
| std::string | platf::from_sockaddr (const sockaddr *const) |
| std::pair< std::uint16_t, std::string > | platf::from_sockaddr_ex (const sockaddr *const) |
| std::string | platf::get_mac_address (const std::string_view &address) |
The MAC address of the interface that holds address. | |
| std::string | platf::get_local_ip_for_gateway () |
| bp::child | platf::run_command (bool elevated, bool interactive, const std::string &cmd, boost::filesystem::path &working_dir, const bp::environment &env, FILE *file, std::error_code &ec, bp::group *group) |
| void | platf::open_url (const std::string &url) |
| Open a url in the default web browser. | |
| void | platf::adjust_thread_priority (thread_priority_e priority) |
| void | platf::streaming_will_start () |
| void | platf::streaming_will_stop () |
| void | platf::restart_on_exit () |
| void | platf::restart () |
| int | platf::set_env (const std::string &name, const std::string &value) |
| Set an environment variable. | |
| int | platf::unset_env (const std::string &name) |
| Unset an environment variable. | |
| bool | platf::request_process_group_exit (std::uintptr_t native_handle) |
| Attempt to gracefully terminate a process group. | |
| bool | platf::process_group_running (std::uintptr_t native_handle) |
| Check if a process group still has running children. | |
| bool | platf::request_user_service_stop () |
| struct sockaddr_in | platf::to_sockaddr (boost::asio::ip::address_v4 address, uint16_t port) |
| struct sockaddr_in6 | platf::to_sockaddr (boost::asio::ip::address_v6 address, uint16_t port) |
| bool | platf::send_batch (batched_send_info_t &send_info) |
| bool | platf::send (send_info_t &send_info) |
| std::unique_ptr< deinit_t > | platf::enable_socket_qos (uintptr_t native_socket, boost::asio::ip::address &address, uint16_t port, qos_data_type_e data_type, bool dscp_tagging) |
| Enable QoS on the given socket for traffic to the specified destination. | |
| std::string | platf::get_host_name () |
| Returns the current computer name in UTF-8. | |
| std::vector< std::string > | platf::wl_display_names () |
| std::shared_ptr< display_t > | platf::wl_display (mem_type_e hwdevice_type, const std::string &display_name, const video::config_t &config) |
| bool | platf::verify_wl () |
| std::vector< std::string > | platf::display_names (mem_type_e hwdevice_type) |
| bool | platf::needs_encoder_reenumeration () |
| Check if GPUs/drivers have changed since the last call to this function. | |
| std::shared_ptr< display_t > | platf::display (mem_type_e hwdevice_type, const std::string &display_name, const video::config_t &config) |
| Get the display_t instance for the given hwdevice_type. If display_name is empty, use the first monitor that's compatible you can find If you require to use this parameter in a separate thread, make a copy of it. | |
| std::unique_ptr< deinit_t > | platf::init () |
| std::unique_ptr< high_precision_timer > | platf::create_high_precision_timer () |
| Create platform-specific timer capable of high-precision sleep. | |
| std::string | platf::get_clipboard () |
| bool | platf::set_clipboard (const std::string &content) |
| bool | platf::clipboard_available () |
| session_environment_t | platf::detect_session_environment () |
| Detect the current session/compositor environment. | |
| appliance_readiness_t | platf::appliance_readiness () |
| Assess appliance-mode readiness without changing any state. | |
Variables | |
| window_system_e | window_system |
Miscellaneous definitions for Linux.
Definition in file misc.cpp.
| using platf::ifaddr_t = util::safe_ptr<ifaddrs, freeifaddrs> |
| enum platf::source::source_e : std::size_t |
| void platf::adjust_thread_priority | ( | thread_priority_e | priority | ) |
| fs::path platf::appdata | ( | ) |
| appliance_readiness_t platf::appliance_readiness | ( | ) |
| std::unique_ptr< high_precision_timer > platf::create_high_precision_timer | ( | ) |
| session_environment_t platf::detect_session_environment | ( | ) |
| std::shared_ptr< display_t > platf::display | ( | mem_type_e | hwdevice_type, |
| const std::string & | display_name, | ||
| const video::config_t & | config ) |
Get the display_t instance for the given hwdevice_type. If display_name is empty, use the first monitor that's compatible you can find If you require to use this parameter in a separate thread, make a copy of it.
| display_name | The name of the monitor that SHOULD be displayed |
| config | Stream configuration |
| std::vector< std::string > platf::display_names | ( | mem_type_e | hwdevice_type | ) |
| std::unique_ptr< deinit_t > platf::enable_socket_qos | ( | uintptr_t | native_socket, |
| boost::asio::ip::address & | address, | ||
| uint16_t | port, | ||
| qos_data_type_e | data_type, | ||
| bool | dscp_tagging ) |
Enable QoS on the given socket for traffic to the specified destination.
Enables QoS on the given socket for traffic to the specified destination.
| native_socket | The native socket handle. |
| address | The destination address for traffic sent on this socket. |
| port | The destination port for traffic sent on this socket. |
| data_type | The type of traffic sent on this socket. |
| dscp_tagging | Specifies whether to enable DSCP tagging on outgoing traffic. |
| std::string platf::from_sockaddr | ( | const sockaddr * const | ip_addr | ) |
| std::pair< std::uint16_t, std::string > platf::from_sockaddr_ex | ( | const sockaddr * const | ip_addr | ) |
| std::string platf::get_host_name | ( | ) |
| std::string platf::get_mac_address | ( | const std::string_view & | address | ) |
The MAC address of the interface that holds address.
Addresses are compared as addresses, not text, so a link-local address printed with its scope (fe80::1eth0) finds its interface.
| address | The host address a client reached. |
| void * dyn::handle | ( | const std::vector< const char * > & | libs | ) |
| int dyn::load | ( | void * | handle, |
| const std::vector< std::tuple< apiproc *, const char * > > & | funcs, | ||
| bool | strict ) |
| bool platf::needs_encoder_reenumeration | ( | ) |
| int platf::open_drm_node | ( | const char * | path, |
| int | flags ) |
Open a DRM device node without becoming its DRM master.
The kernel makes whoever opens a primary node (/dev/dri/cardN) while no one holds master that device's master. Hermes never sets modes, but a master it holds keeps logind from handing the device back to the compositor when its session becomes active again: switch to a text console during a stream and back, and the compositor is locked out of that GPU until the stream ends. So drop master straight away, as logind and KWin do for the fds they open. The fd is close-on-exec, so launched apps cannot inherit it.
| path | The device node. |
| flags | open(2) flags; O_CLOEXEC is added. |
| void platf::open_url | ( | const std::string & | url | ) |
| bool platf::process_group_running | ( | std::uintptr_t | native_handle | ) |
| bool platf::request_process_group_exit | ( | std::uintptr_t | native_handle | ) |
| bool platf::request_user_service_stop | ( | ) |
| bp::child platf::run_command | ( | bool | elevated, |
| bool | interactive, | ||
| const std::string & | cmd, | ||
| boost::filesystem::path & | working_dir, | ||
| const bp::environment & | env, | ||
| FILE * | file, | ||
| std::error_code & | ec, | ||
| bp::group * | group ) |
| bool platf::send | ( | send_info_t & | send_info | ) |
| bool platf::send_batch | ( | batched_send_info_t & | send_info | ) |
| int platf::set_env | ( | const std::string & | name, |
| const std::string & | value ) |
| struct sockaddr_in platf::to_sockaddr | ( | boost::asio::ip::address_v4 | address, |
| uint16_t | port ) |
| struct sockaddr_in6 platf::to_sockaddr | ( | boost::asio::ip::address_v6 | address, |
| uint16_t | port ) |
| bool platf::touch_binds_to_output | ( | ) |
Whether the session binds a touchscreen or a pen to one output.
Such a device reports where on its own surface it was touched, so the compositor has to decide which output that surface stands for. KWin and Mutter bind it to a single output, and the coordinates Hermes sends are then relative to the streamed output alone. Everywhere else the device spans the whole desktop and the streamed output's offset within it is part of the coordinate.
| int platf::unset_env | ( | const std::string & | name | ) |
| std::shared_ptr< display_t > platf::wl_display | ( | mem_type_e | hwdevice_type, |
| const std::string & | display_name, | ||
| const video::config_t & | config ) |
Definition at line 568 of file wlgrab.cpp.
| std::vector< std::string > platf::wl_display_names | ( | ) |
Definition at line 591 of file wlgrab.cpp.
| window_system_e window_system |