Windows Sockets LPD Server Application 1.1 December 1995 -PrintSRV and enqueuing programs (Raw, Txtfilt and to_lpt1)- Copyright (C) 1995-1996 by Agustin Lopez Bueno & Centro de Informatica - Universitat de Valencia. All rights reserved. (PLEASE REVIEW THE ENTIRE CONTENTS OF THIS FILE!!!!) THE INFORMATION AND CODE PROVIDED IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL WE BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF WE HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. ********************************************************************** * This program executable, help file and related text files may be * * used without fee by individuals for non-commercial home use, and * * by students, faculty and staff of academic institutions, with the * * only condition of advise with mail to Agustin.Lopez@uv.es of his * * use. * * * * Non-commercial home use: Free, but please if you like PrintSRV * * send an e-mail to Agustin.Lopez@uv.es * * Academic use: Free * * All other uses: Contact Centro de Informatica - Universitat de * * Valencia. * * * * Archive sites: This program may be included on Government, * * academic and non-commercial Internet archive sites and on CD-ROM * * collections distributed by such sites, provided any charge is * * solely to recover the cost of distribution. Any such * * distribution must contain the complete program, including this * * file. Non-commercial Internet archive sites must not be in the * * business of making a profit from selling hardware, software, * * information or services. (SimTel and mirrors authorized) * * * * For distribution rights and for all other uses, including * * all corporate use, please contact Centro de Informática - * * Universitat de Valencia at or * * the author at for license information. * * Both can also be contacted via mail at Centro de Informatica, * * Universitat de Valencia, Dr. Moliner 50, 46100-Burjasot, Valencia * * SPAIN. * * ********************************************************************** DESCRIPTION: ============ PrintSRV is a standard line printer daemon protocol (LPD) SERVER application for Windows Sockets. It listen at the TCP port 515 (configurable) for incoming print request that follows the lpd protocol (RFC 1179), and sent them to the specified queue. The enqueuing is done by calling a user-selectable (by queue) program, that receives as arguments the file to print and some configurable options (for example, a Windows queue name). Three simple programs are provided (raw, txtfilt and to_lpt1) that enqueue the file to the specified windows queue or sent it directly to a specific printer port. Also, an example queue definition is provided that uses the windows notepad as "enqueuing" program: that displays the file on the screen. The provided enqueing programs can enqueue to ANY windows printer queue, including queues that print to local files and network printers. They doesn't work in windows NT (blame the API function SpoolFile() and the direct use of LPT ports). The three provided enqueueing programs (filters) are: raw: Only do a spoolfile on the printer, bypassing the printer driver. No processing of any type is done on the received file before sending it to the printer. txtfilt: Same as above, but convert Line Feeds to Carriage Return + Line Feed (for UNIX to MSDOS files) and the tabs to spaces, as specified by the txtfilt.ini options: spacesbytab=5 #number of spaces by tab, 0 if no convertion. convertlf=1 #1 to convert, 0 if no convertion. to_lpt1: This is a simple bat file that directly copies the file to the port (LPT1 in the example). Security is enforced at host level: only hosts listed in the host.lpd file are allowed to connect. If the file doesn't exists, all hosts are allowed. The present version doesn't support the protocol "remove jobs" command. The "short lpq" command for a queue always returns "No entries". The "long lpq" returns some queue properties followed by "No entries". The control file (printing) options are stored (optionally) in a ".cnt" file that the enqueuing program can examine to do the appropiate actions. Optionally, a header can be added to teh printed file. Obviously, the header is built from the information stored in the control file. This program is known to work with: . Windows3.11 with Microsoft TCP/IP. . Windows3.1 & Windows3.11 with P.Tattam WinSock. . Windows95. . Windows NT, excepted enqueuing programs. REQUIREMENTS: ============= PrintSRV requires you to have a properly installed WINSOCK.DLL and requires Windows 3.1 or later. If you don't have a WINSOCK.DLL, I'd suggest getting the free one from Microsoft or the shareware Trumpet Winsock from ftp.trumpet.com.au or buying a vendor supported one (for example from FTP Software, Inc). Windows NT and Windows 95 come with a WINSOCK.DLL. If you use a different vendors stack on these platforms you will need to replace the WSOCK32.DLL that comes with the OS. Enqueuing programs doesn't work in windows NT, because the API function SpoolFile() doesn't work. Please contact us, if anybody knows how to made this to work in NT. PAKING LIST =========== Files included in this package are: printsrv.txt This file. printsrv.exe The LPD daemon. printsrv.ini The definitions/preferences file for the LPD daemon. host.lpd A SAMPLE security file banner.txt A text file necesary to make the banners. raw.exe The "basic" enqueuing program. raw.ini The definitions/preferences file for raw.exe. txtfilt.exe Convert Line Feeds to Carriage Return + Line Feed and the tabs by spaces, and then do a spoolfile. txtfilt.ini The definitions/preferences file for txtfilt.exe. to_lpt1.bat Copy the file directly to the port (LPT1 in this case). 1179.rfc RFC1179. printcln.exe The LPR lient (beta version, warning) printcln.ini The definitions/preferences file for the LPR client. INSTALLATION: ============= YOU MUST HAVE A PROPERLY INSTALLED WINSOCK.DLL FOR THIS APPLICATION TO WORK. REFER TO YOUR WINSOCK.DLL DOCUMENTATION FOR SETUP!! 1. Create a directory for this program and expand and copy there all the files of the package. 2. Create or edit the "hosts.lpd" file. This file is a list, one per line, of hosts (domain names of them) allowed to use your printers through PrintSRV. Use any ASCII text editor, such notepad. 3. Create an ICON in any Program Manager group. a. Use the File Manager and drag the program into a Program Manager group. b. Use [F]ile [N]ew in the Program Manager. 4. Launch the program by clicking two times in the ICON. It must show a window with your computer (TCP/IP) name, and your Winsock version. 5. Push the "Setup" button. Choose the spool directory where received, control, log and tmp files will be stored. Select "Use log file" if you want a log of all PrintSRV activities be recorded in the file "printsrv.log". Don't change the port number if you are not really sure you need to do that. Checking "Delete old files at startup" cleans the spool directory at each startup. 6. Create the needed queues (maximum allowed 10), by choosing the desired queue in "Queue" and filling the fields of the queue definition: . Queue name. Arbitrary. Better if less than 10 characters long. . Enqueueing program. Clicking Launch pops-up a file-selection window. . Driver & Port (corresponding to a windows printer queue). Clicking down pops-up a driver/port selection menu. . Options for the enqueuing program. . Check the "Write control file" only if your enqueuing program(s) uses (and deletes) them. . Minimize launcher. . Print banner. . Form feed at the end. (see options description below) 7. Click the OK button & iconize (if desired) the PrintSRV window. You are ready to receive remote printing jobs. Click the SAVE button to store definitions permanently. 8. If you want PrintSRV to start every time you launch windows, put the icon (or a copy of it) in the "Init" group of the program manager. In this case, you probably will also want to select the "start iconized" option of the Icon definition menu. CONFIGURABLE OPTIONS: ===================== 1) General (for all queues): -Spool dir: Directory where received, control, log and tmp files will be stored. -Port: Port number where the clients must connect. Don't change this if you are not really sure you need to do that. -Log file: When checked, PrintSRV activities will be recorded in the file "printsrv.log". -Delete old files at startup: Dat, cnt and tmp files in the spool directory will be deleted at each startup. 2) Queue specific: -Name: Name of the queue. -Launch: Program that will be run when a file is received. Usually this is the enqueuing program. Provided ones are: raw, txtfilt or to_lpt1. The enqueueing program can be any program that understands the passed arguments (Example: Notepad). -Driver/Port: Specifies which window queue is used to print. NONE if no windows printer is used. -Options: Optional for some enqueuing programs. Raw, txtfilt and to_lpt1 don't requier any options. -Write control file: The control file will not be deleted after the file is received. -Minimize launcher: The enqueuing program will be minimized at launch. -Print banner: Add a banner page at the beginning of the received file. -FF at the end: PrintSRV will add one Form Feed at the end of the received file. 3) Other options (printsrv.ini file, [server] section): debug= 0: no debug information. debug= 1: Brief debug information. debug= 2: Long debug information. This option could waste many disk space. Warning! blockedsetup: This is useful if you want to avoid "accidental" modification of the PrintSRV configuration. OTHER TIPS ========== The "restart" button of printsrv aborts all connections and reinitializes the server. The "Close" button aborts all connections and terminates the server. When a "short queue status" (lpq) request is received for the queue "all", a list of all configured queues is returned. If the request is a "long queue status" the long definition of each queue is also returned. For network installation, put the "printsrv.ini" file where the program can found it, and where the file will be writable. Suggestions are: the windows directory, the windows/system directory, the working directory. Obviously, also the temp directory must be writable and in the local disk. The setup can be locked if the "blockedsetup" option in the "printsrv.ini" file is set to "1". This is useful if you want to avoid "accidental" modification of the PrintSRV configuration. Raw and Txtfilt also print a log of their activities, in the file specified in the Raw.ini or Txtfilt.ini file. If no file is specified, they use a default file name and try to write it to C:\TMP. If you use a (non provided) enqueuing program that needs the control files, you will need to check the "Write Configuration files" from the setup menu. The enqueuing program will be responsible of erasing these files after use. If you like this program, let other people know about it! Post your comments in comp.protocol.tcp-ip.ibmpc, alt.winsock and in the windows groups on usenet and places like compuserve. Let people know about it! The return codes for the enqueueing programs could be (winexec errors): 0 System was out of memory, executable file was corrupt, or relocations were invalid. 2 File was not found. 3 Path was not found. 5 Attempt was made to dynamically link to a task, or there was a sharing or network-protection error. 6 Library required separate data segments for each task. 8 There was insufficient memory to start the application. 10 Windows version was incorrect. 11 Executable file was invalid. Either it was not a Windows application or there was an error in the .EXE image. 12 Application was designed for a different operating system. 13 Application was designed for MS-DOS 4.0. 14 Type of executable file was unknown. 15 Attempt was made to load a real-mode application (developed for an earlier version of Windows). 16 Attempt was made to load a second instance of an executable file containing multiple data segments that were not marked read-only. 19 Attempt was made to load a compressed executable file. The file must be decompressed before it can be loaded. 20 Dynamic-link library (DLL) file was invalid. One of the DLLs required to run this application was corrupt. 21 Application requires 32-bit extensions. CODES GREATER --> All Ok! VALID COMMAND LINE OPTIONS & ARGUMENTS: ======================================= Printsrv: None. Raw : Txtfilt : to_lpt1: Any enqueuing program: {driver} {port} {options} Note that "{ }" arguments are optional arguments. The meaning of them only depends of the specific enqueuing program used. WHERE TO GET IT =============== ftp://ftp.uv.es/pub/windows/network/prsrv11.zip SUPPORT ======= ALL beginner support is provided through e-mail to and to . ALL bug reports and suggestions for improvement should be sent to . ALL distribution, commercial purchase requests need to be sent to KNOWN PROBLEMS ============== Enqueuing programs doesn't work in windows NT, because the API function SpoolFile() doesn't work. Please contact us if anybody knows how to made this to work in NT. Author ====== Agustin Lopez Bueno Internet: Centro de Informatica Universitat de Valencia Dr. Moliner 50, 46100-Burjasot, Valencia, SPAIN. with the advise of Hector Rulot Internet: Centro de Informatica Universitat de Valencia Dr. Moliner 50, 46100-Burjasot, Valencia, SPAIN. ***************************************************************** ***************************************************************** ***************************************************************** ***************************************************************** ***************************************************************** ***************************************************************** Windows Sockets LPR Client Application 1.0 (BETA 0) December 1995 -PrintCLN- Copyright (C) 1995-1996 by Agustin Lopez Bueno & Centro de Informatica - Universitat de Valencia. All rights reserved. (PLEASE REVIEW THE ENTIRE CONTENTS OF THIS FILE!!!!) THE INFORMATION AND CODE PROVIDED IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL WE BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF WE HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. ********************************************************************** * This program executable, help file and related text files may be * * used without fee by individuals for non-commercial home use, and * * by students, faculty and staff of academic institutions, with the * * only condition of advise with mail to Agustin.Lopez@uv.es of his * * use. * * * * Non-commercial home use: Free, but please if you like PrintCLN * * send an e-mail to Agustin.Lopez@uv.es * * Academic use: Free * * All other uses: Contact Centro de Informatica - Universitat de * * Valencia. * * * * Archive sites: This program may be included on Government, * * academic and non-commercial Internet archive sites and on CD-ROM * * collections distributed by such sites, provided any charge is * * solely to recover the cost of distribution. Any such * * distribution must contain the complete program, including this * * file. Non-commercial Internet archive sites must not be in the * * business of making a profit from selling hardware, software, * * information or services. (SimTel and mirrors authorized) * * * * For distribution rights and for all other uses, including * * all corporate use, please contact Centro de Informática - * * Universitat de Valencia at or * * the author at for license information. * * Both can also be contacted via mail at Centro de Informatica, * * Universitat de Valencia, Dr. Moliner 50, 46100-Burjasot, Valencia * * SPAIN. * * ********************************************************************** DESCRIPTION: ============ PrintCLN is a standard LPR client that incorporates all the rfc1179 commands. It was designed basically for protocol testing, but can be used as well as print utility. Note that no automatic print function is supported. PrintCLN can send any file, using the LPR protocol. The origin port is one of the reserved (privileged) ones (721-731); the destination port is selectable. Supported commands are: Print File, Delete Job, Short LPQ, Long LPQ and Start Queue. All LPR options (banners, filters, ...) are configurable. WARNING: PrintCLN is a beta version. You probably will found bugs in the program. Please, email me commenting your problems. REQUIREMENTS: ============= PrintCLN requires you to have a properly installed WINSOCK.DLL and requires Windows 3.1 or later. If you don't have a WINSOCK.DLL, I'd suggest getting the free one from Microsoft or the shareware Trumpet Winsock from ftp.trumpet.com.au or buying a vendor supported one (for example from FTP Software, Inc). Windows NT and Windows 95 come with a WINSOCK.DLL. If you use a different vendors stack on these platforms you will need to replace the WSOCK32.DLL that comes with the OS. INSTALLATION: ============= Only the program file and the .ini file is required. The creation of an icon in any Program Manager roup is recommened. VALID COMMAND LINE OPTIONS & ARGUMENTS: ======================================= NONE Author ====== Agustin Lopez Bueno Internet: Centro de Informatica Universitat de Valencia Dr. Moliner 50, 46100-Burjasot, Valencia, SPAIN.