15 static Socket s = NULL;
17 static void rlogin_size(void);
19 static int sb_opt, sb_len;
20 static char *sb_buf = NULL;
21 static int sb_size = 0;
24 static void c_write(char *buf, int len)
26 from_backend(0, buf, len);
29 static int rlogin_closing(Plug plug, char *error_msg, int error_code,
35 /* A socket error has occurred. */
36 connection_fatal(error_msg);
37 } /* Otherwise, the remote side closed the connection normally. */
41 static int rlogin_receive(Plug plug, int urgent, char *data, int len)
51 * We should flush everything (aka Telnet SYNCH) if we see
52 * 0x02, and we should turn off and on _local_ flow control
53 * on 0x10 and 0x20 respectively. I'm not convinced it's
58 * Main rlogin protocol. This is really simple: the first
59 * byte is expected to be NULL and is ignored, and the rest
62 static int firstbyte = 1;
64 if (data[0] == '\0') {
76 * Called to set up the rlogin connection.
78 * Returns an error message, or NULL on success.
80 * Also places the canonical host name into `realhost'.
82 static char *rlogin_init(char *host, int port, char **realhost)
84 static struct plug_function_table fn_table = {
87 }, *fn_table_ptr = &fn_table;
95 addr = sk_namelookup(host, realhost);
96 if ((err = sk_addr_error(addr)))
100 port = 513; /* default rlogin port */
105 s = sk_new(addr, port, 1, 0, &fn_table_ptr);
106 if ((err = sk_socket_error(s)))
112 * Send local username, remote username, terminal/speed
119 sk_write(s, cfg.localusername, strlen(cfg.localusername));
121 sk_write(s, cfg.username, strlen(cfg.username));
123 sk_write(s, cfg.termtype, strlen(cfg.termtype));
125 for (p = cfg.termspeed; isdigit(*p); p++);
126 sk_write(s, cfg.termspeed, p - cfg.termspeed);
134 * Called to send data down the rlogin connection.
136 static void rlogin_send(char *buf, int len)
142 sk_write(s, buf, len);
146 * Called to set the size of the window
148 static void rlogin_size(void)
150 char b[12] = { '\xFF', '\xFF', 0x73, 0x73, 0, 0, 0, 0, 0, 0, 0, 0 };
161 * Send rlogin special codes.
163 static void rlogin_special(Telnet_Special code)
169 static Socket rlogin_socket(void)
174 static int rlogin_sendok(void)
179 static int rlogin_ldisc(int option)
184 Backend rlogin_backend = {