]>
git.saurik.com Git - apple/xnu.git/blob - bsd/netat/at_proto.c
9ae6b7507e69db5ff06e3d94a173641ab70a95aa
2 * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved.
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
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
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
31 * Copyright (c) 1998 Apple Computer, Inc.
37 #include <sys/param.h>
38 #include <sys/systm.h>
39 #include <sys/ioctl.h>
40 #include <sys/errno.h>
41 #include <sys/malloc.h>
42 #include <sys/socket.h>
43 #include <sys/socketvar.h>
44 #include <sys/protosw.h>
45 #include <sys/domain.h>
47 #include <kern/locks.h>
49 #include <sys/sysctl.h>
53 #include <netat/appletalk.h>
54 #include <netat/at_var.h>
55 #include <netat/ddp.h>
58 extern int ddp_pru_abort(struct socket
*so
);
60 extern int ddp_pru_attach(struct socket
*so
, int proto
,
62 extern int ddp_pru_bind(struct socket
*so
, struct sockaddr
*nam
,
64 extern int ddp_pru_connect(struct socket
*so
, struct sockaddr
*nam
,
67 extern int ddp_pru_control(struct socket
*so
, u_long cmd
, caddr_t data
,
68 struct ifnet
*ifp
, struct proc
*p
);
69 extern int ddp_pru_detach(struct socket
*so
);
70 extern int ddp_pru_disconnect(struct socket
*so
);
72 extern int ddp_pru_peeraddr(struct socket
*so
,
73 struct sockaddr
**nam
);
75 extern int ddp_pru_send(struct socket
*so
, int flags
, struct mbuf
*m
,
76 struct sockaddr
*addr
, struct mbuf
*control
,
79 extern int ddp_pru_shutdown(struct socket
*so
);
80 extern int ddp_pru_sockaddr(struct socket
*so
,
81 struct sockaddr
**nam
);
85 * Dummy usrreqs struct created by Ted for FreeBSD 3.x integration.
86 * Fill in supported functions as appropriate.
88 struct pr_usrreqs ddp_usrreqs
= {
89 ddp_pru_abort
, pru_accept_notsupp
, ddp_pru_attach
, ddp_pru_bind
,
90 ddp_pru_connect
, pru_connect2_notsupp
, ddp_pru_control
, ddp_pru_detach
,
91 ddp_pru_disconnect
, pru_listen_notsupp
, ddp_pru_peeraddr
, pru_rcvd_notsupp
,
92 pru_rcvoob_notsupp
, ddp_pru_send
, pru_sense_null
, ddp_pru_shutdown
,
93 ddp_pru_sockaddr
, sosend
, soreceive
, pru_sopoll_notsupp
96 struct domain atalkdomain
;
97 struct protosw atalksw
[] = {
98 { SOCK_RAW
, &atalkdomain
, /*protocol*/ 0, PR_ATOMIC
|PR_ADDR
,
99 /*input*/ 0, /*output*/ 0, /*clinput*/ 0, ddp_ctloutput
,
101 ddp_init
, /*fastto*/ 0, /*slowto*/ 0, /*drain*/ 0,
102 /*sysctl*/ 0, &ddp_usrreqs
,
107 struct domain atalkdomain
=
108 { AF_APPLETALK
, "appletalk", atalk_dominit
, 0, 0,
114 struct domain
* atalkdom
= &atalkdomain
;
115 lck_mtx_t
*atalk_mutex
= NULL
;
117 SYSCTL_NODE(_net
, PF_APPLETALK
, appletalk
, CTLFLAG_RW
, 0, "AppleTalk Family");
122 atalk_mutex
= atalkdom
->dom_mtx
;
128 int error
= 0, lr
, lr_saved
;
130 __asm__
volatile("mflr %0" : "=r" (lr
));
133 lck_mtx_assert(atalkdom
->dom_mtx
, LCK_MTX_ASSERT_NOTOWNED
);
134 lck_mtx_lock(atalkdom
->dom_mtx
);
140 int error
= 0, lr
, lr_saved
;
142 __asm__
volatile("mflr %0" : "=r" (lr
));
145 lck_mtx_assert(atalkdom
->dom_mtx
, LCK_MTX_ASSERT_OWNED
);
146 lck_mtx_unlock(atalkdom
->dom_mtx
);