2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
22 /* Copyright (c) 1997, 1998 Apple Computer, Inc. All Rights Reserved */
24 * @(#)ndrv.h 1.1 (MacOSX) 6/10/43
25 * Justin Walker - 970604
31 #include <sys/appleapiopts.h>
36 unsigned char snd_len
;
37 unsigned char snd_family
;
38 unsigned char snd_name
[IFNAMSIZ
]; /* from if.h */
42 * Support for user-mode protocol handlers
45 #define NDRV_DEMUXTYPE_ETHERTYPE 4
46 #define NDRV_DEMUXTYPE_SAP 5
47 #define NDRV_DEMUXTYPE_SNAP 6
49 #define NDRVPROTO_NDRV 0
52 * Struct: ndrv_demux_desc
54 * To uniquely identify a packet based on its low-level framing information.
57 * type : type of protocol in data field, must be understood by
58 * the interface family of the interface the socket is bound to
59 * length : length of protocol data in "data" field
60 * data : union of framing-specific data, in network byte order
61 * ether_type : ethernet type in network byte order, assuming
62 * ethernet type II framing
63 * sap : first 3 bytes of sap header, network byte order
64 * snap : first 5 bytes of snap header, network byte order
65 * other : up to 28 bytes of protocol data for different protocol type
68 * 1) 802.1x uses ether_type 0x888e, so the descriptor would be set as:
69 * struct ndrv_demux_desc desc;
70 * desc.type = NDRV_DEMUXTYPE_ETHERTYPE
71 * desc.length = sizeof(unsigned short);
72 * desc.ether_type = htons(0x888e);
73 * 2) AppleTalk uses SNAP 0x080007809B
74 * struct ndrv_demux_desc desc;
75 * desc.type = NDRV_DEMUXTYPE_SNAP;
77 * desc.data.snap[0] = 08;
78 * desc.data.snap[1] = 00;
79 * desc.data.snap[2] = 07;
80 * desc.data.snap[3] = 80;
81 * desc.data.snap[4] = 9B;
83 struct ndrv_demux_desc
96 #define NDRV_PROTOCOL_DESC_VERS 1
99 * Struct: ndrv_protocol_desc
101 * Used to "bind" an NDRV socket so that packets that match
102 * given protocol demux descriptions can be received:
104 * version : must be NDRV_PROTOCOL_DESC_VERS
105 * protocol_family : unique identifier for this protocol
106 * demux_count : number of demux_list descriptors in demux_list
107 * demux_list : pointer to array of demux descriptors
109 struct ndrv_protocol_desc
112 u_int32_t protocol_family
;
113 u_int32_t demux_count
;
114 struct ndrv_demux_desc
* demux_list
;
117 #define SOL_NDRVPROTO NDRVPROTO_NDRV /* Use this socket level */
118 #define NDRV_DELDMXSPEC 0x02 /* Delete the registered protocol */
119 #define NDRV_SETDMXSPEC 0x04 /* Set the protocol spec */
120 #define NDRV_ADDMULTICAST 0x05 /* Add a physical multicast address */
121 #define NDRV_DELMULTICAST 0x06 /* Delete a phyiscal multicast */
124 * SOL_NDRVPROTO - use this for the socket level when calling setsocketopt
125 * NDRV_DELDMXSPEC - removes the registered protocol and all related demuxes
126 * NDRV_SETDMXSPEC - set the protocol to receive, use struct ndrv_protocol_desc
128 * NDRV_ADDMULTICAST - Enable reception of a phyiscal multicast address, use
129 * a sockaddr of the appropriate type for the media in use.
130 * NDRV_DELMULTICAST - Disable reception of a phyiscal multicast address, use
131 * a sockaddr of the appropriate type for the media in use.
133 * When adding multicasts, the multicasts are ref counted. If the multicast is
134 * already registered in the kernel, the count will be bumped. When deleting
135 * the multicast, the count is decremented. If the count reaches zero the
136 * multicast is removed. If your process is killed, PF_NDRV will unregister
137 * the mulitcasts you've added. You can only delete multicasts you've added
138 * on the same socket.
140 * If the interface goes away while your socket is open, your protocol is
141 * immediately detached and sending/receiving is disabled on the socket.
142 * If you need a chance to do something, please file a bug and we can give
143 * you a second or two.
146 #endif /* _NET_NDRV_H */