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