]> git.saurik.com Git - apple/xnu.git/blob - bsd/netat/adsp_CLDeny.c
xnu-792.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(struct adspcmd *pb, CCBPtr sp)
66 {
67 gbuf_t *mp;
68 ADSP_FRAMEPtr adspp;
69 ADSP_OPEN_DATAPtr adspop;
70
71 if (sp == 0) {
72 pb->ioResult = errRefNum;
73 return EINVAL;
74 }
75 mp = gbuf_alloc(AT_WR_OFFSET + DDPL_FRAME_LEN + ADSP_FRAME_LEN + ADSP_OPEN_FRAME_LEN,
76 PRI_LO);
77 gbuf_rinc(mp,AT_WR_OFFSET);
78 gbuf_wset(mp,DDPL_FRAME_LEN);
79 adspp = (ADSP_FRAMEPtr)gbuf_wptr(mp);
80 gbuf_winc(mp,ADSP_FRAME_LEN);
81 bzero((caddr_t) gbuf_rptr(mp),DDPL_FRAME_LEN + ADSP_FRAME_LEN + ADSP_OPEN_FRAME_LEN);
82 adspp->descriptor = ADSP_CONTROL_BIT | ADSP_CTL_ODENY;
83 adspop = (ADSP_OPEN_DATAPtr)gbuf_wptr(mp);
84 gbuf_winc(mp,ADSP_OPEN_FRAME_LEN);
85 UAS_ASSIGN(adspop->dstCID, pb->u.openParams.remoteCID);
86 UAS_ASSIGN(adspop->version, 0x100);
87 adsp_sendddp(sp, mp,
88 DDPL_FRAME_LEN + ADSP_FRAME_LEN + ADSP_OPEN_FRAME_LEN,
89 &pb->u.openParams.remoteAddress, DDP_ADSP);
90 adspioc_ack(0, pb->ioc, pb->gref);
91 return 0;
92 }