]> git.saurik.com Git - apple/xnu.git/blob - bsd/net/firewire.h
xnu-517.3.15.tar.gz
[apple/xnu.git] / bsd / net / firewire.h
1 /*
2 * Copyright (c) 2003 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 * Fundamental constants relating to FireWire network device.
27 */
28
29 #ifndef _NET_FIREWIRE_H_
30 #define _NET_FIREWIRE_H_
31
32 #include <sys/appleapiopts.h>
33
34 /*
35 * The number of bytes in a FireWire EUI-64.
36 */
37 #define FIREWIRE_EUI64_LEN 8
38
39 /*
40 * The number of bytes in the type field.
41 */
42 #define FIREWIRE_TYPE_LEN 2
43
44 /*
45 * The length of the header provided by the FireWire network device.
46 */
47 #define FIREWIRE_HDR_LEN (FIREWIRE_EUI64_LEN*2+FIREWIRE_TYPE_LEN)
48
49 /*
50 * The minimum packet length.
51 */
52 #define FIREWIRE_MIN_LEN 64
53
54 /*
55 * The maximum packet length.
56 */
57 #define FIREWIRE_MAX_LEN 4096
58
59 /*
60 * A macro to validate a length with
61 */
62 #define FIREWIRE_IS_VALID_LEN(foo) \
63 ((foo) >= FIREWIRE_MIN_LEN && (foo) <= FIREWIRE_MAX_LEN)
64
65 /*
66 * Structure of header provided by the FireWire network device.
67 *
68 * The device uses a simplified header with just the non-changing
69 * EUI-64 addresses and ethernet type specified;
70 */
71 struct firewire_header {
72 u_char firewire_dhost[FIREWIRE_EUI64_LEN];
73 u_char firewire_shost[FIREWIRE_EUI64_LEN];
74 u_short firewire_type; /* ethertype */
75 };
76
77 /*
78 * Format of FireWire EUI-64.
79 */
80 struct firewire_eui64 {
81 u_char octet[FIREWIRE_EUI64_LEN];
82 };
83
84 /*
85 * Format of FireWire hardware address.
86 */
87 struct firewire_address {
88 u_char eui64[FIREWIRE_EUI64_LEN];
89 u_char maxRec;
90 u_char spd;
91 u_int16_t unicastFifoHi;
92 u_int32_t unicastFifoLo;
93 };
94
95 #define FIREWIRE_ADDR_LEN 16 /* sizeof(struct firewire_address) */
96
97
98 #define FIREWIRE_MTU (FIREWIRE_MAX_LEN - FIREWIRE_HDR_LEN)
99 #define FIREWIRE_MIN (FIREWIRE_MIN_LEN - FIREWIRE_HDR_LEN)
100
101 #endif /* !_NET_FIREWIRE_H_ */