14 static Socket s = NULL;
16 static void raw_size(void);
18 static int sb_opt, sb_len;
19 static char *sb_buf = NULL;
20 static int sb_size = 0;
23 static void c_write (char *buf, int len) {
24 from_backend(0, buf, len);
27 static int raw_closing (Plug plug, char *error_msg, int error_code, int calling_back) {
31 /* A socket error has occurred. */
32 connection_fatal (error_msg);
33 } /* Otherwise, the remote side closed the connection normally. */
37 static int raw_receive (Plug plug, int urgent, char *data, int len) {
43 * Called to set up the raw connection.
45 * Returns an error message, or NULL on success.
47 * Also places the canonical host name into `realhost'.
49 static char *raw_init (char *host, int port, char **realhost) {
50 static struct plug_function_table fn_table = {
53 }, *fn_table_ptr = &fn_table;
61 addr = sk_namelookup(host, realhost);
62 if ( (err = sk_addr_error(addr)) )
66 port = 23; /* default telnet port */
71 s = sk_new(addr, port, 0, 1, &fn_table_ptr);
72 if ( (err = sk_socket_error(s)) )
81 * Called to send data down the raw connection.
83 static void raw_send (char *buf, int len) {
88 sk_write(s, buf, len);
92 * Called to set the size of the window
94 static void raw_size(void) {
100 * Send raw special codes.
102 static void raw_special (Telnet_Special code) {
107 static Socket raw_socket(void) { return s; }
109 static int raw_sendok(void) { return 1; }
111 static int raw_ldisc(int option) {
112 if (option == LD_EDIT || option == LD_ECHO)
117 Backend raw_backend = {