]>
git.saurik.com Git - apple/xnu.git/blob - bsd/netat/adsp_CLListen.c
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
27 * From Mike Shoemaker v01.02 04/19/90 mbs
28 * Modified, April 9, 1997 by Tuyen Nguyen for MacOSX.
31 #include <sys/errno.h>
32 #include <sys/types.h>
33 #include <sys/param.h>
34 #include <machine/spl.h>
35 #include <sys/systm.h>
36 #include <sys/kernel.h>
38 #include <sys/filedesc.h>
39 #include <sys/fcntl.h>
41 #include <sys/socket.h>
43 #include <netat/sysglue.h>
44 #include <netat/appletalk.h>
45 #include <netat/at_pcb.h>
46 #include <netat/debug.h>
47 #include <netat/adsp.h>
48 #include <netat/adsp_internal.h>
54 * --> ccbRefNum refnum of connection end
55 * --> filterAddress filter for incoming open connection requests
58 * <-- remoteCID connection identifier of remote connection end
59 * <-- remoteAddress internet address of remote connection end
60 * <-- sendSeq initial send sequence number to use
61 * <-- sendWindow initial size of remote end's receive buffer
62 * <-- attnSendSeq initial attention send sequence number to use
65 * errRefNum bad connection refnum
66 * errState not a connection listener
67 * errAborted request aborted by a Remove call
69 int adspCLListen(sp
, pb
) /* (DSPPBPtr pb) */
71 register struct adspcmd
*pb
;
73 register struct adspcmd
*clpb
;
78 pb
->ioResult
= errRefNum
;
82 if (sp
->state
!= sListening
) { /* But this isn't a connection listener! */
83 pb
->ioResult
= errState
;
87 if (mp
= gbuf_copym(pb
->mp
)) { /* keep a copy of the parameter block */
88 pb
->ioResult
= 1; /* not done */
89 adspioc_ack(0, pb
->ioc
, pb
->gref
); /* release user ioctl block */
90 clpb
= (struct adspcmd
*)gbuf_rptr(mp
);
93 ATDISABLE(s
, sp
->lock
);
94 if (qAddToEnd(&sp
->opb
, clpb
)){ /* Add to list of listeners */
95 ATENABLE(s
, sp
->lock
);
96 return EFAULT
; /* bogus, but discriminate from other errors */
98 ATENABLE(s
, sp
->lock
);
100 pb
->ioResult
= errDSPQueueSize
;