1 /*
2  * Copyright (c) 2016 Charles Anthony
3  * Copyright (c) 2021 The DPS8M Development Team
4  *
5  * All rights reserved.
6  *
7  * This software is made available under the terms of the ICU
8  * License, version 1.8.1 or later.  For more details, see the
9  * LICENSE.md file at the top-level directory of this distribution.
10  */
11 
12 typedef void (* uv_read_cb_t) (uv_tcp_t * client, ssize_t nread, unsigned char * buf);
13 typedef void (* uv_write_cb_t) (uv_tcp_t * client, unsigned char * data, ssize_t datalen);
14 struct uvClientData_s
15   {
16     bool assoc;
17     uint fnpno;
18     uint lineno;
19     /* telnet_t */ void * telnetp;
20     uv_read_cb_t read_cb;
21     uv_write_cb_t write_cb;
22     uv_write_cb_t write_actual_cb;
23     // Work buffer for processLineInput
24     char buffer [1024];
25     size_t nPos;
26     // 3270
27     char * ttype;
28     uint stationNo;
29   };
30 
31 typedef struct uvClientData_s uvClientData;
32 
33 void fnpuvInit (int telnet_port, char * telnet_address);
34 void fnpuv3270Init (int telnet3270_port);
35 void fnpuv3270Poll (bool start);
36 void fnpuvProcessEvent (void);
37 void fnpuv_start_write (uv_tcp_t * client, unsigned char * data, ssize_t len);
38 void fnpuv_start_writestr (uv_tcp_t * client, unsigned char * data);
39 void fnpuv_send_eor (uv_tcp_t * client);
40 void fnpuv_recv_eor (uv_tcp_t * client);
41 void fnpuv_start_write_actual (uv_tcp_t * client, unsigned char * data, ssize_t datalen);
42 void fnpuv_associated_brk (uv_tcp_t * client);
43 void fnpuv_unassociated_readcb (uv_tcp_t * client, ssize_t nread, unsigned char * buf);
44 void fnpuv_associated_readcb (uv_tcp_t * client, ssize_t nread, unsigned char * buf);
45 void fnpuv_read_start (uv_tcp_t * client);
46 void fnpuv_read_stop (uv_tcp_t * client);
47 void fnpuv_dial_out (uint fnpno, uint lineno, word36 d1, word36 d2, word36 d3);
48 void fnpuv_open_slave (uint fnpno, uint lineno);
49 void close_connection (uv_stream_t* stream);
50 #ifdef TUN
51 void fnpTUNProcessEvent (void);
52 #endif
53 void fnpuv_3270_readcb (uv_tcp_t * client,
54                            ssize_t nread,
55                            unsigned char * buf);
56 void fnpuv_start_3270_write (uv_tcp_t * client, unsigned char * data, ssize_t datalen);
57 void reset_line (struct t_line * linep);
58