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