-
Notifications
You must be signed in to change notification settings - Fork 14
/
ssheven.h
115 lines (79 loc) · 1.96 KB
/
ssheven.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*
* ssheven
*
* Copyright (c) 2020 by cy384 <cy384@cy384.com>
* See LICENSE file for details
*/
#pragma once
#include <OpenTransport.h>
#include <OpenTptInternet.h>
#include <StandardFile.h>
#include <Folders.h>
#include <libssh2.h>
#include <vterm.h>
#include <vterm_keycodes.h>
#include "ssheven-constants.r"
// sinful globals
struct ssheven_console
{
WindowPtr win;
int size_x;
int size_y;
int cursor_x;
int cursor_y;
int cell_height;
int cell_width;
int cursor_state;
long int last_cursor_blink;
int cursor_visible;
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
enum { CLICK_SEND, CLICK_SELECT } mouse_mode;
VTerm* vterm;
VTermScreen* vts;
};
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;
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;
enum { FASTEST, COLOR } display_mode;
int fg_color;
int bg_color;
int font_size;
};
extern struct preferences prefs;
extern char key_to_vterm[256];
enum THREAD_COMMAND { WAIT, READ, EXIT };
enum THREAD_STATE { UNINITIALIZED, 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, size_t length);
OSErr FSpPathFromLocation(FSSpec* spec, int* length, Handle* fullPath);
pascal void ButtonFrameProc(DialogRef dlg, DialogItemIndex itemNo);
int connect(void);
void disconnect(void);