summaryrefslogtreecommitdiffstats
path: root/src/server.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/server.h')
-rw-r--r--src/server.h42
1 files changed, 13 insertions, 29 deletions
diff --git a/src/server.h b/src/server.h
index 784d445..b122d1c 100644
--- a/src/server.h
+++ b/src/server.h
@@ -1,7 +1,8 @@
+#include <libwebsockets.h>
#include <stdbool.h>
#include <uv.h>
-#include "queue.h"
+#include "pty.h"
// client message
#define INPUT '0'
@@ -15,8 +16,6 @@
#define SET_WINDOW_TITLE '1'
#define SET_PREFERENCES '2'
-#define MAX_READ_RETRY 2
-
// url paths
struct endpoints {
char *ws;
@@ -30,8 +29,6 @@ extern struct lws_context *context;
extern struct server *server;
extern struct endpoints endpoints;
-typedef enum { STATE_INIT, STATE_PAUSE, STATE_KILL, STATE_EXIT } proc_state;
-
struct pss_http {
char path[128];
char *buffer;
@@ -39,46 +36,36 @@ struct pss_http {
size_t len;
};
-struct pty_proc {
- char **args;
- int argc;
-
- pid_t pid;
- int status;
- proc_state state;
-
- int pty;
- char *pty_buffer;
- ssize_t pty_len;
- int err_count;
-
- uv_pipe_t pipe;
-
- LIST_ENTRY(pty_proc) entry;
-};
-
struct pss_tty {
bool initialized;
int initial_cmd_index;
bool authenticated;
+ char user[30];
char address[50];
- char path[20];
+ char path[128];
+ char **args;
+ int argc;
struct lws *wsi;
char *buffer;
size_t len;
- struct pty_proc *proc;
+ pty_process *process;
+ pty_buf_t *pty_buf;
+
+ int lws_close_status;
};
struct server {
int client_count; // client count
char *prefs_json; // client preferences
char *credential; // encoded basic auth credential
+ char *auth_header; // header name used for auth proxy
char *index; // custom index.html
char *command; // full command line
char **argv; // command with arguments
int argc; // command + arguments count
+ char *cwd; // working directory
int sig_code; // close signal
char sig_name[20]; // human readable signal string
bool url_arg; // allow client to send cli arguments in URL
@@ -89,8 +76,5 @@ struct server {
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
-
- LIST_HEAD(proc, pty_proc) procs; // started process list
+ uv_loop_t *loop; // the libuv event loop
};