SOURCE..: HP3000 - NetIPC - INBOUND TELNET SERVER Free software. No Warranty. Not for resale. Copyright 1994 University of Notre Dame. Thanks to Scott Herman for lending me his examples of NetIPC code. Thanks to Jim Wowchuk of Sydney NSW Australia for his suggestions on the MPE daemon and feedback. ************************* IMPORTANT ********************************* ** ** ** OBTAIN MPE COMMAND FILE: 'NQTUNPAC' to unpack NQTELNET server ** ** ** ********************************************************************* FTP SITE: opus.admin.utc.edu dir: /pub/hp3000-l/nqtelnet.* ======================================================================== NQTELNET HP FORMAT: :FILE NQTELNET;REC=,,U,BINARY;CODE=72;DISC=2000 ======================================================================== Record size is 256 on WRQ 'specify attributes' transfer. METHODS: FILES: DESCRIPTION: ======== ============ =============================================== WRQ/PC: NQTELNET.ZIP - FTP to PC; UNZIP all files, WRQ upload files: ZIP ------------ ----------------------------------------------- NQTELNET.WRQ - WRQ:_File_Includes_attributes. NQTUNPAC - WRQ ASCII transfer. NQTELDOC - WRQ ASCII transfer. UNIX: nqtelnet.Z - FTP to Unix; uncompress nqtelnet.Z .Z ---------- ----------------------------------------------- nqtelnet - FTP to HP3000 (or WRQ binary) NQTUNPAC - FTP to HP3000 (or WRQ ascii) NQTELDOC - FTP to HP3000 (or WRQ ascii) NQTELNET.FTP - FTP to HP3000 /PC /Unix (file not compressed) ------------ ----------------------------------------------- *same as for Unix after uncompress (above) HP3000: MPE 'upload' file attributes must look like: =============================================== FILENAME CODE ------- LOGICAL RECORD --- SIZE TYP EOF LIMIT R/B NQTELNET 72 128W UB x x 1 NQTELDOC 80B FA x x x NQTUNPAC 80B FA x x x INSTALL: Execute MPE command file unpacker 'NQTUNPAC'. ============================================ Follow directions and answer prompts. Places files within your logon group. DEMO: Start demo by typing MPE command file: 'NQTELCMD ' =========================================================== Default port is standard telnet 23. If conflicts, change to any unused port, such as '1023' or '3000' for example. VERSION.: 94.8.2 -Initial Release. 95.10.17- Added code to handle POSIX interrupts on HPSELECT calls. Tested on MPE 5.0.2 ok. 94.11.7- Fixed Monitor program NQTELJ that randomly hung clients trying to connect: (NSERR 37's). -Added timestamps to logging messages. -Tested on MPE 5.0 (pull) - Limited test shows some file names running together/jumbled using LISTF @,0. LISTF @,1... etc. appears normal. 94.9.6+ Made the 'c/' command interactive by launching an MPE son process and using the 'r/' run program interface. This allows FULL MPE command syntax server support, but requires another server process. + Now Parse parms ";info=" and ";parm=" on "r/" command (;info= and ;parm= Must be entered in lower case) ++ Major revisions on message file interface. Telnet server now creates a son process to read output from user program. Son process IPCCONNECT's back to the Telnet server. This LOOP allows the telnet server to HPSELECT both input/output sockets at the same time, providing an efficient, event driven multiplex. + Old interface relied on XL FREAD intercept routines. New interface does not require ANY XL routines. >>------>> + IPC LOOP must be enabled for this server to work. Otherwise, running a program will hang 1 minute and terminate with a TIMEOUT error if LOOP not enabled. New output interface does not block output. However, because output is routed through a TCP/IP socket, any delays at the server reading output causes output to block automatically within the socket "window". AUTHOR..: Eric.J.Schubert.1@nd.edu (email) MPE.....: MPE 4.0+ and optionally NS3000 to create virtual sessions. Limited test on MPE 5.0, appears to function OK. Only IA,BA,PH CAPABILITY required. USERS: Demo users: "ANONYMOUS" no password, "ERIC" password "eric". DEFAULTS: PORT 23 20 users max, 120 second unattended login timeout. 300 second unattended terminal timeout. For other parameters, see "files defined" below. CAP....: Group: IA, BA, PH USAGE..: Free software. No Warranty. Not for resale. A good example of usage would be a public information system that has GOPHER links to this server running at an arbitrary port (port 3000 ?) or standard Telnet port 23. * Copyright 1994 University of Notre Dame. * If you improve this code or fix bugs, please contact the author * so that he can incorporate changes into the next release at: * * Email: Eric.J.Schubert.1@nd.edu * Phone: (219) 631-7306 * Address: 400c Main Bldg * Notre Dame, IN 46556 * FEATURES: -------- NQ - Stands for "Not Quite" TELNET. NQ-Telnet server is both a menu system and a Telnet program server interface. It does not logon to MPE directly. Code runs in standard USER mode. () If you are an educational site where clients use VT100 INTERNET clients, this server can translate HP->VT100 escape terminal codes automatically. We run the same programs on HP terminals and VT100 Network connections. Users don't realize the difference. (we use BiTECH report / SRN IRIS without wings requires NS3000 separate logons option) Does not do block mode. () Server will try to switch all incoming clients to "line mode". Most clients I tested worked ok, except our winsock trumptel client. If your client doesn't switch, use ^A to switch server back to echo character mode. () Users "login" via supervisor process into a menu system, not MPE. Users never acquire a real MPE logon. Passwords are optional for a given user id. You can alter the supervisor login to your own needs (if you have a 'c' compiler). Another option, you can bypass the message file interface and write your own NetIPC procedures and link them into server. Beware! You must have a full understanding of server I/O. () Users can only perform the functions defined on the menus. Many types of 'custom' Menus can be assigned by user login id. () You can set a LIMIT to the number of "logins" from 1 to 100. You may simply connect telnet clients to MPE processes instead of logons. If your programs are written with this in mind, you can provide many more "logins" than your MPE machine could traditionally provide "logons". () You can set UNATTENDED terminal TIMEOUTs to shutdown sessions. Since this parm is specified within each user menu, different users can have varying times. () Using NS3000 option, you can create Virtual sessions for incoming connections, giving a unique logon for each user. Otherwise, a process is simply created for the connection under one logon. However, this requires "loopback" to be enabled and it eats 3 sockets per connection... 2 for NS 1 for Telnet server. Client Telnet Negotiation Commands recognized by this server: ------------------------------------------------------------- Erase Line (IAC EL) Erase Character (IAC EC) Interrupt (IAC IP) Line mode (WONT ECHO, WONT SGA) Character Mode (WILL ECHO, WILL SGA) Are You There? (IAC AYT) Client Telnet control Commands recognized: ------------------------------------------ ^D (control D) abort current process. ^A (control A) force server into echo character mode. This server can run INTERATIVE programs and MOST MPE commands or MPE Command files. This server can run CI.PUB.SYS, giving the user MPE BATCH access. I have included this selection on the DEMO menu. Warning: CI.PUB.SYS only accepts 8 byte commands when the server runs as a batch job. I think I found a bug. HOWEVER, if the NS3000 virtual session option is used, it works OK. INSTALLATION: ** ** All files start with "NQT" except "VT100S" file. ** ** Demo is setup with user "anonymous" and "eric" ** You must supply HP logon info within these files: ** ** Edit file: NQTELCMD and make logon changes. ** Edit file: NQTJOB and make logon changes. ** ** Start server (default port 23, 20 users) ** ----------------------------------------- ** Enter: NQTELCMD ** ** Defaults: NQTELCMD 23 20 120 ** ** -or- ** stream job NQTJOB (after editing job card and parms). ******************************************************** GENERAL FUNCTIONS: ----------------- The HP telnet servers simply take some user id (8 character max) and log that user to the HP under some default HP logon that the user never know what it is (unless you give them a SHOWME or other MPE command). Users never learn HP passwords. TELNET SERVER PERFORMS HP -> VT100 TERMINAL TRANSLATIONS. You can use VT100 Telnet clients but run HP character based programs without any modifications (well, hopefully not!) ON NS/3000 OPTION ONLY: The system can assign menus based upon userid. This means that user "ERIC" for example, can get a different menu than user "ANONYMOUS". This system can provide anonymous logins to an HP site and be in complete control of what that user performs because of the menu system and control how many sessions can be on at any time. A good example of a public information system might have GOPHER links to this server running at an arbitrary port or a standard port 23. GOPHER CLIENT NOTES: ************************************************************************ If using GOPHER clients with links to ports other than 23, make sure the GOPHER clients are setup properly to "hand off" a port parm. This parm is usually specified as '%p' after the telnet client program name. My winsock gopher client has: "c:\winsock\trmptel.exe %i %p" Otherwise, a GOPHER telnet type assumes port 23. ************************************************************************ Also, if you are willing to forgo NS3000 sessions, the system can simply connect processes, which is extremely fast and efficient use of your HP3000 (everything runs under ONE job or session). However, remember the LOGON is SHARED between all processes, meaning that session globules must be watched carefully (temp files, variables, JCW's, etc.) FILES DEFINED: ------------- NQTELC: Command file to compile 'c' source. NQTECHO: Test program source that echos typed text. NQTECHOD: Test program that echos typed text. NQTJOB: Simple job stream that executes NQTELCMD. NQTMENU: Text file containing user menu selections. Must correspond to matching entries within file NQTPUBM that defines these options. NQTELCMD: MPE command file that executes the HP monitor prog NQTELJD. Parameters set within this file include: - Server port number (typically 23) - NS3000 node name (if used, to create virtual sessions) - Max limit on Telnet sessions (1 to 100) - NS3000 default logon parameters, - User identifiers for HP access - User Login timeout. NQTEL : Source code Main HP telnet server. NQTELD: NMPGM Main telnet server program. NQTELJ: Source code for HP monitor program that listens for incoming connections. NQTELINC: Common Source code for HP supervisor and telnet programs for network negotiations and network I/O. NQTELJD: NMPGM monitor program accepts incoming connections. NQTELS: Source code HP supervisor program executed by monitor program. The supervisor program prompts for user id/password, creates NS3000 sessions (if option), executes command file to run main telnet server program. NQTELSD: NMPGM supervisor program prompts for userid/password. NQTELF: MPE command file executed before any "r/" server command. The purpose of this command is external control over particular program file equates, build files, etc. NQTPUBM: Default command file for anonymous logins. This MPE command file used to define all menu options (using MPE variable names) and to run the main Telnet server program. In Addition, these parms are defined in this file: - User unattended session timeout value. - Debug mode on or off. Server commands are defined as: ------------------------------ Q - Uppercase Q quits server. f/xxxx.xxxx.xxx - Send MPE file to client. f/? - Ask user what file to send. c/xxxxxx - Execute any MPE command. c/? - Prompt for MPE command. r/xxxxxx;nc;xl='' - Run program. Program must open $stdlist and $stdi ;nc = No conversion HP->VT100. VT100S: OBJ needed to link the servers. Translates HP -> VT100. FLOW sketch: ----------- NQTELCMD starts the HP monitor server NQTELJD. Client connects to the listening port number (typically 23). When client connects: --------------------- - Monitor checks how many telnet sessions running. If within limits, monitor program creates a supervisor process to prompt 'Login:'. Otherwise, User is told "maximum sessions reached, try again later." Monitor gives socket to supervisor. Monitor listens for next connection. Supervisor program functions: ---------------------------- - Supervisor gets socket from monitor, prompts for USERID. - Client enters USERID. - Supervisor program "looks up" USERID as an MPE variable name defined within the startup command file. If found, supervisor starts Telnet program. Otherwise, user is dropped. - Supervisor gives socket away to Main Telnet program. - If NS3000 is used, then Supervisor starts a virtual session and executes a "one shot" logon command that starts the Telnet server. ------------------------------- DSLINE ENV=;OPEN REMOTE HELLO userid,;INFO="!?_CMDF " DSLINE ;CLOSE Note: external logon info defined within NQTELCMD command file. such that '?_CMDF' (?=user) defines a particular user. - Default: NQTPUBM is default for anonymous logins. - If NS3000 *not* used, Supervisor simply executes a command file under the monitor logon session. Watch those globules! ------------------------------ !?_CMDF Main Telnet command file and server program: ------------------------------------------- - NQTPUBM executed (above) as a one shot MPE LOGON command, so that the logon automatically terminates. NQTPUBM defines menu options used by main Telnet server program. Options include: - Menu file for this user (default: NQTMENU). - Menu item selections, what programs to run. - Telnet client time out in seconds (inactive session). NQTPUBM runs the main Telnet server program "NQTELD". - NQTELD gets socket from Supervisor and displays menu file (NQTMENU). - User selects menu item, does stuff.....