]> git.saurik.com Git - apple/xnu.git/blob - bsd/netat/at_proto.c
xnu-344.49.tar.gz
[apple/xnu.git] / bsd / netat / at_proto.c
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
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
13 * file.
14 *
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.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25 /*
26 * Copyright (c) 1998 Apple Computer, Inc.
27 */
28
29 /* at_proto.c
30 */
31
32 #include <sys/param.h>
33 #include <sys/systm.h>
34 #include <sys/ioctl.h>
35 #include <sys/errno.h>
36 #include <sys/malloc.h>
37 #include <sys/socket.h>
38 #include <sys/socketvar.h>
39 #include <sys/protosw.h>
40 #include <sys/domain.h>
41 #include <sys/mbuf.h>
42
43 #include <sys/sysctl.h>
44
45 #include <net/if.h>
46
47 #include <netat/appletalk.h>
48 #include <netat/at_var.h>
49 #include <netat/ddp.h>
50
51 struct domain atalkdomain;
52
53 extern int ddp_pru_abort(struct socket *so);
54
55 extern int ddp_pru_attach(struct socket *so, int proto,
56 struct proc *p);
57 extern int ddp_pru_bind(struct socket *so, struct sockaddr *nam,
58 struct proc *p);
59 extern int ddp_pru_connect(struct socket *so, struct sockaddr *nam,
60 struct proc *p);
61
62 extern int ddp_pru_control(struct socket *so, u_long cmd, caddr_t data,
63 struct ifnet *ifp, struct proc *p);
64 extern int ddp_pru_detach(struct socket *so);
65 extern int ddp_pru_disconnect(struct socket *so);
66
67 extern int ddp_pru_peeraddr(struct socket *so,
68 struct sockaddr **nam);
69
70 extern int ddp_pru_send(struct socket *so, int flags, struct mbuf *m,
71 struct sockaddr *addr, struct mbuf *control,
72 struct proc *p);
73
74 extern int ddp_pru_shutdown(struct socket *so);
75 extern int ddp_pru_sockaddr(struct socket *so,
76 struct sockaddr **nam);
77
78 /*
79 * Dummy usrreqs struct created by Ted for FreeBSD 3.x integration.
80 * Fill in supported functions as appropriate.
81 */
82 struct pr_usrreqs ddp_usrreqs = {
83 ddp_pru_abort, pru_accept_notsupp, ddp_pru_attach, ddp_pru_bind,
84 ddp_pru_connect, pru_connect2_notsupp, ddp_pru_control, ddp_pru_detach,
85 ddp_pru_disconnect, pru_listen_notsupp, ddp_pru_peeraddr, pru_rcvd_notsupp,
86 pru_rcvoob_notsupp, ddp_pru_send, pru_sense_null, ddp_pru_shutdown,
87 ddp_pru_sockaddr, sosend, soreceive, sopoll
88 };
89
90 struct protosw atalksw[] = {
91 { SOCK_RAW, &atalkdomain, /*protocol*/ 0, PR_ATOMIC|PR_ADDR,
92 /*input*/ 0, /*output*/ 0, /*clinput*/ 0, ddp_ctloutput,
93 /*ousrreq*/ 0,
94 ddp_init, /*fastto*/ 0, /*slowto*/ 0, /*drain*/ 0,
95 /*sysctl*/ 0, &ddp_usrreqs
96 }
97 };
98
99 struct domain atalkdomain =
100 { AF_APPLETALK, "appletalk", 0, 0, 0,
101 atalksw, 0,
102 0, 0, 0,
103 DDP_X_HDR_SIZE, 0
104 };
105
106 SYSCTL_NODE(_net, PF_APPLETALK, appletalk, CTLFLAG_RW, 0, "AppleTalk Family");
107