// // LPD.pmod: an implementation of the BSD lpd protocol (RFC 1179). // This is a module for pike. // 3 July 1998 Bill Welliver // // $Id: LPD.pmod,v 1.10 2008/01/13 17:02:43 nilsson Exp $ // //! A client for communicating with printers and print spoolers that //! support the BSD lpd protocol (RFC 1179). // try to open one of the "official" local socket ports. // not having one doesn't seem to be a problem with most LPD // servers, but we should at least try. will probably fail // if two try to open the same local port at once. ymmv. //! @decl int set_job_type(string type) //! Set the type of job to be sent to the printer to @i{type@}. //! Valid types are: text, postscript and raw. //! @decl int set_job_name(string name) //! Sets the name of the print job to @i{name@}. //! @decl int start_queue(string queue) //! Start the queue @i{queue@} if not already printing. //! @returns //! Returns 0 if unable to connect, 1 otherwise. //! @decl string|int send_job(string queue, string job) //! Send print job consisting of data @i{job@} to printer @i{queue@}. //! @returns //! Returns 1 if success, 0 otherwise. // werror("connected to " + host + "\n"); // read the response. // resp=conn->read(); // start_queue(queue); //! @decl int delete_job(string queue, int|void job) //! Delete job @i{job@} from printer @i{queue@}. //! @returns //! Returns 1 on success, 0 otherwise. //! @decl string|int status(string queue) //! Check the status of queue @i{queue@}. //! @returns //! Returns 0 on failure, otherwise returns the status response from the printer. //! Create a new LPD client connection. //! @param hostname //! Contains the hostname or ipaddress of the print host. //! if not provided, defaults to @i{localhost@}. //! @param portnum //! Contains the port the print host is listening on. //! if not provided, defaults to port @i{515@}, the RFC 1179 standard.