]> git.saurik.com Git - apple/xnu.git/blob - bsd/netat/adsp_Options.c
xnu-792.17.14.tar.gz
[apple/xnu.git] / bsd / netat / adsp_Options.c
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
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
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28 /*
29 * dspOptions.c
30 *
31 * From v01.06 04/19/90 mbs
32 * Modified, April 9, 1997 by Tuyen Nguyen for MacOSX.
33 */
34
35 #include <sys/errno.h>
36 #include <sys/types.h>
37 #include <sys/param.h>
38 #include <machine/spl.h>
39 #include <sys/systm.h>
40 #include <sys/kernel.h>
41 #include <sys/proc.h>
42 #include <sys/filedesc.h>
43 #include <sys/fcntl.h>
44 #include <sys/mbuf.h>
45 #include <sys/socket.h>
46
47 #include <netat/sysglue.h>
48 #include <netat/appletalk.h>
49 #include <netat/at_pcb.h>
50 #include <netat/debug.h>
51 #include <netat/adsp.h>
52 #include <netat/adsp_internal.h>
53
54 /*
55 * dspOptions
56 *
57 * INPUTS:
58 * --> ccbRefNum refnum of connection end
59 * --> sendBlocking send blocking threshold
60 * --> sendTimer send timer interval
61 * --> rtmtTimer retransmit timer interval
62 * --> badSeqMax retransmit advice send threshold
63 * --> useCheckSum generate DDP checksum on internet packets
64 *
65 * OUTPUTS:
66 * none
67 *
68 * ERRORS:
69 * errRefNum bad connection refnum
70 */
71 int adspOptions(sp, pb) /* (DSPPBPtr pb) */
72 CCBPtr sp;
73 struct adspcmd *pb;
74 {
75 short err;
76
77 if (sp == 0) {
78 pb->ioResult = errRefNum;
79 return EINVAL;
80 }
81
82 if (pb->u.optionParams.sendBlocking)
83 sp->sendBlocking = pb->u.optionParams.sendBlocking;
84
85 if (pb->u.optionParams.sendTimer)
86 sp->sendInterval = pb->u.optionParams.sendTimer;
87
88 /* No longer allowed to set retransmit timer as of ADSP 1.5 */
89 /* Use it to specify a command blocking request specific to MacOS
90 * emulation. */
91 if (pb->u.optionParams.rtmtTimer)
92 sp->delay = pb->u.optionParams.rtmtTimer;
93 KERNEL_DEBUG(DBG_ADSP_MISC, 0, sp, sp->delay, pb, pb->u.optionParams.rtmtTimer);
94
95 if (pb->u.optionParams.badSeqMax)
96 sp->badSeqMax = pb->u.optionParams.badSeqMax;
97
98 sp->useCheckSum = pb->u.optionParams.useCheckSum;
99 if (pb->u.optionParams.newPID)
100 sp->pid = pb->u.optionParams.newPID;
101 pb->ioResult = 0;
102 adspioc_ack(0, pb->ioc, pb->gref);
103 return 0;
104
105 }