hide scrollbar - you can use more than just Shift+PgUp/Dn to scroll now.
[u/mdw/putty] / testback.c
CommitLineData
50a0d2b7 1/* $Id: testback.c,v 1.9 2003/05/10 11:57:55 ben Exp $ */
d361f0a5 2/*
3 * Copyright (c) 1999 Simon Tatham
4 * Copyright (c) 1999 Ben Harris
5 * All rights reserved.
6 *
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
14 * conditions:
15 *
16 * The above copyright notice and this permission notice shall be
17 * included in all copies or substantial portions of the Software.
18 *
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
26 * SOFTWARE.
27 */
28
29/* PuTTY test backends */
30
31#include <stdio.h>
32#include <stdlib.h>
33
34#include "putty.h"
35
50a0d2b7 36static const char *null_init(void *, void **, Config *, char *, int, char **,
37 int);
38static const char *loop_init(void *, void **, Config *, char *, int, char **,
39 int);
fabd1805 40static void null_free(void *);
41static void loop_free(void *);
2e96d504 42static void null_reconfig(void *, Config *);
d361f0a5 43static int null_send(void *, char *, int);
44static int loop_send(void *, char *, int);
45static int null_sendbuffer(void *);
46static void null_size(void *, int, int);
47static void null_special(void *, Telnet_Special);
bac857ca 48static const struct telnet_special *null_get_specials(void *handle);
d361f0a5 49static Socket null_socket(void *);
50static int null_exitcode(void *);
51static int null_sendok(void *);
52static int null_ldisc(void *, int);
53static void null_provide_ldisc(void *, void *);
54static void null_provide_logctx(void *, void *);
55static void null_unthrottle(void *, int);
56
57Backend null_backend = {
fabd1805 58 null_init, null_free, null_reconfig, null_send, null_sendbuffer, null_size,
bac857ca 59 null_special, null_get_specials, null_socket, null_exitcode, null_sendok,
60 null_ldisc, null_provide_ldisc, null_provide_logctx, null_unthrottle, 0
d361f0a5 61};
62
63Backend loop_backend = {
fabd1805 64 loop_init, loop_free, null_reconfig, loop_send, null_sendbuffer, null_size,
bac857ca 65 null_special, null_get_specials, null_socket, null_exitcode, null_sendok,
66 null_ldisc, null_provide_ldisc, null_provide_logctx, null_unthrottle, 0
d361f0a5 67};
68
69struct loop_state {
70 Terminal *term;
71};
72
50a0d2b7 73static const char *null_init(void *frontend_handle, void **backend_handle,
74 Config *cfg, char *host, int port,
75 char **realhost, int nodelay) {
d361f0a5 76
77 return NULL;
78}
79
50a0d2b7 80static const char *loop_init(void *frontend_handle, void **backend_handle,
81 Config *cfg, char *host, int port,
82 char **realhost, int nodelay) {
3d88e64d 83 struct loop_state *st = snew(struct loop_state);
d361f0a5 84
85 st->term = frontend_handle;
a27230dd 86 *backend_handle = st;
87 return NULL;
d361f0a5 88}
89
fabd1805 90static void null_free(void *handle)
91{
92
93}
94
95static void loop_free(void *handle)
96{
97
98 sfree(handle);
99}
100
2e96d504 101static void null_reconfig(void *handle, Config *cfg) {
102
103}
104
d361f0a5 105static int null_send(void *handle, char *buf, int len) {
106
107 return 0;
108}
109
110static int loop_send(void *handle, char *buf, int len) {
111 struct loop_state *st = handle;
112
113 return from_backend(st->term, 0, buf, len);
114}
115
116static int null_sendbuffer(void *handle) {
117
118 return 0;
119}
120
121static void null_size(void *handle, int width, int height) {
122
123}
124
125static void null_special(void *handle, Telnet_Special code) {
126
127}
128
bac857ca 129static const struct telnet_special *null_get_specials (void *handle) {
130
131 return NULL;
132}
133
d361f0a5 134static Socket null_socket(void *handle) {
135
136 return NULL;
137}
138
139static int null_exitcode(void *handle) {
140
141 return 0;
142}
143
144static int null_sendok(void *handle) {
145
146 return 1;
147}
148
149static void null_unthrottle(void *handle, int backlog) {
150
151}
152
153static int null_ldisc(void *handle, int option) {
154
155 return 0;
156}
157
158static void null_provide_ldisc (void *handle, void *ldisc) {
159
160}
161
162static void null_provide_logctx(void *handle, void *logctx) {
163
164}
165
166/*
167 * Emacs magic:
168 * Local Variables:
169 * c-file-style: "simon"
170 * End:
171 */