mirror of
https://github.com/the-tcpdump-group/tcpdump.git
synced 2024-11-25 11:03:42 +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.
34 lines
1.1 KiB
C
34 lines
1.1 KiB
C
/* @(#) $Header: /tcpdump/master/tcpdump/igrp.h,v 1.6 2002-12-11 07:13:52 guy Exp $ (LBL) */
|
|
/* Cisco IGRP definitions */
|
|
|
|
/* IGRP Header */
|
|
|
|
struct igrphdr {
|
|
u_int8_t ig_vop; /* protocol version number / opcode */
|
|
#define IGRP_V(x) (((x) & 0xf0) >> 4)
|
|
#define IGRP_OP(x) ((x) & 0x0f)
|
|
u_int8_t ig_ed; /* edition number */
|
|
u_int16_t ig_as; /* autonomous system number */
|
|
u_int16_t ig_ni; /* number of subnet in local net */
|
|
u_int16_t ig_ns; /* number of networks in AS */
|
|
u_int16_t ig_nx; /* number of networks ouside AS */
|
|
u_int16_t ig_sum; /* checksum of IGRP header & data */
|
|
};
|
|
|
|
#define IGRP_UPDATE 1
|
|
#define IGRP_REQUEST 2
|
|
|
|
/* IGRP routing entry */
|
|
|
|
struct igrprte {
|
|
u_int8_t igr_net[3]; /* 3 significant octets of IP address */
|
|
u_int8_t igr_dly[3]; /* delay in tens of microseconds */
|
|
u_int8_t igr_bw[3]; /* bandwidth in units of 1 kb/s */
|
|
u_int8_t igr_mtu[2]; /* MTU in octets */
|
|
u_int8_t igr_rel; /* percent packets successfully tx/rx */
|
|
u_int8_t igr_ld; /* percent of channel occupied */
|
|
u_int8_t igr_hct; /* hop count */
|
|
};
|
|
|
|
#define IGRP_RTE_SIZE 14 /* don't believe sizeof ! */
|