| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- #ifndef NGS_SYSTEM_SHELL_H
- #define NGS_SYSTEM_SHELL_H
- #include <cstdint>
- #include <string>
- namespace ylib {
- namespace network {
- namespace http {
- class request;
- class response;
- struct websocket_message;
- } // namespace http
- } // namespace network
- } // namespace ylib
- namespace ngs {
- namespace system {
- // Issue a short-lived one-time ticket for WebSocket auth (Cookie 在 WS 升级异步阶段不可靠).
- std::string shell_issue_ticket(const std::string& username);
- // Consume ticket; returns username on success.
- bool shell_consume_ticket(const std::string& ticket, std::string* username);
- // Handle /api/shell/ws WebSocket lifecycle (upgrade / header / body).
- void shell_ws_handler(ylib::network::http::request* req,
- ylib::network::http::response* resp,
- ylib::network::http::websocket_message* ws);
- // Cleanup when TCP connection drops (router on_close).
- void shell_on_conn_close(uint64_t connid);
- // Tear down all sessions (server shutdown).
- void shell_shutdown();
- } // namespace system
- } // namespace ngs
- #endif
|