Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ paps_get_next_(3N) — A/UX 2.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

atp(3N)

ddp(3N)

nbp(3N)

rtmp(3N)




pap(3N) pap(3N)
NAME paps_open, paps_get_next_job, paps_status, paps_close, pap_open, pap_read, pap_read_ignore, pap_status, pap_write, pap_close - AppleTalk Printer Access Protocol (PAP) interface SYNOPSIS #include <at/appletalk.h> #include <at/pap.h> #include <at/nbp.h> cc [flags] files -lat [libraries] int paps_open() int paps_get_next_job(fd) int fd; int paps_status(fd, status) int fd; char *status; int paps_close(fd) int fd; int pap_open(tuple) at_nbptuple_t *tuple; int pap_read(fd, data, len) int fd, len; char *data; int pap_read_ignore(fd) int fd; char *pap_status(tuple) at_nbptuple_t *tuple; int pap_write(fd, data, len, eof, flush) int fd, len; int eof, flush; char *data; int pap_close(fd) int fd; DESCRIPTION The PAP interface provides applications with access to the AppleTalk Printer Access Protocol operations. The interface routines can be divided into two sets: One set provides ser- vices for a PAP client, the other for a PAP server. The rou- tines for the PAP server are April, 1990 1



pap(3N) pap(3N)
paps_open pap_read paps_get_next_job paps_status paps_close The routines for the PAP client are: pap_open pap_read pap_read_ignore pap_status pap_write pap_close The paps_open routine opens a PAP server AppleTalk file descriptor for a PAP server. The caller may then use nbp_register (see nbp(3N)) to register a network-visible en- tity (NVE) on the socket and paps_status to post a status string on it. The paps_open routine returns an AppleTalk file descriptor on success, -1 on failure. The paps_get_next_job routine is called by a server when it is ready to respond to a new PAP client. It returns a PAP server AppleTalk file descriptor that is set up for PAP reading from the client that has been waiting the longest. The parameter is fd A PAP server AppleTalk file descriptor from a pre- vious paps_open. Upon successful completion a PAP server AppleTalk file descriptor is returned. The paps_status routine changes the status string associated with an open PAP server AppleTalk file descriptor. This is the string returned to a PAP client from a pap_status call. The parameters are fd An open PAP server AppleTalk file descriptor re- turned from a paps_open call. status A pointer to a null-terminated character string containing the status string being posted. Strings longer than 255 characters are truncated. Upon successful completion a value of 0 is returned. 2 April, 1990



pap(3N) pap(3N)
The paps_close routine closes an open PAP server file descriptor. The parameter is fd The file descriptor to be closed. It returns 0 upon successful completion. The pap_open routine opens a PAP client file descriptor to a server. It attempts to connect to the server whose name and address are contained in the tuple parameter. The command nbp_lookup (see nbp(3N)) may be used to obtain a valid name and address for the desired PAP server. Upon successful completion, this routine returns a PAP client file descriptor connected to the server requested. The pap_read routine reads data from a server PAP file descriptor opened by a paps_open, followed by a paps_get_next_job call. The parameters are fd A PAP server file descriptor. data A pointer to the buffer containing the data to be returned. The maximum data length specified by the length parameter is 512 bytes. length The maximum length to be read. Upon successful completion, the number of bytes read is re- turned. A value of 0 is returned when an end-of-file is reached. The pap_read_ignore routine issues a PAP read request and ignores any returned data. This is used to allow LaserWrit- ers to function when they want to return status messages. The parameter is fd A PAP client file descriptor returned by an ear- lier pap_open. The pap_status routine locates a PAP server and returns a pointer to its status string. The parameter is tuple A pointer to a tuple structure containing the name and address of a PAP server entity. The routine nbp_lookup (See nbp(3N)) may be used to get a valid tuple. Upon successful completion, a pointer to the string contain- ing the PAP server's status is returned. If the printer's status cannot be recovered, NULL is returned. April, 1990 3



pap(3N) pap(3N)
The pap_write routine sends the data passed to it to the other end of a PAP server session. The parameters are fd A PAP client AppleTalk file descriptor. data A pointer to the data being written. len The length of the data being written; this must not exceed 512 bytes. eof A Boolean flag indicating whethere EOF indication is to be sent to the other end of the PAP session (after the data has been sent) to indicate that no more data will be sent. Setting eof to true also implies flush. flush A Boolean flag indicating whether data for all wait- ing PAP writes is to be sent to the remote end. Be- cause PAP runs on top of ATP, PAP writes are queued until either a complete ATP response is available (about 4 KB) or an end-of-message is sent. This call sends an ATP end-of-message, which causes all waiting PAP writes to be sent to the other end. This should be done if a higher level protocol (for example, a handshake with a LaserWriter) needs to do a write followed by a read. Upon successful completion, a value of 0 is returned. The pap_close routine closes an open PAP client file descriptor. The parameter is fd The file descriptor to be closed. It returns 0 upon successful completion. If the file descriptor is no longer open, it returns -1. ERRORS All routines except pap_status return -1 on error with a de- tailed error code in errno: [EINVAL] An invalid argument was passed. [ENETDOWN] The network interface is down. [ESHUTDOWN] The PAP file descriptor has already been closed. [ETIMEDOUT] The connection is timed out. See open(2), close(2), ioctl(2), read(2), and write(2) for additional error codes; see also errors returned by the 4 April, 1990



pap(3N) pap(3N)
underlying NBP, ATP, and DDP modules. SEE ALSO atp(3N), ddp(3N), nbp(3N), rtmp(3N), Inside AppleTalk. April, 1990 5

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026