]> git.saurik.com Git - apple/xnu.git/blob - bsd/net/firewire.h
xnu-792.13.8.tar.gz
[apple/xnu.git] / bsd / net / firewire.h
1 /*
2 * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
14 * agreement.
15 *
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
18 * file.
19 *
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
27 *
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
29 */
30 /*
31 * Fundamental constants relating to FireWire network device.
32 */
33
34 #ifndef _NET_FIREWIRE_H_
35 #define _NET_FIREWIRE_H_
36
37 #include <sys/appleapiopts.h>
38
39 /*
40 * The number of bytes in a FireWire EUI-64.
41 */
42 #define FIREWIRE_EUI64_LEN 8
43
44 /*
45 * The number of bytes in the type field.
46 */
47 #define FIREWIRE_TYPE_LEN 2
48
49 /*
50 * The length of the header provided by the FireWire network device.
51 */
52 #define FIREWIRE_HDR_LEN (FIREWIRE_EUI64_LEN*2+FIREWIRE_TYPE_LEN)
53
54 /*
55 * The minimum packet length.
56 */
57 #define FIREWIRE_MIN_LEN 64
58
59 /*
60 * The maximum packet length.
61 */
62 #define FIREWIRE_MAX_LEN 4096
63
64 /*
65 * A macro to validate a length with
66 */
67 #define FIREWIRE_IS_VALID_LEN(foo) \
68 ((foo) >= FIREWIRE_MIN_LEN && (foo) <= FIREWIRE_MAX_LEN)
69
70 /*
71 * Structure of header provided by the FireWire network device.
72 *
73 * The device uses a simplified header with just the non-changing
74 * EUI-64 addresses and ethernet type specified;
75 */
76 struct firewire_header {
77 u_char firewire_dhost[FIREWIRE_EUI64_LEN];
78 u_char firewire_shost[FIREWIRE_EUI64_LEN];
79 u_short firewire_type; /* ethertype */
80 };
81
82 /*
83 * Format of FireWire EUI-64.
84 */
85 struct firewire_eui64 {
86 u_char octet[FIREWIRE_EUI64_LEN];
87 };
88
89 /*
90 * Format of FireWire hardware address.
91 */
92 struct firewire_address {
93 u_char eui64[FIREWIRE_EUI64_LEN];
94 u_char maxRec;
95 u_char spd;
96 u_int16_t unicastFifoHi;
97 u_int32_t unicastFifoLo;
98 };
99
100 #define FIREWIRE_ADDR_LEN 16 /* sizeof(struct firewire_address) */
101
102
103 #define FIREWIRE_MTU (FIREWIRE_MAX_LEN - FIREWIRE_HDR_LEN)
104 #define FIREWIRE_MIN (FIREWIRE_MIN_LEN - FIREWIRE_HDR_LEN)
105
106 #endif /* !_NET_FIREWIRE_H_ */