]>
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 * 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.
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
20 * @APPLE_LICENSE_HEADER_END@
24 * From Mike Shoemaker v01.02 04/19/90 mbs
25 * Modified, April 9, 1997 by Tuyen Nguyen for MacOSX.
28 #include <sys/errno.h>
29 #include <sys/types.h>
30 #include <sys/param.h>
31 #include <machine/spl.h>
32 #include <sys/systm.h>
33 #include <sys/kernel.h>
35 #include <sys/filedesc.h>
36 #include <sys/fcntl.h>
38 #include <sys/socket.h>
40 #include <netat/sysglue.h>
41 #include <netat/appletalk.h>
42 #include <netat/at_pcb.h>
43 #include <netat/debug.h>
44 #include <netat/adsp.h>
45 #include <netat/adsp_internal.h>
51 * --> ccbRefNum refnum of connection end
52 * --> filterAddress filter for incoming open connection requests
55 * <-- remoteCID connection identifier of remote connection end
56 * <-- remoteAddress internet address of remote connection end
57 * <-- sendSeq initial send sequence number to use
58 * <-- sendWindow initial size of remote end's receive buffer
59 * <-- attnSendSeq initial attention send sequence number to use
62 * errRefNum bad connection refnum
63 * errState not a connection listener
64 * errAborted request aborted by a Remove call
66 int adspCLListen(sp
, pb
) /* (DSPPBPtr pb) */
68 register struct adspcmd
*pb
;
70 register struct adspcmd
*clpb
;
75 pb
->ioResult
= errRefNum
;
79 if (sp
->state
!= sListening
) { /* But this isn't a connection listener! */
80 pb
->ioResult
= errState
;
84 if (mp
= gbuf_copym(pb
->mp
)) { /* keep a copy of the parameter block */
85 pb
->ioResult
= 1; /* not done */
86 adspioc_ack(0, pb
->ioc
, pb
->gref
); /* release user ioctl block */
87 clpb
= (struct adspcmd
*)gbuf_rptr(mp
);
90 ATDISABLE(s
, sp
->lock
);
91 if (qAddToEnd(&sp
->opb
, clpb
)){ /* Add to list of listeners */
92 ATENABLE(s
, sp
->lock
);
93 return EFAULT
; /* bogus, but discriminate from other errors */
95 ATENABLE(s
, sp
->lock
);
97 pb
->ioResult
= errDSPQueueSize
;