API reference¶
The exported API of package tn5250, from its doc comments (the same text that go doc -all and pkg.go.dev show).
import "github.com/D-Modem/go-ibmterm/tn5250"
Package tn5250 is the IBM 5250 data stream for the ibmterm library: a TN5250 server (RFC 1205, RFC 2877, RFC 4777). NegotiateTelnet does the telnet negotiation on a new connection and returns a DevInfo, which is an ibmterm.Terminal. Programs then show ibmterm screens on it with ibmterm.ShowScreenOpts, ibmterm.HandleScreen or ibmterm.RunTransactions.
Variables¶
ErrBadRecord is the error when the client sends a record that is not a 5250 record.
ErrNo5250 is the error when the client does not agree to the telnet options of TN5250 (TERMINAL-TYPE, END-OF-RECORD and BINARY).
ErrUnknownTerminal is the error when the terminal type of the client is not a 5250 type (see Is5250).
var Models = []Model{
{"IBM-5251-11", 24, 80, false},
{"IBM-5291-1", 24, 80, false},
{"IBM-5292-2", 24, 80, true},
{"IBM-5555-B01", 24, 80, false},
{"IBM-5555-C01", 24, 80, true},
{"IBM-3179-2", 24, 80, true},
{"IBM-3196-A1", 24, 80, false},
{"IBM-3180-2", 27, 132, false},
{"IBM-3477-FC", 27, 132, true},
{"IBM-3477-FG", 27, 132, false},
{"IBM-3486-BA", 24, 80, false},
{"IBM-3487-HA", 24, 80, false},
{"IBM-3487-HC", 24, 80, true},
}
Models are the 5250 terminal types that the package knows (RFC 1205, RFC 2877).
Functions¶
Is5250¶
Is5250 tells if ttype is a 5250 terminal type of Models.
Types¶
DevInfo¶
type DevInfo interface {
ibmterm.Terminal
// DeviceName is the device name that the client asked for (the
// DEVNAME variable of NEW-ENVIRON), or "".
DeviceName() string
// Environ returns the NEW-ENVIRON variables of the client, by name
// (for example "DEVNAME", "KBDTYPE", "CODEPAGE", "CHARSET", "USER").
// The map is a copy.
Environ() map[string]string
}
DevInfo is a connected 5250. It is an ibmterm.Terminal, with the data that only TN5250 has.
NegotiateTelnet¶
NegotiateTelnet does the telnet negotiation of TN5250 on a new connection: TERMINAL-TYPE, NEW-ENVIRON (if the client has it), END-OF-RECORD and BINARY in the two directions. It returns ErrNo5250 if the client refuses an option that TN5250 must have, and ErrUnknownTerminal (with the DevInfo nil) if the terminal type is not a 5250 type.
NewDevInfo¶
NewDevInfo makes a DevInfo for the terminal type ttype with no telnet negotiation, for tests and for a connection that was negotiated before. env can be nil. It returns ErrUnknownTerminal if ttype is not a 5250 type.
Model¶
type Model struct {
Type string // the telnet terminal type, for example "IBM-3477-FC"
Rows, Cols int // the screen size: 24x80 or 27x132
Color bool // true if the terminal shows colors
}
Model is the data of one 5250 terminal type.
ModelOf¶
ModelOf returns the Model of the terminal type ttype (the case of the letters is not important), and false if the type is not a 5250 type.