Make this compile again.
[u/mdw/putty] / testback.c
CommitLineData
2e96d504 1/* $Id: testback.c,v 1.5 2003/01/12 16:11:27 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
2e96d504 36static char *null_init(void *, void **, Config *, char *, int, char **, int);
37static char *loop_init(void *, void **, Config *, char *, int, char **, int);
38static void null_reconfig(void *, Config *);
d361f0a5 39static int null_send(void *, char *, int);
40static int loop_send(void *, char *, int);
41static int null_sendbuffer(void *);
42static void null_size(void *, int, int);
43static void null_special(void *, Telnet_Special);
44static Socket null_socket(void *);
45static int null_exitcode(void *);
46static int null_sendok(void *);
47static int null_ldisc(void *, int);
48static void null_provide_ldisc(void *, void *);
49static void null_provide_logctx(void *, void *);
50static void null_unthrottle(void *, int);
51
52Backend null_backend = {
2e96d504 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
d361f0a5 56};
57
58Backend loop_backend = {
2e96d504 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
d361f0a5 62};
63
64struct loop_state {
65 Terminal *term;
66};
67
68static char *null_init(void *frontend_handle, void **backend_handle,
2e96d504 69 Config *cfg, char *host, int port, char **realhost,
70 int nodelay) {
d361f0a5 71
72 return NULL;
73}
74
75static char *loop_init(void *frontend_handle, void **backend_handle,
2e96d504 76 Config *cfg, char *host, int port, char **realhost,
77 int nodelay) {
d361f0a5 78 struct loop_state *st = smalloc(sizeof(*st));
79
80 st->term = frontend_handle;
a27230dd 81 *backend_handle = st;
82 return NULL;
d361f0a5 83}
84
2e96d504 85static void null_reconfig(void *handle, Config *cfg) {
86
87}
88
d361f0a5 89static int null_send(void *handle, char *buf, int len) {
90
91 return 0;
92}
93
94static int loop_send(void *handle, char *buf, int len) {
95 struct loop_state *st = handle;
96
97 return from_backend(st->term, 0, buf, len);
98}
99
100static int null_sendbuffer(void *handle) {
101
102 return 0;
103}
104
105static void null_size(void *handle, int width, int height) {
106
107}
108
109static void null_special(void *handle, Telnet_Special code) {
110
111}
112
113static Socket null_socket(void *handle) {
114
115 return NULL;
116}
117
118static int null_exitcode(void *handle) {
119
120 return 0;
121}
122
123static int null_sendok(void *handle) {
124
125 return 1;
126}
127
128static void null_unthrottle(void *handle, int backlog) {
129
130}
131
132static int null_ldisc(void *handle, int option) {
133
134 return 0;
135}
136
137static void null_provide_ldisc (void *handle, void *ldisc) {
138
139}
140
141static void null_provide_logctx(void *handle, void *logctx) {
142
143}
144
145/*
146 * Emacs magic:
147 * Local Variables:
148 * c-file-style: "simon"
149 * End:
150 */