|
Revision 6991, 1.0 kB
(checked in by frsyuki, 5 years ago)
|
|
lang/c/partty: added partty-scale
|
| Line | |
|---|
| 1 | #include "partty.h" |
|---|
| 2 | #include "emtelnet.h" |
|---|
| 3 | |
|---|
| 4 | namespace Partty { |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | class phrase_telnetd : public emtelnet { |
|---|
| 8 | private: |
|---|
| 9 | static void pass_through_handler(char cmd, bool sw, emtelnet& base) {} |
|---|
| 10 | public: |
|---|
| 11 | phrase_telnetd(); |
|---|
| 12 | private: |
|---|
| 13 | phrase_telnetd(const phrase_telnetd&); |
|---|
| 14 | }; |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | class GateIMPL { |
|---|
| 18 | public: |
|---|
| 19 | GateIMPL(int listen_socket); |
|---|
| 20 | ~GateIMPL(); |
|---|
| 21 | int run(void); |
|---|
| 22 | void signal_end(void); |
|---|
| 23 | private: |
|---|
| 24 | int accept_guest(void); |
|---|
| 25 | static ssize_t write_message(phrase_telnetd& td, int guest, const char* buf, size_t count); |
|---|
| 26 | static ssize_t read_line(phrase_telnetd& td, int guest, char* buf, size_t count); |
|---|
| 27 | private: |
|---|
| 28 | int socket; |
|---|
| 29 | char gate_path[PATH_MAX + MAX_SESSION_NAME_LENGTH]; |
|---|
| 30 | size_t gate_dir_len; |
|---|
| 31 | sig_atomic_t m_end; |
|---|
| 32 | private: |
|---|
| 33 | GateIMPL(); |
|---|
| 34 | GateIMPL(const GateIMPL&); |
|---|
| 35 | private: |
|---|
| 36 | static const int E_SUCCESS = 0; |
|---|
| 37 | static const int E_ACCEPT = 1; |
|---|
| 38 | static const int E_FINISH = 2; |
|---|
| 39 | static const int E_SENDFD = 3; |
|---|
| 40 | static const int E_SESSION_NAME = 4; |
|---|
| 41 | static const int E_PASSWORD = 5; |
|---|
| 42 | }; |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | } // namespace Partty |
|---|
| 46 | |
|---|