pap(3N) pap(3N)NAME pap_open, pap_read, pap_read_ignore, pap_status, pap_write, pap_close - provide AppleTalk Printer Access Protocol (PAP) interface SYNOPSIS #include <at/appletalk.h> #include <at/pap.h> #include <at/nbp.h> int pap_open(tuple) at_nbptuple_t *tuple; int pap_read(fildes, data, len) int fildes, len; char *data; int pap_read_ignore(fildes) int fildes; char *pap_status(tuple) at_nbptuple_t *tuple; int pap_write(fildes, data, len, eof, flush) int fildes, len; int eof, flush; char *data; int pap_close(fildes) int fildes; DESCRIPTION The PAP interface provides applications with access to the AppleTalk Printer Access Protocol operations. The following routines once intended for a PAP server are no longer supported. paps_open paps_get_next_job paps_register paps_status paps_close The routines for the PAP client are: pap_open pap_read pap_read_ignore pap_status pap_write pap_close March 1993 1
pap(3N) pap(3N)The pap_open routine opens a connection to a PAP server, making it accessible through the returned file descriptor. 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 specified by the file descriptor (fildes) parameter. The file descriptor must be one that was obtained previously using pap_open. The parameters are fildes 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 returned. 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 LaserWriters to function when they want to return status messages. The parameter is fildes A PAP client file descriptor returned by an earlier 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 containing the PAP server's status is returned. If the printer's status cannot be recovered, NULL is returned. 2 March 1993
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 fildes 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 whether 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 waiting PAP writes is to be sent to the remote end. Because 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 fildes The file descriptor to be closed. It returns 0 upon successful completion. If the file descriptor is no longer open, it returns -1. STATUS MESSAGES AND VALUES All routines except pap_status return -1 on error with a detailed error code in errno: EINVAL An invalid argument was passed. ENETDOWN The network interface is down. ESHUTDOWN March 1993 3
pap(3N) pap(3N)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 underlying NBP, ATP, and DDP modules. FILES /usr/lib/libat.a Archive of object files for these and related routines SEE ALSO atp(3N), ddp(3N), nbp(3N), rtmp(3N) Inside AppleTalk 4 March 1993