| 1 | /*	$OpenBSD: frame.h,v 1.1 2024/12/15 11:00:05 dlg 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 | #ifndef _NET_FRAME_H_ |
| 20 | #define _NET_FRAME_H_ |
| 21 | |
| 22 | #define FRAME_ADDRLEN		8 /* big enough for Ethernet */ |
| 23 | #define FRAME_DATALEN		32 |
| 24 | |
| 25 | struct sockaddr_frame { |
| 26 | 	uint8_t			sfrm_len; |
| 27 | 	uint8_t			sfrm_family; /* AF_FRAME */ |
| 28 | 	uint16_t		sfrm_proto; |
| 29 | 	unsigned int		sfrm_ifindex; |
| 30 | 	uint8_t			sfrm_addr[FRAME_ADDRLEN]; |
| 31 | 	char			sfrm_ifname[IFNAMSIZ]; |
| 32 | 	uint8_t			sfrm_data[FRAME_DATALEN]; |
| 33 | }; |
| 34 | |
| 35 | #define FRAME_RECVDSTADDR	0 /* int */ |
| 36 | #define FRAME_RECVPRIO		1 /* int */ |
| 37 | #define FRAME_ADD_MEMBERSHIP	64 /* struct frame_mreq */ |
| 38 | #define FRAME_DEL_MEMBERSHIP	65 /* struct frame_mreq */ |
| 39 | #define FRAME_SENDPRIO		66 /* int: IF_HDRPRIO_{MIN-MAX,PACKET} */ |
| 40 | |
| 41 | struct frame_mreq { |
| 42 | 	unsigned int		fmr_ifindex; |
| 43 | 	uint8_t			fmr_addr[FRAME_ADDRLEN]; |
| 44 | 	char			fmr_ifname[IFNAMSIZ]; |
| 45 | }; |
| 46 | |
| 47 | #endif /* _NET_FRAME_H_ */ |