1 /* $OpenBSD: at_proto.c,v 1.1 1997/07/23 03:39:52 denny Exp $ */
2 /*
3 * Copyright (c) 1990,1991 Regents of The University of Michigan.
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify, and distribute this software and
7 * its documentation for any purpose and without fee is hereby granted,
8 * provided that the above copyright notice appears in all copies and
9 * that both that copyright notice and this permission notice appear
10 * in supporting documentation, and that the name of The University
11 * of Michigan not be used in advertising or publicity pertaining to
12 * distribution of the software without specific, written prior
13 * permission. This software is supplied as is without expressed or
14 * implied warranties of any kind.
15 *
16 * Research Systems Unix Group
17 * The University of Michigan
18 * c/o Mike Clark
19 * 535 W. William Street
20 * Ann Arbor, Michigan
21 * +1-313-763-0525
22 * netatalk@itd.umich.edu
23 */
24
25 /*
26 * The following is the contents of the COPYRIGHT file from the
27 * netatalk-1.4a2 distribution, from which this file is derived.
28 */
29 /*
30 * Copyright (c) 1990,1996 Regents of The University of Michigan.
31 *
32 * All Rights Reserved.
33 *
34 * Permission to use, copy, modify, and distribute this software and
35 * its documentation for any purpose and without fee is hereby granted,
36 * provided that the above copyright notice appears in all copies and
37 * that both that copyright notice and this permission notice appear
38 * in supporting documentation, and that the name of The University
39 * of Michigan not be used in advertising or publicity pertaining to
40 * distribution of the software without specific, written prior
41 * permission. This software is supplied as is without expressed or
42 * implied warranties of any kind.
43 *
44 * This product includes software developed by the University of
45 * California, Berkeley and its contributors.
46 *
47 * Solaris code is encumbered by the following:
48 *
49 * Copyright (C) 1996 by Sun Microsystems Computer Co.
50 *
51 * Permission to use, copy, modify, and distribute this software and
52 * its documentation for any purpose and without fee is hereby
53 * granted, provided that the above copyright notice appear in all
54 * copies and that both that copyright notice and this permission
55 * notice appear in supporting documentation. This software is
56 * provided "as is" without express or implied warranty.
57 *
58 * Research Systems Unix Group
59 * The University of Michigan
60 * c/o Wesley Craig
61 * 535 W. William Street
62 * Ann Arbor, Michigan
63 * +1-313-764-2278
64 * netatalk@umich.edu
65 */
66 /*
67 * None of the Solaris code mentioned is included in OpenBSD.
68 * This code also relies heavily on previous effort in FreeBSD and NetBSD.
69 */
70
71 #include <sys/param.h>
72 #include <sys/systm.h>
73 #include <sys/kernel.h>
74 #include <sys/protosw.h>
75 #include <sys/domain.h>
76 #include <sys/types.h>
77 #include <sys/socket.h>
78 #include <net/if.h>
79 #include <net/route.h>
80 #include <netinet/in.h>
81 #undef s_net
82 #include <netinet/if_ether.h>
83
84 #include <netatalk/at.h>
85 #include <netatalk/at_extern.h>
86
87 struct protosw atalksw[] = {
88 {
89 /* Identifiers */
90 SOCK_DGRAM, &atalkdomain, ATPROTO_DDP, PR_ATOMIC|PR_ADDR,
91 /*
92 * protocol-protocol interface.
93 * fields are pr_input, pr_output, pr_ctlinput, and pr_ctloutput.
94 * pr_input can be called from the udp protocol stack for iptalk
95 * packets bound for a local socket.
96 * pr_output can be used by higher level appletalk protocols, should
97 * they be included in the kernel.
98 */
99 0, ddp_output, 0, 0,
100 /* socket-protocol interface. */
101 ddp_usrreq,
102 /* utility routines. */
103 ddp_init, 0, 0, 0,
104 },
105 };
106
107 struct domain atalkdomain = {
108 AF_APPLETALK, "appletalk", 0, 0, 0, atalksw,
109 &atalksw[ sizeof( atalksw ) / sizeof( atalksw[ 0 ] ) ],
110 0, rn_inithead,
111 8 * (u_long) &((struct sockaddr_at *) 0)->sat_addr, /* dom_rtoffset */
112 sizeof(struct sockaddr_at)
113 };