1 /* $Id: testback.c,v 1.5 2003/01/12 16:11:27 ben Exp $ */
3 * Copyright (c) 1999 Simon Tatham
4 * Copyright (c) 1999 Ben Harris
7 * Permission is hereby granted, free of charge, to any person
8 * obtaining a copy of this software and associated documentation
9 * files (the "Software"), to deal in the Software without
10 * restriction, including without limitation the rights to use,
11 * copy, modify, merge, publish, distribute, sublicense, and/or
12 * sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following
16 * The above copyright notice and this permission notice shall be
17 * included in all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
23 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
24 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
25 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29 /* PuTTY test backends */
36 static char *null_init(void *, void **, Config
*, char *, int, char **, int);
37 static char *loop_init(void *, void **, Config
*, char *, int, char **, int);
38 static void null_reconfig(void *, Config
*);
39 static int null_send(void *, char *, int);
40 static int loop_send(void *, char *, int);
41 static int null_sendbuffer(void *);
42 static void null_size(void *, int, int);
43 static void null_special(void *, Telnet_Special
);
44 static Socket
null_socket(void *);
45 static int null_exitcode(void *);
46 static int null_sendok(void *);
47 static int null_ldisc(void *, int);
48 static void null_provide_ldisc(void *, void *);
49 static void null_provide_logctx(void *, void *);
50 static void null_unthrottle(void *, int);
52 Backend null_backend
= {
53 null_init
, null_reconfig
, null_send
, null_sendbuffer
, null_size
,
54 null_special
, null_socket
, null_exitcode
, null_sendok
, null_ldisc
,
55 null_provide_ldisc
, null_provide_logctx
, null_unthrottle
, 0
58 Backend loop_backend
= {
59 loop_init
, null_reconfig
, loop_send
, null_sendbuffer
, null_size
,
60 null_special
, null_socket
, null_exitcode
, null_sendok
, null_ldisc
,
61 null_provide_ldisc
, null_provide_logctx
, null_unthrottle
, 0
68 static char *null_init(void *frontend_handle
, void **backend_handle
,
69 Config
*cfg
, char *host
, int port
, char **realhost
,
75 static char *loop_init(void *frontend_handle
, void **backend_handle
,
76 Config
*cfg
, char *host
, int port
, char **realhost
,
78 struct loop_state
*st
= smalloc(sizeof(*st
));
80 st
->term
= frontend_handle
;
85 static void null_reconfig(void *handle
, Config
*cfg
) {
89 static int null_send(void *handle
, char *buf
, int len
) {
94 static int loop_send(void *handle
, char *buf
, int len
) {
95 struct loop_state
*st
= handle
;
97 return from_backend(st
->term
, 0, buf
, len
);
100 static int null_sendbuffer(void *handle
) {
105 static void null_size(void *handle
, int width
, int height
) {
109 static void null_special(void *handle
, Telnet_Special code
) {
113 static Socket
null_socket(void *handle
) {
118 static int null_exitcode(void *handle
) {
123 static int null_sendok(void *handle
) {
128 static void null_unthrottle(void *handle
, int backlog
) {
132 static int null_ldisc(void *handle
, int option
) {
137 static void null_provide_ldisc (void *handle
, void *ldisc
) {
141 static void null_provide_logctx(void *handle
, void *logctx
) {
148 * c-file-style: "simon"