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*/
71int adspOptions(sp, pb)	/* (DSPPBPtr pb) */
72    CCBPtr		sp;
73    struct adspcmd *pb;
74{
75    if (sp == 0) {
76	pb->ioResult = errRefNum;
77	return EINVAL;
78    }
79
80    if (pb->u.optionParams.sendBlocking)
81	sp->sendBlocking = pb->u.optionParams.sendBlocking;
82
83    if (pb->u.optionParams.sendTimer)
84	sp->sendInterval = pb->u.optionParams.sendTimer;
85
86    /* No longer allowed to set retransmit timer as of ADSP 1.5 */
87    /* Use it to specify a command blocking request specific to MacOS
88     * emulation. */
89    if (pb->u.optionParams.rtmtTimer)
90    	sp->delay = pb->u.optionParams.rtmtTimer;
91    KERNEL_DEBUG(DBG_ADSP_MISC, 0, sp, sp->delay, pb, pb->u.optionParams.rtmtTimer);
92
93    if (pb->u.optionParams.badSeqMax)
94	sp->badSeqMax = pb->u.optionParams.badSeqMax;
95
96    sp->useCheckSum = pb->u.optionParams.useCheckSum;
97    if (pb->u.optionParams.newPID)
98    	sp->pid = pb->u.optionParams.newPID;
99    pb->ioResult = 0;
100    adspioc_ack(0, (gbuf_t *)pb->ioc, pb->gref);
101    return 0;
102
103}
104