]> git.saurik.com Git - apple/xnu.git/blob - bsd/netat/adsp_CLDeny.c
xnu-344.34.tar.gz
[apple/xnu.git] / bsd / netat / adsp_CLDeny.c
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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.
11 *
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
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
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.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /*
23 * CLDeny.c
24 *
25 * From Mike Shoemaker 9/6/90
26 * Modified, April 9, 1997 by Tuyen Nguyen for MacOSX.
27 */
28
29 #include <sys/errno.h>
30 #include <sys/types.h>
31 #include <sys/param.h>
32 #include <machine/spl.h>
33 #include <sys/systm.h>
34 #include <sys/kernel.h>
35 #include <sys/proc.h>
36 #include <sys/filedesc.h>
37 #include <sys/fcntl.h>
38 #include <sys/mbuf.h>
39 #include <sys/socket.h>
40
41 #include <netat/sysglue.h>
42 #include <netat/appletalk.h>
43 #include <netat/ddp.h>
44 #include <netat/at_pcb.h>
45 #include <netat/debug.h>
46 #include <netat/adsp.h>
47 #include <netat/adsp_internal.h>
48
49 /*
50 * dspCLDeny
51 *
52 * INPUTS:
53 * --> ccbRefNum refnum of connection listener
54 * --> remoteCID connection identifier of remote connection end
55 * --> remoteAddress internet address of remote connection end
56 *
57 * OUTPUTS:
58 * none
59 *
60 * ERRORS:
61 * errRefNum bad connection refnum
62 * errState not a connection listener
63 * errAborted request aborted by a Remove call
64 */
65 int adspCLDeny(sp, pb) /* (DSPPBPtr pb) */
66 struct adspcmd *pb;
67 CCBPtr sp;
68 {
69 gbuf_t *mp;
70 ADSP_FRAMEPtr adspp;
71 ADSP_OPEN_DATAPtr adspop;
72
73 if (sp == 0) {
74 pb->ioResult = errRefNum;
75 return EINVAL;
76 }
77 mp = gbuf_alloc(AT_WR_OFFSET + DDPL_FRAME_LEN + ADSP_FRAME_LEN + ADSP_OPEN_FRAME_LEN,
78 PRI_LO);
79 gbuf_rinc(mp,AT_WR_OFFSET);
80 gbuf_wset(mp,DDPL_FRAME_LEN);
81 adspp = (ADSP_FRAMEPtr)gbuf_wptr(mp);
82 gbuf_winc(mp,ADSP_FRAME_LEN);
83 bzero((caddr_t) gbuf_rptr(mp),DDPL_FRAME_LEN + ADSP_FRAME_LEN + ADSP_OPEN_FRAME_LEN);
84 adspp->descriptor = ADSP_CONTROL_BIT | ADSP_CTL_ODENY;
85 adspop = (ADSP_OPEN_DATAPtr)gbuf_wptr(mp);
86 gbuf_winc(mp,ADSP_OPEN_FRAME_LEN);
87 UAS_ASSIGN(adspop->dstCID, pb->u.openParams.remoteCID);
88 UAS_ASSIGN(adspop->version, 0x100);
89 adsp_sendddp(sp, mp,
90 DDPL_FRAME_LEN + ADSP_FRAME_LEN + ADSP_OPEN_FRAME_LEN,
91 &pb->u.openParams.remoteAddress, DDP_ADSP);
92 adspioc_ack(0, pb->ioc, pb->gref);
93 return 0;
94 }