4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
31 #pragma ident "%Z%%M% %I% %E% SMI"
38 static jmp_buf Xfailbuf
;
40 extern unsigned msgtime
;
53 static void (*xsig
)();
56 * turn on protocol timer
61 xsig
=signal(SIGALRM
, xalarm
);
68 (void) signal(SIGALRM
, xsig
);
73 * write message across x.25 link
74 * type -> message type
75 * str -> message body (ascii string)
76 * fn -> x.25 file descriptor
96 (void) (*Write
)(fn
, bufr
, strlen(bufr
) + 1);
101 * read message from x.25 link
102 * str -> message buffer
103 * fn -> x.25 file descriptor
105 * FAIL -> send timed out
106 * 0 -> ok message in str
117 (void) alarm(msgtime
);
119 if( (len
= (*Read
)(fn
, str
, XBUFSIZ
)) == 0)
126 if (*(str
- 1) == '\0')
134 * read data from file fp1 and write
136 * fp1 -> file descriptor
137 * fn -> x.25 descriptor
139 * FAIL ->failure in x.25 link
153 while ((len
= read( fd1
, bufr
, XBUFSIZ
)) > 0) {
156 ret
= (*Write
)(fn
, bufr
, len
);
163 ret
= (*Write
)(fn
, bufr
, 0);
168 * read data from x.25 link and
170 * fp2 -> file descriptor
171 * fn -> x.25 descriptor
174 * FAIL -> failure on x.25 link
189 len
= xrdblk(bufr
, XBUFSIZ
, fn
);
195 if( ret
== SUCCESS
&& write( fd2
, bufr
, len
) != len
)
204 * read blank from x.25 link
206 * blk -> address of buffer
207 * len -> size to read
208 * fn -> x.25 descriptor
210 * FAIL -> link error timeout on link
211 * i -> # of bytes read
222 (void) alarm(msgtime
);
223 for (i
= 0; i
< len
; i
+= ret
) {
224 if ((ret
= (*Read
)(fn
, blk
, len
- i
)) < 0) {
235 #endif /* X_PROTOCOL */