1 /* $OpenBSD: af_frame.c,v 1.2 2025/01/05 12:36:48 bluhm Exp $ */
2
3 /*
4 * Copyright (c) 2024 David Gwynne <dlg@openbsd.org>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19 #include <sys/param.h>
20 #include <sys/socket.h>
21 #include <sys/protosw.h>
22 #include <sys/domain.h>
23 #include <sys/systm.h>
24
25 #include <net/if_types.h>
26
27 #include <net/if.h>
28 #include <net/if_arp.h>
29 #include <netinet/in.h>
30 #include <netinet/if_ether.h>
31
32 const struct domain framedomain;
33
34 /* reach over to if_ethersubr.c */
35 int ether_frm_ctloutput(int, struct socket *, int, int, struct mbuf *);
36 extern const struct pr_usrreqs ether_frm_usrreqs;
37
38 static const struct protosw framesw[] = {
39 {
40 .pr_type = SOCK_DGRAM,
41 .pr_domain = &framedomain,
42 .pr_protocol = IFT_ETHER,
43 .pr_flags = PR_ATOMIC|PR_ADDR|PR_MPINPUT,
44
45 .pr_ctloutput = ether_frm_ctloutput,
46 .pr_usrreqs = ðer_frm_usrreqs,
47 .pr_sysctl = NULL /* ether_frm_sysctl */,
48 },
49 };
50
51 const struct domain framedomain = {
52 .dom_family = AF_FRAME,
53 .dom_name = "frame",
54 .dom_protosw = framesw,
55 .dom_protoswNPROTOSW = &framesw[nitems(framesw)],
56 };
57
58 void
af_frameattach(int n)59 af_frameattach(int n)
60 {
61 /* nop */
62 }
63