Hermes 0.7.0
Linux game streaming host
Loading...
Searching...
No Matches
session_attach.h
Go to the documentation of this file.
1
15#pragma once
16
17// standard includes
18#include <map>
19#include <memory>
20#include <string>
21#include <string_view>
22#include <vector>
23
24// local includes
25#include "src/platform/common.h"
26
27namespace platf::session_attach {
28
29 using environment_t = std::map<std::string, std::string>;
30
34 environment_t parse_environment(const std::vector<std::string> &assignments);
35
40 environment_t parse_environment_block(std::string_view block);
41
55 environment_t initial_environment();
56
65 bool attach_needed(const environment_t &own, const environment_t &session);
66
71 std::vector<std::string> merged_environment(const environment_t &own, const environment_t &session);
72
76 bool display_server_reachable(const environment_t &environment);
77
89
101 std::vector<std::string> restart_environment();
102
109 [[nodiscard]] std::unique_ptr<platf::deinit_t> start();
110
111} // namespace platf::session_attach
Declarations for common platform specific utilities.
environment_t initial_environment()
The environment Hermes was started with, not the one it has now.
std::vector< std::string > merged_environment(const environment_t &own, const environment_t &session)
own with every variable of session laid over it, as "NAME=value" strings ready for execve().
environment_t parse_environment_block(std::string_view block)
Parse an environment as the kernel keeps it: assignments separated by NUL bytes, as in /proc/self/env...
environment_t parse_environment(const std::vector< std::string > &assignments)
Split "NAME=value" assignments; entries without a name are dropped.
std::vector< std::string > restart_environment()
The environment the next restart must be given, as "NAME=value" strings for execve()....
void drop_stale_display_environment()
Forget display variables that point at a display server that is gone.
bool attach_needed(const environment_t &own, const environment_t &session)
Whether session names a display server that own does not talk to.
bool display_server_reachable(const environment_t &environment)
Whether a display server is listening where environment points.
std::unique_ptr< platf::deinit_t > start()
Start watching for a session to attach to.