mirror of
https://github.com/tsl0922/ttyd.git
synced 2026-01-19 09:14:23 +01:00
src: reformat with clang-format
This commit is contained in:
100
src/server.h
100
src/server.h
@@ -15,9 +15,9 @@
|
||||
|
||||
// url paths
|
||||
struct endpoints {
|
||||
char *ws;
|
||||
char *index;
|
||||
char *token;
|
||||
char *ws;
|
||||
char *index;
|
||||
char *token;
|
||||
};
|
||||
|
||||
extern volatile bool force_exit;
|
||||
@@ -25,74 +25,66 @@ extern struct lws_context *context;
|
||||
extern struct server *server;
|
||||
extern struct endpoints endpoints;
|
||||
|
||||
typedef enum {
|
||||
STATE_INIT, STATE_KILL, STATE_EXIT
|
||||
} proc_state;
|
||||
typedef enum { STATE_INIT, STATE_KILL, STATE_EXIT } proc_state;
|
||||
|
||||
struct pss_http {
|
||||
char path[128];
|
||||
char *buffer;
|
||||
char *ptr;
|
||||
size_t len;
|
||||
char path[128];
|
||||
char *buffer;
|
||||
char *ptr;
|
||||
size_t len;
|
||||
};
|
||||
|
||||
struct pty_proc {
|
||||
char **args;
|
||||
int argc;
|
||||
char **args;
|
||||
int argc;
|
||||
|
||||
pid_t pid;
|
||||
int status;
|
||||
proc_state state;
|
||||
pid_t pid;
|
||||
int status;
|
||||
proc_state state;
|
||||
|
||||
int pty;
|
||||
char *pty_buffer;
|
||||
ssize_t pty_len;
|
||||
int pty;
|
||||
char *pty_buffer;
|
||||
ssize_t pty_len;
|
||||
|
||||
uv_pipe_t pipe;
|
||||
uv_pipe_t pipe;
|
||||
|
||||
LIST_ENTRY(pty_proc) entry;
|
||||
LIST_ENTRY(pty_proc) entry;
|
||||
};
|
||||
|
||||
struct pss_tty {
|
||||
bool initialized;
|
||||
int initial_cmd_index;
|
||||
bool authenticated;
|
||||
char address[50];
|
||||
bool initialized;
|
||||
int initial_cmd_index;
|
||||
bool authenticated;
|
||||
char address[50];
|
||||
|
||||
struct lws *wsi;
|
||||
char *buffer;
|
||||
size_t len;
|
||||
struct lws *wsi;
|
||||
char *buffer;
|
||||
size_t len;
|
||||
|
||||
struct pty_proc *proc;
|
||||
struct pty_proc *proc;
|
||||
};
|
||||
|
||||
struct server {
|
||||
int client_count; // client count
|
||||
char *prefs_json; // client preferences
|
||||
char *credential; // encoded basic auth credential
|
||||
char *index; // custom index.html
|
||||
char *command; // full command line
|
||||
char **argv; // command with arguments
|
||||
int argc; // command + arguments count
|
||||
int sig_code; // close signal
|
||||
char sig_name[20]; // human readable signal string
|
||||
bool url_arg; // allow client to send cli arguments in URL
|
||||
bool readonly; // whether not allow clients to write to the TTY
|
||||
bool check_origin; // whether allow websocket connection from different origin
|
||||
int max_clients; // maximum clients to support
|
||||
bool once; // whether accept only one client and exit on disconnection
|
||||
char socket_path[255]; // UNIX domain socket path
|
||||
char terminal_type[30]; // terminal type to report
|
||||
int client_count; // client count
|
||||
char *prefs_json; // client preferences
|
||||
char *credential; // encoded basic auth credential
|
||||
char *index; // custom index.html
|
||||
char *command; // full command line
|
||||
char **argv; // command with arguments
|
||||
int argc; // command + arguments count
|
||||
int sig_code; // close signal
|
||||
char sig_name[20]; // human readable signal string
|
||||
bool url_arg; // allow client to send cli arguments in URL
|
||||
bool readonly; // whether not allow clients to write to the TTY
|
||||
bool
|
||||
check_origin; // whether allow websocket connection from different origin
|
||||
int max_clients; // maximum clients to support
|
||||
bool once; // whether accept only one client and exit on disconnection
|
||||
char socket_path[255]; // UNIX domain socket path
|
||||
char terminal_type[30]; // terminal type to report
|
||||
|
||||
uv_loop_t *loop; // the libuv event loop
|
||||
uv_signal_t watcher; // SIGCHLD watcher
|
||||
uv_loop_t *loop; // the libuv event loop
|
||||
uv_signal_t watcher; // SIGCHLD watcher
|
||||
|
||||
LIST_HEAD(proc, pty_proc) procs; // started process list
|
||||
LIST_HEAD(proc, pty_proc) procs; // started process list
|
||||
};
|
||||
|
||||
extern int
|
||||
callback_http(struct lws *wsi, enum lws_callback_reasons reason, void *user, void *in, size_t len);
|
||||
|
||||
extern int
|
||||
callback_tty(struct lws *wsi, enum lws_callback_reasons reason, void *user, void *in, size_t len);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user