1 /* $Id: testback.c 7628 2007-06-30 21:56:44Z jacob $ */
\r
3 * Copyright (c) 1999 Simon Tatham
\r
4 * Copyright (c) 1999 Ben Harris
\r
5 * All rights reserved.
\r
7 * Permission is hereby granted, free of charge, to any person
\r
8 * obtaining a copy of this software and associated documentation
\r
9 * files (the "Software"), to deal in the Software without
\r
10 * restriction, including without limitation the rights to use,
\r
11 * copy, modify, merge, publish, distribute, sublicense, and/or
\r
12 * sell copies of the Software, and to permit persons to whom the
\r
13 * Software is furnished to do so, subject to the following
\r
16 * The above copyright notice and this permission notice shall be
\r
17 * included in all copies or substantial portions of the Software.
\r
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
\r
20 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
\r
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
\r
22 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
\r
23 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
\r
24 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
\r
25 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
\r
29 /* PuTTY test backends */
\r
36 static const char *null_init(void *, void **, Config *, char *, int, char **,
\r
38 static const char *loop_init(void *, void **, Config *, char *, int, char **,
\r
40 static void null_free(void *);
\r
41 static void loop_free(void *);
\r
42 static void null_reconfig(void *, Config *);
\r
43 static int null_send(void *, char *, int);
\r
44 static int loop_send(void *, char *, int);
\r
45 static int null_sendbuffer(void *);
\r
46 static void null_size(void *, int, int);
\r
47 static void null_special(void *, Telnet_Special);
\r
48 static const struct telnet_special *null_get_specials(void *handle);
\r
49 static int null_connected(void *);
\r
50 static int null_exitcode(void *);
\r
51 static int null_sendok(void *);
\r
52 static int null_ldisc(void *, int);
\r
53 static void null_provide_ldisc(void *, void *);
\r
54 static void null_provide_logctx(void *, void *);
\r
55 static void null_unthrottle(void *, int);
\r
56 static int null_cfg_info(void *);
\r
58 Backend null_backend = {
\r
59 null_init, null_free, null_reconfig, null_send, null_sendbuffer, null_size,
\r
60 null_special, null_get_specials, null_connected, null_exitcode, null_sendok,
\r
61 null_ldisc, null_provide_ldisc, null_provide_logctx, null_unthrottle,
\r
62 null_cfg_info, "null", -1, 0
\r
65 Backend loop_backend = {
\r
66 loop_init, loop_free, null_reconfig, loop_send, null_sendbuffer, null_size,
\r
67 null_special, null_get_specials, null_connected, null_exitcode, null_sendok,
\r
68 null_ldisc, null_provide_ldisc, null_provide_logctx, null_unthrottle,
\r
69 null_cfg_info, "loop", -1, 0
\r
76 static const char *null_init(void *frontend_handle, void **backend_handle,
\r
77 Config *cfg, char *host, int port,
\r
78 char **realhost, int nodelay, int keepalive) {
\r
83 static const char *loop_init(void *frontend_handle, void **backend_handle,
\r
84 Config *cfg, char *host, int port,
\r
85 char **realhost, int nodelay, int keepalive) {
\r
86 struct loop_state *st = snew(struct loop_state);
\r
88 st->term = frontend_handle;
\r
89 *backend_handle = st;
\r
93 static void null_free(void *handle)
\r
98 static void loop_free(void *handle)
\r
104 static void null_reconfig(void *handle, Config *cfg) {
\r
108 static int null_send(void *handle, char *buf, int len) {
\r
113 static int loop_send(void *handle, char *buf, int len) {
\r
114 struct loop_state *st = handle;
\r
116 return from_backend(st->term, 0, buf, len);
\r
119 static int null_sendbuffer(void *handle) {
\r
124 static void null_size(void *handle, int width, int height) {
\r
128 static void null_special(void *handle, Telnet_Special code) {
\r
132 static const struct telnet_special *null_get_specials (void *handle) {
\r
137 static int null_connected(void *handle) {
\r
142 static int null_exitcode(void *handle) {
\r
147 static int null_sendok(void *handle) {
\r
152 static void null_unthrottle(void *handle, int backlog) {
\r
156 static int null_ldisc(void *handle, int option) {
\r
161 static void null_provide_ldisc (void *handle, void *ldisc) {
\r
165 static void null_provide_logctx(void *handle, void *logctx) {
\r
169 static int null_cfg_info(void *handle)
\r
178 * c-file-style: "simon"
\r