2020-07-20 05:14:27 +01:00
|
|
|
/*
|
|
|
|
* ssheven
|
|
|
|
*
|
|
|
|
* Copyright (c) 2020 by cy384 <cy384@cy384.com>
|
|
|
|
* See LICENSE file for details
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <OpenTransport.h>
|
|
|
|
#include <OpenTptInternet.h>
|
2020-09-16 02:17:02 +01:00
|
|
|
#include <StandardFile.h>
|
2020-09-20 04:48:41 +01:00
|
|
|
#include <Folders.h>
|
2020-07-20 05:14:27 +01:00
|
|
|
|
|
|
|
#include <libssh2.h>
|
|
|
|
|
2020-08-29 03:14:43 +01:00
|
|
|
#include <vterm.h>
|
|
|
|
#include <vterm_keycodes.h>
|
|
|
|
|
2021-01-09 22:22:40 +00:00
|
|
|
#include "ssheven-constants.r"
|
2020-10-11 00:45:59 +01:00
|
|
|
|
2020-07-20 05:14:27 +01:00
|
|
|
// sinful globals
|
|
|
|
struct ssheven_console
|
|
|
|
{
|
|
|
|
WindowPtr win;
|
|
|
|
|
2020-09-01 03:53:06 +01:00
|
|
|
int size_x;
|
|
|
|
int size_y;
|
2020-07-20 05:14:27 +01:00
|
|
|
|
|
|
|
int cursor_x;
|
|
|
|
int cursor_y;
|
2020-08-18 03:21:38 +01:00
|
|
|
|
|
|
|
int cell_height;
|
|
|
|
int cell_width;
|
2020-08-22 02:29:34 +01:00
|
|
|
|
|
|
|
int cursor_state;
|
|
|
|
long int last_cursor_blink;
|
2020-09-15 00:54:31 +01:00
|
|
|
int cursor_visible;
|
2020-08-29 03:14:43 +01:00
|
|
|
|
2021-01-23 00:47:48 +00:00
|
|
|
int select_start_x;
|
|
|
|
int select_start_y;
|
|
|
|
|
|
|
|
int select_end_x;
|
|
|
|
int select_end_y;
|
|
|
|
|
|
|
|
int mouse_state; // 1 for down, 0 for up
|
|
|
|
|
2021-01-11 22:21:47 +00:00
|
|
|
enum { CLICK_SEND, CLICK_SELECT } mouse_mode;
|
|
|
|
|
2020-08-29 03:14:43 +01:00
|
|
|
VTerm* vterm;
|
|
|
|
VTermScreen* vts;
|
2020-07-20 05:14:27 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
extern struct ssheven_console con;
|
|
|
|
|
|
|
|
struct ssheven_ssh_connection
|
|
|
|
{
|
|
|
|
LIBSSH2_CHANNEL* channel;
|
|
|
|
LIBSSH2_SESSION* session;
|
|
|
|
|
|
|
|
EndpointRef endpoint;
|
|
|
|
|
|
|
|
char* recv_buffer;
|
|
|
|
char* send_buffer;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern struct ssheven_ssh_connection ssh_con;
|
2020-09-01 00:25:46 +01:00
|
|
|
|
2020-10-04 03:30:48 +01:00
|
|
|
struct preferences
|
|
|
|
{
|
|
|
|
int major_version;
|
|
|
|
int minor_version;
|
|
|
|
|
|
|
|
int loaded_from_file;
|
|
|
|
|
|
|
|
// pascal strings
|
|
|
|
char hostname[512]; // of the form: "hostname:portnumber", size is first only
|
|
|
|
char username[256];
|
|
|
|
char password[256];
|
|
|
|
char port[256];
|
|
|
|
|
|
|
|
// malloc'd c strings
|
|
|
|
char* pubkey_path;
|
|
|
|
char* privkey_path;
|
|
|
|
|
|
|
|
const char* terminal_string;
|
|
|
|
|
|
|
|
enum { USE_KEY, USE_PASSWORD } auth_type;
|
|
|
|
|
2021-01-23 02:16:17 +00:00
|
|
|
enum { FASTEST, COLOR } display_mode;
|
2020-10-04 03:30:48 +01:00
|
|
|
int fg_color;
|
|
|
|
int bg_color;
|
2021-06-02 02:32:51 +01:00
|
|
|
|
|
|
|
int font_size;
|
2020-10-04 03:30:48 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
extern struct preferences prefs;
|
2021-01-09 22:22:40 +00:00
|
|
|
|
|
|
|
extern char key_to_vterm[256];
|
|
|
|
|
|
|
|
enum THREAD_COMMAND { WAIT, READ, EXIT };
|
|
|
|
enum THREAD_STATE { UNINTIALIZED, OPEN, CLEANUP, DONE };
|
|
|
|
|
|
|
|
extern enum THREAD_COMMAND read_thread_command;
|
|
|
|
extern enum THREAD_STATE read_thread_state;
|
|
|
|
|
|
|
|
int save_prefs(void);
|
|
|
|
void set_window_title(WindowPtr w, const char* c_name);
|
|
|
|
|
|
|
|
OSErr FSpPathFromLocation(FSSpec* spec, int* length, Handle* fullPath);
|
|
|
|
|
|
|
|
pascal void ButtonFrameProc(DialogRef dlg, DialogItemIndex itemNo);
|
2021-11-21 05:11:45 +00:00
|
|
|
void process_login(void);
|