Lines Matching refs:t
48 Terminal3270 *t = opaque; in DECLARE_INSTANCE_CHECKER() local
50 return INPUT_BUFFER_SIZE - t->in_len; in DECLARE_INSTANCE_CHECKER()
53 static void terminal_timer_cancel(Terminal3270 *t) in terminal_timer_cancel() argument
55 if (t->timer_tag) { in terminal_timer_cancel()
56 g_source_remove(t->timer_tag); in terminal_timer_cancel()
57 t->timer_tag = 0; in terminal_timer_cancel()
65 static void TN3270_handshake_done(Terminal3270 *t) in TN3270_handshake_done() argument
67 CcwDevice *ccw_dev = CCW_DEVICE(t); in TN3270_handshake_done()
70 t->handshake_done = true; in TN3270_handshake_done()
81 Terminal3270 *t = opaque; in send_timing_mark_cb() local
84 qemu_chr_fe_write_all(&t->chr, timing, sizeof(timing)); in send_timing_mark_cb()
99 Terminal3270 *t = opaque; in terminal_read() local
100 CcwDevice *ccw_dev = CCW_DEVICE(t); in terminal_read()
104 assert(size <= (INPUT_BUFFER_SIZE - t->in_len)); in terminal_read()
106 terminal_timer_cancel(t); in terminal_read()
107 t->timer_tag = g_timeout_add_seconds(600, send_timing_mark_cb, t); in terminal_read()
108 memcpy(&t->inv[t->in_len], buf, size); in terminal_read()
109 t->in_len += size; in terminal_read()
110 if (t->in_len < 2) { in terminal_read()
114 if (!t->handshake_done) { in terminal_read()
121 if (t->in_len > 6 && t->inv[2] == 0x18 && t->inv[3] == 0x0 && in terminal_read()
122 t->inv[t->in_len - 2] == IAC && t->inv[t->in_len - 1] == IAC_SE) { in terminal_read()
123 TN3270_handshake_done(t); in terminal_read()
124 t->in_len = 0; in terminal_read()
129 for (end = 0; end < t->in_len - 1; end++) { in terminal_read()
130 if (t->inv[end] == IAC && t->inv[end + 1] == IAC_EOR) { in terminal_read()
134 if (end == t->in_len - 2) { in terminal_read()
136 t->in_len -= 2; in terminal_read()
139 } else if (end < t->in_len - 2) { in terminal_read()
141 qemu_chr_fe_disconnect(&t->chr); in terminal_read()
150 Terminal3270 *t = opaque; in chr_event() local
151 CcwDevice *ccw_dev = CCW_DEVICE(t); in chr_event()
155 t->in_len = 0; in chr_event()
156 t->handshake_done = false; in chr_event()
157 terminal_timer_cancel(t); in chr_event()
166 t->timer_tag = g_timeout_add_seconds(600, send_timing_mark_cb, t); in chr_event()
182 Terminal3270 *t = TERMINAL_3270(dev); in terminal_init() local
190 qemu_chr_fe_set_handlers(&t->chr, terminal_can_read, in terminal_init()
191 terminal_read, chr_event, NULL, t, NULL, true); in terminal_init()
194 static inline CcwDataStream *get_cds(Terminal3270 *t) in get_cds() argument
196 return &(CCW_DEVICE(&t->cdev)->sch->cds); in get_cds()
201 Terminal3270 *t = TERMINAL_3270(dev); in read_payload_3270() local
205 len = MIN(ccw_dstream_avail(get_cds(t)), t->in_len); in read_payload_3270()
206 ret = ccw_dstream_write_buf(get_cds(t), t->inv, len); in read_payload_3270()
210 t->in_len -= len; in read_payload_3270()
244 Terminal3270 *t = TERMINAL_3270(dev); in write_payload_3270() local
246 int count = ccw_dstream_avail(get_cds(t)); in write_payload_3270()
251 if (!t->handshake_done) { in write_payload_3270()
252 if (!(t->outv[0] == IAC && t->outv[1] != IAC)) { in write_payload_3270()
260 if (!qemu_chr_fe_backend_connected(&t->chr)) { in write_payload_3270()
265 t->outv[out_len++] = cmd; in write_payload_3270()
267 retval = ccw_dstream_read_buf(get_cds(t), &t->outv[out_len], len); in write_payload_3270()
271 count = ccw_dstream_avail(get_cds(t)); in write_payload_3270()
274 out_len = insert_IAC_escape_char(t->outv, out_len); in write_payload_3270()
276 t->outv[out_len++] = IAC; in write_payload_3270()
277 t->outv[out_len++] = IAC_EOR; in write_payload_3270()
279 retval = qemu_chr_fe_write_all(&t->chr, t->outv, out_len); in write_payload_3270()
283 return (retval <= 0) ? 0 : get_cds(t)->count; in write_payload_3270()