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