]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
43866e37 | 6 | * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. |
1c79356b | 7 | * |
43866e37 A |
8 | * This file contains Original Code and/or Modifications of Original Code |
9 | * as defined in and that are subject to the Apple Public Source License | |
10 | * Version 2.0 (the 'License'). You may not use this file except in | |
11 | * compliance with the License. Please obtain a copy of the License at | |
12 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
13 | * file. | |
14 | * | |
15 | * The Original Code and all software distributed under the License are | |
16 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
1c79356b A |
17 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
18 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
43866e37 A |
19 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
20 | * Please see the License for the specific language governing rights and | |
21 | * limitations under the License. | |
1c79356b A |
22 | * |
23 | * @APPLE_LICENSE_HEADER_END@ | |
24 | */ | |
25 | /* | |
26 | * | |
27 | * ORIGINS: 82 | |
28 | * | |
29 | * (C) COPYRIGHT Apple Computer, Inc. 1992-1996 | |
30 | * All Rights Reserved | |
31 | * | |
32 | */ | |
33 | ||
34 | /* Definitions for ATP protocol and streams module, per | |
35 | * AppleTalk Transaction Protocol documentation from | |
36 | * `Inside AppleTalk', July 14, 1986. | |
37 | */ | |
38 | ||
39 | #ifndef _NETAT_PAP_H_ | |
40 | #define _NETAT_PAP_H_ | |
9bccf70c | 41 | #include <sys/appleapiopts.h> |
1c79356b A |
42 | |
43 | #define AT_PAP_DATA_SIZE 512 /* Maximum PAP data size */ | |
44 | #define AT_PAP_STATUS_SIZE 255 /* Maximum PAP status length */ | |
45 | #define PAP_TIMEOUT 120 | |
46 | ||
47 | /* PAP packet types */ | |
48 | ||
49 | #define AT_PAP_TYPE_OPEN_CONN 0x01 /* Open-Connection packet */ | |
50 | #define AT_PAP_TYPE_OPEN_CONN_REPLY 0x02 /* Open-Connection-Reply packet */ | |
51 | #define AT_PAP_TYPE_SEND_DATA 0x03 /* Send-Data packet */ | |
52 | #define AT_PAP_TYPE_DATA 0x04 /* Data packet */ | |
53 | #define AT_PAP_TYPE_TICKLE 0x05 /* Tickle packet */ | |
54 | #define AT_PAP_TYPE_CLOSE_CONN 0x06 /* Close-Connection packet */ | |
55 | #define AT_PAP_TYPE_CLOSE_CONN_REPLY 0x07 /* Close-Connection-Reply pkt */ | |
56 | #define AT_PAP_TYPE_SEND_STATUS 0x08 /* Send-Status packet */ | |
57 | #define AT_PAP_TYPE_SEND_STS_REPLY 0x09 /* Send-Status-Reply packet */ | |
58 | #define AT_PAP_TYPE_READ_LW 0x0A /* Read LaserWriter Message */ | |
59 | ||
60 | ||
61 | /* PAP packet structure */ | |
62 | ||
63 | typedef struct { | |
64 | u_char at_pap_connection_id; | |
65 | u_char at_pap_type; | |
66 | u_char at_pap_sequence_number[2]; | |
67 | u_char at_pap_responding_socket; | |
68 | u_char at_pap_flow_quantum; | |
69 | u_char at_pap_wait_time_or_result[2]; | |
70 | u_char at_pap_buffer[AT_PAP_DATA_SIZE]; | |
71 | } at_pap; | |
72 | ||
73 | ||
74 | /* ioctl definitions */ | |
75 | ||
76 | #define AT_PAP_SETHDR (('~'<<8)|0) | |
77 | #define AT_PAP_READ (('~'<<8)|1) | |
78 | #define AT_PAP_WRITE (('~'<<8)|2) | |
79 | #define AT_PAP_WRITE_EOF (('~'<<8)|3) | |
80 | #define AT_PAP_WRITE_FLUSH (('~'<<8)|4) | |
81 | #define AT_PAP_READ_IGNORE (('~'<<8)|5) | |
82 | #define AT_PAPD_SET_STATUS (('~'<<8)|40) | |
83 | #define AT_PAPD_GET_NEXT_JOB (('~'<<8)|41) | |
84 | ||
85 | extern char at_pap_status[]; | |
86 | extern char *pap_status (); | |
87 | ||
88 | #define NPAPSERVERS 10 /* the number of active PAP servers/node */ | |
89 | #define NPAPSESSIONS 40 /* the number of active PAP sockets/node */ | |
90 | ||
91 | #define AT_PAP_HDR_SIZE (DDP_X_HDR_SIZE + ATP_HDR_SIZE) | |
92 | ||
93 | #define ATP_DDP_HDR(c) ((at_ddp_t *)(c)) | |
94 | ||
95 | #define PAP_SOCKERR "Unable to open PAP socket" | |
96 | #define P_NOEXIST "Printer not found" | |
97 | #define P_UNREACH "Unable to establish PAP session" | |
98 | ||
99 | struct pap_state { | |
100 | u_char pap_inuse; /* true if this one is allocated */ | |
101 | u_char pap_tickle; /* true if we are tickling the other end */ | |
102 | u_char pap_request; /* bitmap from a received request */ | |
103 | u_char pap_eof; /* true if we have received an EOF */ | |
104 | u_char pap_eof_sent; /* true if we have sent an EOF */ | |
105 | u_char pap_sent; /* true if we have sent anything (and | |
106 | therefore may have to send an eof | |
107 | on close) */ | |
108 | u_char pap_error; /* error message from read request */ | |
109 | u_char pap_timer; /* a timeout is pending */ | |
110 | u_char pap_closing; /* the link is closing and/or closed */ | |
111 | u_char pap_request_count; /* number of outstanding requests */ | |
112 | u_char pap_req_timer; /* the request timer is running */ | |
113 | u_char pap_ending; /* we are waiting for atp to flush */ | |
114 | u_char pap_read_ignore; /* we are in 'read with ignore' mode */ | |
115 | ||
116 | u_char pap_req_socket; | |
117 | at_inet_t pap_to; | |
118 | int pap_flow; | |
119 | ||
120 | u_short pap_send_count; /* the sequence number to send on the | |
121 | next send data request */ | |
122 | u_short pap_rcv_count; /* the sequence number expected to | |
123 | receive on the next request */ | |
124 | u_short pap_tid; /* ATP transaction ID for responses */ | |
125 | u_char pap_connID; /* our connection ID */ | |
126 | ||
127 | int pap_ignore_id; /* the transaction ID for read ignore */ | |
128 | int pap_tickle_id; /* the transaction ID for tickles */ | |
129 | }; | |
130 | ||
131 | #endif /* _NETAT_PAP_H_ */ |