Times and dates in the event log, fixing ltime() in the process.
[u/mdw/putty] / testback.c
CommitLineData
f89c3294 1/* $Id$ */
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 **,
79bf227b 37 int, int);
50a0d2b7 38static const char *loop_init(void *, void **, Config *, char *, int, char **,
79bf227b 39 int, 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,
f89c3294 60 null_ldisc, null_provide_ldisc, null_provide_logctx, null_unthrottle,
61 null_cfg_info, 0
d361f0a5 62};
63
64Backend loop_backend = {
fabd1805 65 loop_init, loop_free, null_reconfig, loop_send, null_sendbuffer, null_size,
bac857ca 66 null_special, null_get_specials, null_socket, null_exitcode, null_sendok,
f89c3294 67 null_ldisc, null_provide_ldisc, null_provide_logctx, null_unthrottle,
68 null_cfg_info, 0
d361f0a5 69};
70
71struct loop_state {
72 Terminal *term;
73};
74
50a0d2b7 75static const char *null_init(void *frontend_handle, void **backend_handle,
76 Config *cfg, char *host, int port,
79bf227b 77 char **realhost, int nodelay, int keepalive) {
d361f0a5 78
79 return NULL;
80}
81
50a0d2b7 82static const char *loop_init(void *frontend_handle, void **backend_handle,
83 Config *cfg, char *host, int port,
79bf227b 84 char **realhost, int nodelay, int keepalive) {
3d88e64d 85 struct loop_state *st = snew(struct loop_state);
d361f0a5 86
87 st->term = frontend_handle;
a27230dd 88 *backend_handle = st;
89 return NULL;
d361f0a5 90}
91
fabd1805 92static void null_free(void *handle)
93{
94
95}
96
97static void loop_free(void *handle)
98{
99
100 sfree(handle);
101}
102
2e96d504 103static void null_reconfig(void *handle, Config *cfg) {
104
105}
106
d361f0a5 107static int null_send(void *handle, char *buf, int len) {
108
109 return 0;
110}
111
112static int loop_send(void *handle, char *buf, int len) {
113 struct loop_state *st = handle;
114
115 return from_backend(st->term, 0, buf, len);
116}
117
118static int null_sendbuffer(void *handle) {
119
120 return 0;
121}
122
123static void null_size(void *handle, int width, int height) {
124
125}
126
127static void null_special(void *handle, Telnet_Special code) {
128
129}
130
bac857ca 131static const struct telnet_special *null_get_specials (void *handle) {
132
133 return NULL;
134}
135
d361f0a5 136static Socket null_socket(void *handle) {
137
138 return NULL;
139}
140
141static int null_exitcode(void *handle) {
142
143 return 0;
144}
145
146static int null_sendok(void *handle) {
147
148 return 1;
149}
150
151static void null_unthrottle(void *handle, int backlog) {
152
153}
154
155static int null_ldisc(void *handle, int option) {
156
157 return 0;
158}
159
160static void null_provide_ldisc (void *handle, void *ldisc) {
161
162}
163
164static void null_provide_logctx(void *handle, void *logctx) {
165
166}
167
f89c3294 168static int null_cfg_info(void *handle)
169{
170 return 0;
171}
172
173
d361f0a5 174/*
175 * Emacs magic:
176 * Local Variables:
177 * c-file-style: "simon"
178 * End:
179 */