mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-22 06:38:37 -05:00
Initial simple raw TCP backend
[originally from svn r211]
This commit is contained in:
parent
f2892707df
commit
9d9426785f
@ -1,4 +1,4 @@
|
|||||||
/* $Id: mac_res.r,v 1.1.2.17 1999/04/02 12:58:02 ben Exp $ */
|
/* $Id: mac_res.r,v 1.1.2.18 1999/09/01 22:16:15 ben Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999 Ben Harris
|
* Copyright (c) 1999 Ben Harris
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@ -556,7 +556,7 @@ resource 'pSET' (PREF_settings, "settings", purgeable) {
|
|||||||
no_implicit_copy,
|
no_implicit_copy,
|
||||||
#define PREF_strings 1024
|
#define PREF_strings 1024
|
||||||
PREF_strings, 1, /* host 'STR#' */
|
PREF_strings, 1, /* host 'STR#' */
|
||||||
23, prot_telnet, /* port, protocol */
|
7, prot_telnet, /* port, protocol */
|
||||||
PREF_strings, 2, /* termtype 'STR#' */
|
PREF_strings, 2, /* termtype 'STR#' */
|
||||||
PREF_strings, 3, /* termspeed 'STR#' */
|
PREF_strings, 3, /* termspeed 'STR#' */
|
||||||
PREF_strings, 4, /* environmt 'STR#' */
|
PREF_strings, 4, /* environmt 'STR#' */
|
||||||
@ -573,7 +573,7 @@ resource 'pSET' (PREF_settings, "settings", purgeable) {
|
|||||||
|
|
||||||
resource 'STR#' (PREF_strings, "strings", purgeable) {
|
resource 'STR#' (PREF_strings, "strings", purgeable) {
|
||||||
{
|
{
|
||||||
"nowhere.loopback.edu",
|
"172.17.11.11",
|
||||||
"xterm",
|
"xterm",
|
||||||
"38400,38400",
|
"38400,38400",
|
||||||
"\000",
|
"\000",
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: macterm.c,v 1.1.2.35 1999/07/24 15:51:12 ben Exp $ */
|
/* $Id: macterm.c,v 1.1.2.36 1999/09/01 22:16:15 ben Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999 Simon Tatham
|
* Copyright (c) 1999 Simon Tatham
|
||||||
* Copyright (c) 1999 Ben Harris
|
* Copyright (c) 1999 Ben Harris
|
||||||
@ -135,7 +135,7 @@ void mac_newsession(void) {
|
|||||||
s = smalloc(sizeof(*s));
|
s = smalloc(sizeof(*s));
|
||||||
memset(s, 0, sizeof(*s));
|
memset(s, 0, sizeof(*s));
|
||||||
mac_loadconfig(&s->cfg);
|
mac_loadconfig(&s->cfg);
|
||||||
s->back = &null_backend;
|
s->back = &rawtcp_backend;
|
||||||
|
|
||||||
/* XXX: Own storage management? */
|
/* XXX: Own storage management? */
|
||||||
if (HAVE_COLOR_QD())
|
if (HAVE_COLOR_QD())
|
||||||
@ -156,11 +156,13 @@ void mac_newsession(void) {
|
|||||||
}
|
}
|
||||||
ShowWindow(s->window);
|
ShowWindow(s->window);
|
||||||
s->back->init(s);
|
s->back->init(s);
|
||||||
|
#if 0
|
||||||
starttime = TickCount();
|
starttime = TickCount();
|
||||||
display_resource(s, 'pTST', 128);
|
display_resource(s, 'pTST', 128);
|
||||||
sprintf(msg, "Elapsed ticks: %d\015\012", TickCount() - starttime);
|
sprintf(msg, "Elapsed ticks: %d\015\012", TickCount() - starttime);
|
||||||
inbuf_putstr(s, msg);
|
inbuf_putstr(s, msg);
|
||||||
term_out(s);
|
term_out(s);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mac_initfont(Session *s) {
|
static void mac_initfont(Session *s) {
|
||||||
|
58
testback.c
58
testback.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: testback.c,v 1.1.2.7 1999/08/02 08:04:31 ben Exp $ */
|
/* $Id: testback.c,v 1.1.2.8 1999/09/01 22:16:15 ben Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999 Simon Tatham
|
* Copyright (c) 1999 Simon Tatham
|
||||||
* Copyright (c) 1999 Ben Harris
|
* Copyright (c) 1999 Ben Harris
|
||||||
@ -40,6 +40,8 @@ static void loop_send(Session *, char *, int);
|
|||||||
static void hexdump_send(Session *, char *, int);
|
static void hexdump_send(Session *, char *, int);
|
||||||
static void null_size(Session *);
|
static void null_size(Session *);
|
||||||
static void null_special(Session *, Telnet_Special);
|
static void null_special(Session *, Telnet_Special);
|
||||||
|
static char *rawtcp_init(Session *);
|
||||||
|
static int rawtcp_msg(Session *, SOCKET, Net_Event_Type);
|
||||||
|
|
||||||
Backend null_backend = {
|
Backend null_backend = {
|
||||||
null_init, null_msg, null_send, null_size, null_special
|
null_init, null_msg, null_send, null_size, null_special
|
||||||
@ -53,6 +55,10 @@ Backend hexdump_backend = {
|
|||||||
null_init, null_msg, hexdump_send, null_size, null_special
|
null_init, null_msg, hexdump_send, null_size, null_special
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Backend rawtcp_backend = {
|
||||||
|
rawtcp_init, rawtcp_msg, null_send, null_size, null_special
|
||||||
|
};
|
||||||
|
|
||||||
static char *null_init(Session *s) {
|
static char *null_init(Session *s) {
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -99,6 +105,56 @@ static void null_special(Session *s, Telnet_Special code) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct rawtcp_private {
|
||||||
|
SOCKET s;
|
||||||
|
};
|
||||||
|
|
||||||
|
static char *rawtcp_init(Session *sess) {
|
||||||
|
struct rawtcp_private *rp;
|
||||||
|
|
||||||
|
sess->back_priv = smalloc(sizeof(struct rawtcp_private));
|
||||||
|
rp = (struct rawtcp_private *)sess->back_priv;
|
||||||
|
rp->s = net_open(sess, sess->cfg.host, sess->cfg.port);
|
||||||
|
if (rp->s == INVALID_SOCKET)
|
||||||
|
fatalbox("Open failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
static int rawtcp_msg(Session *sess, SOCKET sock, Net_Event_Type ne) {
|
||||||
|
struct rawtcp_private *rp = (struct rawtcp_private *)sess->back_priv;
|
||||||
|
|
||||||
|
switch (ne) {
|
||||||
|
case NE_NULL:
|
||||||
|
break;
|
||||||
|
case NE_OPEN:
|
||||||
|
break;
|
||||||
|
case NE_NOHOST:
|
||||||
|
case NE_REFUSED:
|
||||||
|
case NE_NOOPEN:
|
||||||
|
rp->s = INVALID_SOCKET;
|
||||||
|
fatalbox("Open failed");
|
||||||
|
break;
|
||||||
|
case NE_DATA:
|
||||||
|
break;
|
||||||
|
case NE_URGENT:
|
||||||
|
break;
|
||||||
|
case NE_CLOSING:
|
||||||
|
/* net_close(rp->s);*/
|
||||||
|
break;
|
||||||
|
case NE_CLOSED:
|
||||||
|
rp->s = INVALID_SOCKET;
|
||||||
|
fatalbox("Connection closed");
|
||||||
|
break;
|
||||||
|
case NE_TIMEOUT:
|
||||||
|
case NE_ABORT:
|
||||||
|
case NE_DIED:
|
||||||
|
fatalbox("Connection died");
|
||||||
|
rp->s = INVALID_SOCKET;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Emacs magic:
|
* Emacs magic:
|
||||||
* Local Variables:
|
* Local Variables:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user