14 #define RAW_MAX_BACKLOG 4096
16 static Socket s = NULL;
17 static int raw_bufsize;
19 static void raw_size(void);
21 static void c_write(char *buf, int len)
23 int backlog = from_backend(0, buf, len);
24 sk_set_frozen(s, backlog > RAW_MAX_BACKLOG);
27 static int raw_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 raw_receive(Plug plug, int urgent, char *data, int len)
48 * Called to set up the raw connection.
50 * Returns an error message, or NULL on success.
52 * Also places the canonical host name into `realhost'. It must be
53 * freed by the caller.
55 static char *raw_init(char *host, int port, char **realhost)
57 static struct plug_function_table fn_table = {
60 }, *fn_table_ptr = &fn_table;
68 addr = sk_namelookup(host, realhost);
69 if ((err = sk_addr_error(addr)))
73 port = 23; /* default telnet port */
78 s = sk_new(addr, port, 0, 1, &fn_table_ptr);
79 if ((err = sk_socket_error(s)))
88 * Called to send data down the raw connection.
90 static int raw_send(char *buf, int len)
95 raw_bufsize = sk_write(s, buf, len);
101 * Called to query the current socket sendability status.
103 static int raw_sendbuffer(void)
109 * Called to set the size of the window
111 static void raw_size(void)
118 * Send raw special codes.
120 static void raw_special(Telnet_Special code)
126 static Socket raw_socket(void)
131 static int raw_sendok(void)
136 static void raw_unthrottle(int backlog)
138 sk_set_frozen(s, backlog > RAW_MAX_BACKLOG);
141 static int raw_ldisc(int option)
143 if (option == LD_EDIT || option == LD_ECHO)
148 Backend raw_backend = {