mirror of
https://github.com/the-tcpdump-group/tcpdump.git
synced 2024-11-30 13:34:04 +08:00
fcc82f451d
compile with Sun C, as "interface.h" isn't being included before the structures are being declared. Furthermore, in the files that Sun C *can* compile, it doesn't cause Sun C to generate code that's safe with unaligned accesses, as "__attribute__" is defined as a do-nothing macro with compilers that don't support it. Therefore, we get rid of that tag on the structures to which it was added, and instead use "EXTRACT_16BIT()" and "EXTRACT_32BIT()" to fetch 16-bit and 32-bit big-endian quantities from packets. We also fix some other references to multi-byte quantities to get rid of code that tries to do unaligned loads on platforms that don't support them. We also throw in a hack that makes those macros use "__attribute__((packed))" on structures containing only one 16-bit or 32-bit integer to get the compiler to generate unaligned-safe code rather than doing it by hand. (GCC on SPARC produces the same code that doing it by hand does; I don't know if GCC on any other big-endian strict-alignment processor generates better code for that case. On little-endian processors, as "ntohs()" and "ntohl()" might be functions, that might actually produce worse code.) Fix some places to use "%u" rather than "%d" to print unsigned quantities.
42 lines
1.1 KiB
C
42 lines
1.1 KiB
C
/*
|
|
* Marko Kiiskila carnil@cs.tut.fi
|
|
*
|
|
* Tampere University of Technology - Telecommunications Laboratory
|
|
*
|
|
* Permission to use, copy, modify and distribute this
|
|
* software and its documentation is hereby granted,
|
|
* provided that both the copyright notice and this
|
|
* permission notice appear in all copies of the software,
|
|
* derivative works or modified versions, and any portions
|
|
* thereof, that both notices appear in supporting
|
|
* documentation, and that the use of this software is
|
|
* acknowledged in any publications resulting from using
|
|
* the software.
|
|
*
|
|
* TUT ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
|
* CONDITION AND DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
|
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS
|
|
* SOFTWARE.
|
|
*
|
|
*/
|
|
|
|
/* $Id: lane.h,v 1.7 2002-12-11 07:13:54 guy Exp $ */
|
|
|
|
#ifndef ETHER_ADDR_LEN
|
|
#define ETHER_ADDR_LEN 6
|
|
#endif
|
|
|
|
struct lecdatahdr_8023 {
|
|
u_int16_t le_header;
|
|
u_int8_t h_dest[ETHER_ADDR_LEN];
|
|
u_int8_t h_source[ETHER_ADDR_LEN];
|
|
u_int16_t h_type;
|
|
};
|
|
|
|
struct lane_controlhdr {
|
|
u_int16_t lec_header;
|
|
u_int8_t lec_proto;
|
|
u_int8_t lec_vers;
|
|
u_int16_t lec_opcode;
|
|
};
|