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