First Commit of my working state
[simh.git] / sim_tmxr.h
1 /* sim_tmxr.h: terminal multiplexor definitions
2
3 Copyright (c) 2001-2005, Robert M Supnik
4
5 Permission is hereby granted, free of charge, to any person obtaining a
6 copy of this software and associated documentation files (the "Software"),
7 to deal in the Software without restriction, including without limitation
8 the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 and/or sell copies of the Software, and to permit persons to whom the
10 Software is furnished to do so, subject to the following conditions:
11
12 The above copyright notice and this permission notice shall be included in
13 all copies or substantial portions of the Software.
14
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 ROBERT M SUPNIK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 Except as contained in this notice, the name of Robert M Supnik shall not be
23 used in advertising or otherwise to promote the sale, use or other dealings
24 in this Software without prior written authorization from Robert M Supnik.
25
26 Based on the original DZ11 simulator by Thord Nilson, as updated by
27 Arthur Krewat.
28
29 04-Jan-04 RMS Changed TMXR ldsc to be pointer to linedesc array
30 Added tmxr_linemsg, logging (from Mark Pizzolato)
31 29-Dec-03 RMS Added output stall support, increased buffer size
32 22-Dec-02 RMS Added break support (from Mark Pizzolato)
33 20-Aug-02 RMS Added tmxr_open_master, tmxr_close_master, tmxr.port
34 30-Dec-01 RMS Renamed tmxr_fstatus, added tmxr_fstats
35 20-Oct-01 RMS Removed tmxr_getchar, formalized buffer guard,
36 added tmxr_rqln, tmxr_tqln
37 */
38
39 #ifndef _SIM_TMXR_H_
40 #define _SIM_TMXR_H_ 0
41
42 #define TMXR_V_VALID 15
43 #define TMXR_VALID (1 << TMXR_V_VALID)
44 #define TMXR_MAXBUF 256 /* buffer size */
45 #define TMXR_GUARD 12 /* buffer guard */
46
47 struct tmln {
48 SOCKET conn; /* line conn */
49 uint32 ipad; /* IP address */
50 uint32 cnms; /* conn time */
51 int32 tsta; /* Telnet state */
52 int32 rcve; /* rcv enable */
53 int32 xmte; /* xmt enable */
54 int32 dstb; /* disable Tlnt bin */
55 int32 rxbpr; /* rcv buf remove */
56 int32 rxbpi; /* rcv buf insert */
57 int32 rxcnt; /* rcv count */
58 int32 txbpr; /* xmt buf remove */
59 int32 txbpi; /* xmt buf insert */
60 int32 txcnt; /* xmt count */
61 FILE *txlog; /* xmt log file */
62 char *txlogname; /* xmt log file name */
63 char rxb[TMXR_MAXBUF]; /* rcv buffer */
64 char rbr[TMXR_MAXBUF]; /* rcv break */
65 char txb[TMXR_MAXBUF]; /* xmt buffer */
66 };
67
68 typedef struct tmln TMLN;
69
70 struct tmxr {
71 int32 lines; /* # lines */
72 int32 port; /* listening port */
73 SOCKET master; /* master socket */
74 TMLN *ldsc; /* line descriptors */
75 };
76
77 typedef struct tmxr TMXR;
78
79 int32 tmxr_poll_conn (TMXR *mp);
80 void tmxr_reset_ln (TMLN *lp);
81 int32 tmxr_getc_ln (TMLN *lp);
82 void tmxr_poll_rx (TMXR *mp);
83 t_stat tmxr_putc_ln (TMLN *lp, int32 chr);
84 void tmxr_poll_tx (TMXR *mp);
85 t_stat tmxr_open_master (TMXR *mp, char *cptr);
86 t_stat tmxr_close_master (TMXR *mp);
87 t_stat tmxr_attach (TMXR *mp, UNIT *uptr, char *cptr);
88 t_stat tmxr_detach (TMXR *mp, UNIT *uptr);
89 t_stat tmxr_ex (t_value *vptr, t_addr addr, UNIT *uptr, int32 sw);
90 t_stat tmxr_dep (t_value val, t_addr addr, UNIT *uptr, int32 sw);
91 void tmxr_msg (SOCKET sock, char *msg);
92 void tmxr_linemsg (TMLN *lp, char *msg);
93 void tmxr_fconns (FILE *st, TMLN *lp, int32 ln);
94 void tmxr_fstats (FILE *st, TMLN *lp, int32 ln);
95 t_stat tmxr_set_log (UNIT *uptr, int32 val, char *cptr, void *desc);
96 t_stat tmxr_set_nolog (UNIT *uptr, int32 val, char *cptr, void *desc);
97 t_stat tmxr_show_log (FILE *st, UNIT *uptr, int32 val, void *desc);
98 t_stat tmxr_dscln (UNIT *uptr, int32 val, char *cptr, void *desc);
99 int32 tmxr_rqln (TMLN *lp);
100 int32 tmxr_tqln (TMLN *lp);
101
102 #endif
103