File: SshServer.h

package info (click to toggle)
termpaint 0.3.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,760 kB
  • sloc: cpp: 40,344; ansic: 10,323; python: 402; sh: 36; makefile: 14
file content (40 lines) | stat: -rw-r--r-- 781 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// SPDX-License-Identifier: BSL-1.0
#ifndef TERMPAINT_SAMPLE_SSHSERVER_INCLUDED
#define TERMPAINT_SAMPLE_SSHSERVER_INCLUDED

#include <functional>

#include <libssh/server.h>

#include <termpaint.h>
#include <termpaint_input.h>

extern bool pty_requested;

class SshServer {
public:
    SshServer(int port, std::string serverKeyFile);

    void run();

    virtual int main(std::function<bool()> poll) = 0;

    void outStr(const char *s);

    termpaint_terminal *terminal = nullptr;

private:
    void handleSession(ssh_event event, ssh_session session);

    termpaint_integration integration;
    ssh_channel channel;
    std::string outputBuffer;
    int port;
    std::string serverKeyFile;
    bool callback_requested = false;

public:
    bool newInput = false;
};

#endif