1709795f |
1 | #include <stdio.h> |
2 | #include <stdlib.h> |
3 | |
4 | #include "putty.h" |
5 | |
6 | #ifndef FALSE |
7 | #define FALSE 0 |
8 | #endif |
9 | #ifndef TRUE |
10 | #define TRUE 1 |
11 | #endif |
12 | |
13 | static void pty_size(void); |
14 | |
15 | static void c_write(char *buf, int len) |
16 | { |
17 | from_backend(0, buf, len); |
18 | } |
19 | |
20 | /* |
21 | * Called to set up the pty. |
22 | * |
23 | * Returns an error message, or NULL on success. |
24 | * |
25 | * Also places the canonical host name into `realhost'. It must be |
26 | * freed by the caller. |
27 | */ |
28 | static char *pty_init(char *host, int port, char **realhost, int nodelay) |
29 | { |
30 | /* FIXME: do nothing for now */ |
31 | return NULL; |
32 | } |
33 | |
34 | /* |
35 | * Called to send data down the pty. |
36 | */ |
37 | static int pty_send(char *buf, int len) |
38 | { |
39 | c_write(buf, len); /* FIXME: diagnostic thingy */ |
40 | return 0; |
41 | } |
42 | |
43 | /* |
44 | * Called to query the current socket sendability status. |
45 | */ |
46 | static int pty_sendbuffer(void) |
47 | { |
48 | return 0; |
49 | } |
50 | |
51 | /* |
52 | * Called to set the size of the window |
53 | */ |
54 | static void pty_size(void) |
55 | { |
56 | /* FIXME: will need to do TIOCSWINSZ or whatever. */ |
57 | return; |
58 | } |
59 | |
60 | /* |
61 | * Send special codes. |
62 | */ |
63 | static void pty_special(Telnet_Special code) |
64 | { |
65 | /* Do nothing! */ |
66 | return; |
67 | } |
68 | |
69 | static Socket pty_socket(void) |
70 | { |
71 | return NULL; /* shouldn't ever be needed */ |
72 | } |
73 | |
74 | static int pty_sendok(void) |
75 | { |
76 | return 1; |
77 | } |
78 | |
79 | static void pty_unthrottle(int backlog) |
80 | { |
81 | /* do nothing */ |
82 | } |
83 | |
84 | static int pty_ldisc(int option) |
85 | { |
86 | return 0; /* neither editing nor echoing */ |
87 | } |
88 | |
89 | static int pty_exitcode(void) |
90 | { |
91 | /* Shouldn't ever be required */ |
92 | return 0; |
93 | } |
94 | |
95 | Backend pty_backend = { |
96 | pty_init, |
97 | pty_send, |
98 | pty_sendbuffer, |
99 | pty_size, |
100 | pty_special, |
101 | pty_socket, |
102 | pty_exitcode, |
103 | pty_sendok, |
104 | pty_ldisc, |
105 | pty_unthrottle, |
106 | 1 |
107 | }; |