mirror of
https://github.com/the-tcpdump-group/tcpdump.git
synced 2024-11-27 03:53:53 +08:00
always use u_intXX_t for protocol format declaration. char/short/int may not
come with exact size. while at it, correct signedness of ip/udp header field. nuke most of the use of bitfield. TODO: bitfield in namser.h
This commit is contained in:
parent
cdaba7de64
commit
fb75d3cd5a
60
appletalk.h
60
appletalk.h
@ -20,13 +20,13 @@
|
||||
*
|
||||
* AppleTalk protocol formats (courtesy Bill Croft of Stanford/SUMEX).
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/appletalk.h,v 1.12 1999-10-07 23:47:09 mcr Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/appletalk.h,v 1.13 2000-10-03 02:54:54 itojun Exp $ (LBL)
|
||||
*/
|
||||
|
||||
struct LAP {
|
||||
u_char dst;
|
||||
u_char src;
|
||||
u_char type;
|
||||
u_int8_t dst;
|
||||
u_int8_t src;
|
||||
u_int8_t type;
|
||||
};
|
||||
#define lapShortDDP 1 /* short DDP type */
|
||||
#define lapDDP 2 /* DDP type */
|
||||
@ -35,22 +35,22 @@ struct LAP {
|
||||
/* Datagram Delivery Protocol */
|
||||
|
||||
struct atDDP {
|
||||
u_short length;
|
||||
u_short checksum;
|
||||
u_short dstNet;
|
||||
u_short srcNet;
|
||||
u_char dstNode;
|
||||
u_char srcNode;
|
||||
u_char dstSkt;
|
||||
u_char srcSkt;
|
||||
u_char type;
|
||||
u_int16_t length;
|
||||
u_int16_t checksum;
|
||||
u_int16_t dstNet;
|
||||
u_int16_t srcNet;
|
||||
u_int8_t dstNode;
|
||||
u_int8_t srcNode;
|
||||
u_int8_t dstSkt;
|
||||
u_int8_t srcSkt;
|
||||
u_int8_t type;
|
||||
};
|
||||
|
||||
struct atShortDDP {
|
||||
u_short length;
|
||||
u_char dstSkt;
|
||||
u_char srcSkt;
|
||||
u_char type;
|
||||
u_int16_t length;
|
||||
u_int8_t dstSkt;
|
||||
u_int8_t srcSkt;
|
||||
u_int8_t type;
|
||||
};
|
||||
|
||||
#define ddpMaxWKS 0x7F
|
||||
@ -73,9 +73,9 @@ struct atShortDDP {
|
||||
/* AppleTalk Transaction Protocol */
|
||||
|
||||
struct atATP {
|
||||
u_char control;
|
||||
u_char bitmap;
|
||||
u_short transID;
|
||||
u_int8_t control;
|
||||
u_int8_t bitmap;
|
||||
u_int16_t transID;
|
||||
int32_t userData;
|
||||
};
|
||||
|
||||
@ -94,8 +94,8 @@ struct atATP {
|
||||
/* AppleTalk Echo Protocol */
|
||||
|
||||
struct atEcho {
|
||||
u_char echoFunction;
|
||||
u_char *echoData;
|
||||
u_int8_t echoFunction;
|
||||
u_int8_t *echoData;
|
||||
};
|
||||
|
||||
#define echoSkt 4 /* the echoer socket */
|
||||
@ -107,15 +107,15 @@ struct atEcho {
|
||||
/* Name Binding Protocol */
|
||||
|
||||
struct atNBP {
|
||||
u_char control;
|
||||
u_char id;
|
||||
u_int8_t control;
|
||||
u_int8_t id;
|
||||
};
|
||||
|
||||
struct atNBPtuple {
|
||||
u_short net;
|
||||
u_char node;
|
||||
u_char skt;
|
||||
u_char enumerator;
|
||||
u_int16_t net;
|
||||
u_int8_t node;
|
||||
u_int8_t skt;
|
||||
u_int8_t enumerator;
|
||||
};
|
||||
|
||||
#define nbpBrRq 0x10
|
||||
@ -141,8 +141,8 @@ struct atNBPtuple {
|
||||
/* Zone Information Protocol */
|
||||
|
||||
struct zipHeader {
|
||||
u_char command;
|
||||
u_char netcount;
|
||||
u_int8_t command;
|
||||
u_int8_t netcount;
|
||||
};
|
||||
|
||||
#define zipHeaderSize 2
|
||||
|
178
bootp.h
178
bootp.h
@ -1,4 +1,4 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/bootp.h,v 1.8 1999-10-17 23:35:46 mcr Exp $ (LBL) */
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/bootp.h,v 1.9 2000-10-03 02:54:54 itojun Exp $ (LBL) */
|
||||
/*
|
||||
* Bootstrap Protocol (BOOTP). RFC951 and RFC1048.
|
||||
*
|
||||
@ -21,21 +21,21 @@
|
||||
|
||||
|
||||
struct bootp {
|
||||
unsigned char bp_op; /* packet opcode type */
|
||||
unsigned char bp_htype; /* hardware addr type */
|
||||
unsigned char bp_hlen; /* hardware addr length */
|
||||
unsigned char bp_hops; /* gateway hops */
|
||||
u_int8_t bp_op; /* packet opcode type */
|
||||
u_int8_t bp_htype; /* hardware addr type */
|
||||
u_int8_t bp_hlen; /* hardware addr length */
|
||||
u_int8_t bp_hops; /* gateway hops */
|
||||
u_int32_t bp_xid; /* transaction ID */
|
||||
unsigned short bp_secs; /* seconds since boot began */
|
||||
unsigned short bp_flags; /* flags: 0x8000 is broadcast */
|
||||
u_int16_t bp_secs; /* seconds since boot began */
|
||||
u_int16_t bp_flags; /* flags: 0x8000 is broadcast */
|
||||
struct in_addr bp_ciaddr; /* client IP address */
|
||||
struct in_addr bp_yiaddr; /* 'your' IP address */
|
||||
struct in_addr bp_siaddr; /* server IP address */
|
||||
struct in_addr bp_giaddr; /* gateway IP address */
|
||||
unsigned char bp_chaddr[16]; /* client hardware address */
|
||||
unsigned char bp_sname[64]; /* server host name */
|
||||
unsigned char bp_file[128]; /* boot file name */
|
||||
unsigned char bp_vend[64]; /* vendor-specific area */
|
||||
u_int8_t bp_chaddr[16]; /* client hardware address */
|
||||
u_int8_t bp_sname[64]; /* server host name */
|
||||
u_int8_t bp_file[128]; /* boot file name */
|
||||
u_int8_t bp_vend[64]; /* vendor-specific area */
|
||||
};
|
||||
|
||||
/*
|
||||
@ -65,85 +65,85 @@ struct bootp {
|
||||
* the vendor field of the packet.
|
||||
*/
|
||||
|
||||
#define TAG_PAD ((unsigned char) 0)
|
||||
#define TAG_SUBNET_MASK ((unsigned char) 1)
|
||||
#define TAG_TIME_OFFSET ((unsigned char) 2)
|
||||
#define TAG_GATEWAY ((unsigned char) 3)
|
||||
#define TAG_TIME_SERVER ((unsigned char) 4)
|
||||
#define TAG_NAME_SERVER ((unsigned char) 5)
|
||||
#define TAG_DOMAIN_SERVER ((unsigned char) 6)
|
||||
#define TAG_LOG_SERVER ((unsigned char) 7)
|
||||
#define TAG_COOKIE_SERVER ((unsigned char) 8)
|
||||
#define TAG_LPR_SERVER ((unsigned char) 9)
|
||||
#define TAG_IMPRESS_SERVER ((unsigned char) 10)
|
||||
#define TAG_RLP_SERVER ((unsigned char) 11)
|
||||
#define TAG_HOSTNAME ((unsigned char) 12)
|
||||
#define TAG_BOOTSIZE ((unsigned char) 13)
|
||||
#define TAG_END ((unsigned char) 255)
|
||||
#define TAG_PAD ((u_int8_t) 0)
|
||||
#define TAG_SUBNET_MASK ((u_int8_t) 1)
|
||||
#define TAG_TIME_OFFSET ((u_int8_t) 2)
|
||||
#define TAG_GATEWAY ((u_int8_t) 3)
|
||||
#define TAG_TIME_SERVER ((u_int8_t) 4)
|
||||
#define TAG_NAME_SERVER ((u_int8_t) 5)
|
||||
#define TAG_DOMAIN_SERVER ((u_int8_t) 6)
|
||||
#define TAG_LOG_SERVER ((u_int8_t) 7)
|
||||
#define TAG_COOKIE_SERVER ((u_int8_t) 8)
|
||||
#define TAG_LPR_SERVER ((u_int8_t) 9)
|
||||
#define TAG_IMPRESS_SERVER ((u_int8_t) 10)
|
||||
#define TAG_RLP_SERVER ((u_int8_t) 11)
|
||||
#define TAG_HOSTNAME ((u_int8_t) 12)
|
||||
#define TAG_BOOTSIZE ((u_int8_t) 13)
|
||||
#define TAG_END ((u_int8_t) 255)
|
||||
/* RFC1497 tags */
|
||||
#define TAG_DUMPPATH ((unsigned char) 14)
|
||||
#define TAG_DOMAINNAME ((unsigned char) 15)
|
||||
#define TAG_SWAP_SERVER ((unsigned char) 16)
|
||||
#define TAG_ROOTPATH ((unsigned char) 17)
|
||||
#define TAG_EXTPATH ((unsigned char) 18)
|
||||
#define TAG_DUMPPATH ((u_int8_t) 14)
|
||||
#define TAG_DOMAINNAME ((u_int8_t) 15)
|
||||
#define TAG_SWAP_SERVER ((u_int8_t) 16)
|
||||
#define TAG_ROOTPATH ((u_int8_t) 17)
|
||||
#define TAG_EXTPATH ((u_int8_t) 18)
|
||||
/* RFC2132 */
|
||||
#define TAG_IP_FORWARD ((unsigned char) 19)
|
||||
#define TAG_NL_SRCRT ((unsigned char) 20)
|
||||
#define TAG_PFILTERS ((unsigned char) 21)
|
||||
#define TAG_REASS_SIZE ((unsigned char) 22)
|
||||
#define TAG_DEF_TTL ((unsigned char) 23)
|
||||
#define TAG_MTU_TIMEOUT ((unsigned char) 24)
|
||||
#define TAG_MTU_TABLE ((unsigned char) 25)
|
||||
#define TAG_INT_MTU ((unsigned char) 26)
|
||||
#define TAG_LOCAL_SUBNETS ((unsigned char) 27)
|
||||
#define TAG_BROAD_ADDR ((unsigned char) 28)
|
||||
#define TAG_DO_MASK_DISC ((unsigned char) 29)
|
||||
#define TAG_SUPPLY_MASK ((unsigned char) 30)
|
||||
#define TAG_DO_RDISC ((unsigned char) 31)
|
||||
#define TAG_RTR_SOL_ADDR ((unsigned char) 32)
|
||||
#define TAG_STATIC_ROUTE ((unsigned char) 33)
|
||||
#define TAG_USE_TRAILERS ((unsigned char) 34)
|
||||
#define TAG_ARP_TIMEOUT ((unsigned char) 35)
|
||||
#define TAG_ETH_ENCAP ((unsigned char) 36)
|
||||
#define TAG_TCP_TTL ((unsigned char) 37)
|
||||
#define TAG_TCP_KEEPALIVE ((unsigned char) 38)
|
||||
#define TAG_KEEPALIVE_GO ((unsigned char) 39)
|
||||
#define TAG_NIS_DOMAIN ((unsigned char) 40)
|
||||
#define TAG_NIS_SERVERS ((unsigned char) 41)
|
||||
#define TAG_NTP_SERVERS ((unsigned char) 42)
|
||||
#define TAG_VENDOR_OPTS ((unsigned char) 43)
|
||||
#define TAG_NETBIOS_NS ((unsigned char) 44)
|
||||
#define TAG_NETBIOS_DDS ((unsigned char) 45)
|
||||
#define TAG_NETBIOS_NODE ((unsigned char) 46)
|
||||
#define TAG_NETBIOS_SCOPE ((unsigned char) 47)
|
||||
#define TAG_XWIN_FS ((unsigned char) 48)
|
||||
#define TAG_XWIN_DM ((unsigned char) 49)
|
||||
#define TAG_NIS_P_DOMAIN ((unsigned char) 64)
|
||||
#define TAG_NIS_P_SERVERS ((unsigned char) 65)
|
||||
#define TAG_MOBILE_HOME ((unsigned char) 68)
|
||||
#define TAG_SMPT_SERVER ((unsigned char) 69)
|
||||
#define TAG_POP3_SERVER ((unsigned char) 70)
|
||||
#define TAG_NNTP_SERVER ((unsigned char) 71)
|
||||
#define TAG_WWW_SERVER ((unsigned char) 72)
|
||||
#define TAG_FINGER_SERVER ((unsigned char) 73)
|
||||
#define TAG_IRC_SERVER ((unsigned char) 74)
|
||||
#define TAG_STREETTALK_SRVR ((unsigned char) 75)
|
||||
#define TAG_STREETTALK_STDA ((unsigned char) 76)
|
||||
#define TAG_IP_FORWARD ((u_int8_t) 19)
|
||||
#define TAG_NL_SRCRT ((u_int8_t) 20)
|
||||
#define TAG_PFILTERS ((u_int8_t) 21)
|
||||
#define TAG_REASS_SIZE ((u_int8_t) 22)
|
||||
#define TAG_DEF_TTL ((u_int8_t) 23)
|
||||
#define TAG_MTU_TIMEOUT ((u_int8_t) 24)
|
||||
#define TAG_MTU_TABLE ((u_int8_t) 25)
|
||||
#define TAG_INT_MTU ((u_int8_t) 26)
|
||||
#define TAG_LOCAL_SUBNETS ((u_int8_t) 27)
|
||||
#define TAG_BROAD_ADDR ((u_int8_t) 28)
|
||||
#define TAG_DO_MASK_DISC ((u_int8_t) 29)
|
||||
#define TAG_SUPPLY_MASK ((u_int8_t) 30)
|
||||
#define TAG_DO_RDISC ((u_int8_t) 31)
|
||||
#define TAG_RTR_SOL_ADDR ((u_int8_t) 32)
|
||||
#define TAG_STATIC_ROUTE ((u_int8_t) 33)
|
||||
#define TAG_USE_TRAILERS ((u_int8_t) 34)
|
||||
#define TAG_ARP_TIMEOUT ((u_int8_t) 35)
|
||||
#define TAG_ETH_ENCAP ((u_int8_t) 36)
|
||||
#define TAG_TCP_TTL ((u_int8_t) 37)
|
||||
#define TAG_TCP_KEEPALIVE ((u_int8_t) 38)
|
||||
#define TAG_KEEPALIVE_GO ((u_int8_t) 39)
|
||||
#define TAG_NIS_DOMAIN ((u_int8_t) 40)
|
||||
#define TAG_NIS_SERVERS ((u_int8_t) 41)
|
||||
#define TAG_NTP_SERVERS ((u_int8_t) 42)
|
||||
#define TAG_VENDOR_OPTS ((u_int8_t) 43)
|
||||
#define TAG_NETBIOS_NS ((u_int8_t) 44)
|
||||
#define TAG_NETBIOS_DDS ((u_int8_t) 45)
|
||||
#define TAG_NETBIOS_NODE ((u_int8_t) 46)
|
||||
#define TAG_NETBIOS_SCOPE ((u_int8_t) 47)
|
||||
#define TAG_XWIN_FS ((u_int8_t) 48)
|
||||
#define TAG_XWIN_DM ((u_int8_t) 49)
|
||||
#define TAG_NIS_P_DOMAIN ((u_int8_t) 64)
|
||||
#define TAG_NIS_P_SERVERS ((u_int8_t) 65)
|
||||
#define TAG_MOBILE_HOME ((u_int8_t) 68)
|
||||
#define TAG_SMPT_SERVER ((u_int8_t) 69)
|
||||
#define TAG_POP3_SERVER ((u_int8_t) 70)
|
||||
#define TAG_NNTP_SERVER ((u_int8_t) 71)
|
||||
#define TAG_WWW_SERVER ((u_int8_t) 72)
|
||||
#define TAG_FINGER_SERVER ((u_int8_t) 73)
|
||||
#define TAG_IRC_SERVER ((u_int8_t) 74)
|
||||
#define TAG_STREETTALK_SRVR ((u_int8_t) 75)
|
||||
#define TAG_STREETTALK_STDA ((u_int8_t) 76)
|
||||
/* DHCP options */
|
||||
#define TAG_REQUESTED_IP ((unsigned char) 50)
|
||||
#define TAG_IP_LEASE ((unsigned char) 51)
|
||||
#define TAG_OPT_OVERLOAD ((unsigned char) 52)
|
||||
#define TAG_TFTP_SERVER ((unsigned char) 66)
|
||||
#define TAG_BOOTFILENAME ((unsigned char) 67)
|
||||
#define TAG_DHCP_MESSAGE ((unsigned char) 53)
|
||||
#define TAG_SERVER_ID ((unsigned char) 54)
|
||||
#define TAG_PARM_REQUEST ((unsigned char) 55)
|
||||
#define TAG_MESSAGE ((unsigned char) 56)
|
||||
#define TAG_MAX_MSG_SIZE ((unsigned char) 57)
|
||||
#define TAG_RENEWAL_TIME ((unsigned char) 58)
|
||||
#define TAG_REBIND_TIME ((unsigned char) 59)
|
||||
#define TAG_VENDOR_CLASS ((unsigned char) 60)
|
||||
#define TAG_CLIENT_ID ((unsigned char) 61)
|
||||
#define TAG_REQUESTED_IP ((u_int8_t) 50)
|
||||
#define TAG_IP_LEASE ((u_int8_t) 51)
|
||||
#define TAG_OPT_OVERLOAD ((u_int8_t) 52)
|
||||
#define TAG_TFTP_SERVER ((u_int8_t) 66)
|
||||
#define TAG_BOOTFILENAME ((u_int8_t) 67)
|
||||
#define TAG_DHCP_MESSAGE ((u_int8_t) 53)
|
||||
#define TAG_SERVER_ID ((u_int8_t) 54)
|
||||
#define TAG_PARM_REQUEST ((u_int8_t) 55)
|
||||
#define TAG_MESSAGE ((u_int8_t) 56)
|
||||
#define TAG_MAX_MSG_SIZE ((u_int8_t) 57)
|
||||
#define TAG_RENEWAL_TIME ((u_int8_t) 58)
|
||||
#define TAG_REBIND_TIME ((u_int8_t) 59)
|
||||
#define TAG_VENDOR_CLASS ((u_int8_t) 60)
|
||||
#define TAG_CLIENT_ID ((u_int8_t) 61)
|
||||
|
||||
/* DHCP Message types (values for TAG_DHCP_MESSAGE option) */
|
||||
#define DHCPDISCOVER 1
|
||||
@ -161,14 +161,14 @@ struct bootp {
|
||||
*/
|
||||
|
||||
struct cmu_vend {
|
||||
unsigned char v_magic[4]; /* magic number */
|
||||
u_int8_t v_magic[4]; /* magic number */
|
||||
u_int32_t v_flags; /* flags/opcodes, etc. */
|
||||
struct in_addr v_smask; /* Subnet mask */
|
||||
struct in_addr v_dgate; /* Default gateway */
|
||||
struct in_addr v_dns1, v_dns2; /* Domain name servers */
|
||||
struct in_addr v_ins1, v_ins2; /* IEN-116 name servers */
|
||||
struct in_addr v_ts1, v_ts2; /* Time servers */
|
||||
unsigned char v_unused[24]; /* currently unused */
|
||||
u_int8_t v_unused[24]; /* currently unused */
|
||||
};
|
||||
|
||||
|
||||
|
18
decnet.h
18
decnet.h
@ -18,21 +18,21 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/decnet.h,v 1.6 1999-10-07 23:47:10 mcr Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/decnet.h,v 1.7 2000-10-03 02:54:55 itojun Exp $ (LBL)
|
||||
*/
|
||||
|
||||
typedef unsigned char byte[1]; /* single byte field */
|
||||
typedef unsigned char word[2]; /* 2 byte field */
|
||||
typedef unsigned char longword[4]; /* 4 bytes field */
|
||||
typedef u_int8_t byte[1]; /* single byte field */
|
||||
typedef u_int8_t word[2]; /* 2 byte field */
|
||||
typedef u_int8_t longword[4]; /* 4 bytes field */
|
||||
|
||||
/*
|
||||
* Definitions for DECNET Phase IV protocol headers
|
||||
*/
|
||||
union etheraddress {
|
||||
unsigned char dne_addr[6]; /* full ethernet address */
|
||||
u_int8_t dne_addr[6]; /* full ethernet address */
|
||||
struct {
|
||||
unsigned char dne_hiord[4]; /* DECnet HIORD prefix */
|
||||
unsigned char dne_nodeaddr[2]; /* DECnet node address */
|
||||
u_int8_t dne_hiord[4]; /* DECnet HIORD prefix */
|
||||
u_int8_t dne_nodeaddr[2]; /* DECnet node address */
|
||||
} dne_remote;
|
||||
};
|
||||
|
||||
@ -46,8 +46,8 @@ typedef union etheraddress etheraddr; /* Ethernet address */
|
||||
|
||||
#define DN_MAXADDL 20 /* max size of DECnet address */
|
||||
struct dn_naddr {
|
||||
unsigned short a_len; /* length of address */
|
||||
unsigned char a_addr[DN_MAXADDL]; /* address as bytes */
|
||||
u_int16_t a_len; /* length of address */
|
||||
u_int8_t a_addr[DN_MAXADDL]; /* address as bytes */
|
||||
};
|
||||
|
||||
/*
|
||||
|
10
ether.h
10
ether.h
@ -1,4 +1,4 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/ether.h,v 1.3 2000-09-23 08:54:25 guy Exp $ (LBL) */
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/ether.h,v 1.4 2000-10-03 02:54:55 itojun Exp $ (LBL) */
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
@ -45,14 +45,14 @@
|
||||
* Ethernet address - 6 octets
|
||||
*/
|
||||
struct ether_addr {
|
||||
u_char ether_addr_octet[ETHER_ADDR_LEN];
|
||||
u_int8_t ether_addr_octet[ETHER_ADDR_LEN];
|
||||
};
|
||||
|
||||
/*
|
||||
* Structure of a 10Mb/s Ethernet header.
|
||||
*/
|
||||
struct ether_header {
|
||||
u_char ether_dhost[ETHER_ADDR_LEN];
|
||||
u_char ether_shost[ETHER_ADDR_LEN];
|
||||
u_short ether_type;
|
||||
u_int8_t ether_dhost[ETHER_ADDR_LEN];
|
||||
u_int8_t ether_shost[ETHER_ADDR_LEN];
|
||||
u_int16_t ether_type;
|
||||
};
|
||||
|
34
extract.h
34
extract.h
@ -18,40 +18,40 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/extract.h,v 1.15 1999-10-07 23:47:10 mcr Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/extract.h,v 1.16 2000-10-03 02:54:55 itojun Exp $ (LBL)
|
||||
*/
|
||||
|
||||
/* Network to host order macros */
|
||||
|
||||
#ifdef LBL_ALIGN
|
||||
#define EXTRACT_16BITS(p) \
|
||||
((u_short)*((u_char *)(p) + 0) << 8 | \
|
||||
(u_short)*((u_char *)(p) + 1))
|
||||
((u_int16_t)*((u_int8_t *)(p) + 0) << 8 | \
|
||||
(u_int16_t)*((u_int8_t *)(p) + 1))
|
||||
#define EXTRACT_32BITS(p) \
|
||||
((u_int32_t)*((u_char *)(p) + 0) << 24 | \
|
||||
(u_int32_t)*((u_char *)(p) + 1) << 16 | \
|
||||
(u_int32_t)*((u_char *)(p) + 2) << 8 | \
|
||||
(u_int32_t)*((u_char *)(p) + 3))
|
||||
((u_int32_t)*((u_int8_t *)(p) + 0) << 24 | \
|
||||
(u_int32_t)*((u_int8_t *)(p) + 1) << 16 | \
|
||||
(u_int32_t)*((u_int8_t *)(p) + 2) << 8 | \
|
||||
(u_int32_t)*((u_int8_t *)(p) + 3))
|
||||
#else
|
||||
#define EXTRACT_16BITS(p) \
|
||||
((u_short)ntohs(*(u_short *)(p)))
|
||||
((u_int16_t)ntohs(*(u_int16_t *)(p)))
|
||||
#define EXTRACT_32BITS(p) \
|
||||
((u_int32_t)ntohl(*(u_int32_t *)(p)))
|
||||
#endif
|
||||
|
||||
#define EXTRACT_24BITS(p) \
|
||||
((u_int32_t)*((u_char *)(p) + 0) << 16 | \
|
||||
(u_int32_t)*((u_char *)(p) + 1) << 8 | \
|
||||
(u_int32_t)*((u_char *)(p) + 2))
|
||||
((u_int32_t)*((u_int8_t *)(p) + 0) << 16 | \
|
||||
(u_int32_t)*((u_int8_t *)(p) + 1) << 8 | \
|
||||
(u_int32_t)*((u_int8_t *)(p) + 2))
|
||||
|
||||
/* Little endian protocol host order macros */
|
||||
|
||||
#define EXTRACT_LE_8BITS(p) (*(p))
|
||||
#define EXTRACT_LE_16BITS(p) \
|
||||
((u_short)*((u_char *)(p) + 1) << 8 | \
|
||||
(u_short)*((u_char *)(p) + 0))
|
||||
((u_int16_t)*((u_int8_t *)(p) + 1) << 8 | \
|
||||
(u_int16_t)*((u_int8_t *)(p) + 0))
|
||||
#define EXTRACT_LE_32BITS(p) \
|
||||
((u_int32_t)*((u_char *)(p) + 3) << 24 | \
|
||||
(u_int32_t)*((u_char *)(p) + 2) << 16 | \
|
||||
(u_int32_t)*((u_char *)(p) + 1) << 8 | \
|
||||
(u_int32_t)*((u_char *)(p) + 0))
|
||||
((u_int32_t)*((u_int8_t *)(p) + 3) << 24 | \
|
||||
(u_int32_t)*((u_int8_t *)(p) + 2) << 16 | \
|
||||
(u_int32_t)*((u_int8_t *)(p) + 1) << 8 | \
|
||||
(u_int32_t)*((u_int8_t *)(p) + 0))
|
||||
|
44
ip.h
44
ip.h
@ -1,4 +1,4 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/ip.h,v 1.4 2000-09-29 05:05:47 guy Exp $ (LBL) */
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/ip.h,v 1.5 2000-10-03 02:54:56 itojun Exp $ (LBL) */
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
@ -71,24 +71,19 @@
|
||||
* against negative integers quite easily, and fail in subtle ways.
|
||||
*/
|
||||
struct ip {
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
u_int ip_hl:4, /* header length */
|
||||
ip_v:4; /* version */
|
||||
#endif
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
u_int ip_v:4, /* version */
|
||||
ip_hl:4; /* header length */
|
||||
#endif
|
||||
u_char ip_tos; /* type of service */
|
||||
short ip_len; /* total length */
|
||||
u_short ip_id; /* identification */
|
||||
short ip_off; /* fragment offset field */
|
||||
u_int8_t ip_vhl; /* header length, version */
|
||||
#define IP_V(ip) (((ip)->ip_vhl & 0xf0) >> 4)
|
||||
#define IP_HL(ip) ((ip)->ip_vhl & 0x0f)
|
||||
u_int8_t ip_tos; /* type of service */
|
||||
u_int16_t ip_len; /* total length */
|
||||
u_int16_t ip_id; /* identification */
|
||||
u_int16_t ip_off; /* fragment offset field */
|
||||
#define IP_DF 0x4000 /* dont fragment flag */
|
||||
#define IP_MF 0x2000 /* more fragments flag */
|
||||
#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
|
||||
u_char ip_ttl; /* time to live */
|
||||
u_char ip_p; /* protocol */
|
||||
u_short ip_sum; /* checksum */
|
||||
u_int8_t ip_ttl; /* time to live */
|
||||
u_int8_t ip_p; /* protocol */
|
||||
u_int16_t ip_sum; /* checksum */
|
||||
struct in_addr ip_src,ip_dst; /* source and dest address */
|
||||
};
|
||||
|
||||
@ -147,17 +142,12 @@ struct ip {
|
||||
* Time stamp option structure.
|
||||
*/
|
||||
struct ip_timestamp {
|
||||
u_char ipt_code; /* IPOPT_TS */
|
||||
u_char ipt_len; /* size of structure (variable) */
|
||||
u_char ipt_ptr; /* index of current entry */
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
u_int ipt_flg:4, /* flags, see below */
|
||||
ipt_oflw:4; /* overflow counter */
|
||||
#endif
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
u_int ipt_oflw:4, /* overflow counter */
|
||||
ipt_flg:4; /* flags, see below */
|
||||
#endif
|
||||
u_int8_t ipt_code; /* IPOPT_TS */
|
||||
u_int8_t ipt_len; /* size of structure (variable) */
|
||||
u_int8_t ipt_ptr; /* index of current entry */
|
||||
u_int8_t ipt_flgoflw; /* flags, overflow counter */
|
||||
#define IPTS_FLG(ip) (((ipt)->ipt_flgoflw & 0xf0) >> 4)
|
||||
#define IPTS_OFLW(ip) ((ipt)->ipt_flgoflw & 0x0f)
|
||||
union ipt_timestamp {
|
||||
u_int32_t ipt_time[1];
|
||||
struct ipt_ta {
|
||||
|
22
ipx.h
22
ipx.h
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* IPX protocol formats
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/ipx.h,v 1.1 1999-10-07 23:47:10 mcr Exp $
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/ipx.h,v 1.2 2000-10-03 02:54:56 itojun Exp $
|
||||
*/
|
||||
|
||||
/* well-known sockets */
|
||||
@ -13,16 +13,16 @@
|
||||
|
||||
/* IPX transport header */
|
||||
struct ipxHdr {
|
||||
u_short cksum; /* Checksum */
|
||||
u_short length; /* Length, in bytes, including header */
|
||||
u_char tCtl; /* Transport Control (i.e. hop count) */
|
||||
u_char pType; /* Packet Type (i.e. level 2 protocol) */
|
||||
u_short dstNet[2]; /* destination net */
|
||||
u_char dstNode[6]; /* destination node */
|
||||
u_short dstSkt; /* destination socket */
|
||||
u_short srcNet[2]; /* source net */
|
||||
u_char srcNode[6]; /* source node */
|
||||
u_short srcSkt; /* source socket */
|
||||
u_int16_t cksum; /* Checksum */
|
||||
u_int16_t length; /* Length, in bytes, including header */
|
||||
u_int8_t tCtl; /* Transport Control (i.e. hop count) */
|
||||
u_int8_t pType; /* Packet Type (i.e. level 2 protocol) */
|
||||
u_int16_t dstNet[2]; /* destination net */
|
||||
u_int8_t dstNode[6]; /* destination node */
|
||||
u_int16_t dstSkt; /* destination socket */
|
||||
u_int16_t srcNet[2]; /* source net */
|
||||
u_int8_t srcNode[6]; /* source node */
|
||||
u_int16_t srcSkt; /* source socket */
|
||||
} ipx_hdr_t;
|
||||
|
||||
#define ipxSize 30
|
||||
|
22
l2tp.h
22
l2tp.h
@ -61,22 +61,22 @@
|
||||
|
||||
struct l2tp_avp_vec {
|
||||
const char *name;
|
||||
void (*print)(const u_char *, u_int);
|
||||
void (*print)(const u_char *, u_int32_t);
|
||||
};
|
||||
|
||||
struct l2tp_call_errors {
|
||||
u_short reserved;
|
||||
u_int crc_errs;
|
||||
u_int framing_errs;
|
||||
u_int hardware_overruns;
|
||||
u_int buffer_overruns;
|
||||
u_int timeout_errs;
|
||||
u_int alignment_errs;
|
||||
u_int16_t reserved;
|
||||
u_int32_t crc_errs;
|
||||
u_int32_t framing_errs;
|
||||
u_int32_t hardware_overruns;
|
||||
u_int32_t buffer_overruns;
|
||||
u_int32_t timeout_errs;
|
||||
u_int32_t alignment_errs;
|
||||
};
|
||||
|
||||
struct l2tp_accm {
|
||||
u_short reserved;
|
||||
u_int send_accm;
|
||||
u_int recv_accm;
|
||||
u_int16_t reserved;
|
||||
u_int32_t send_accm;
|
||||
u_int32_t recv_accm;
|
||||
};
|
||||
|
||||
|
10
lane.h
10
lane.h
@ -20,15 +20,15 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/* $Id: lane.h,v 1.2 1999-11-21 16:35:11 assar Exp $ */
|
||||
/* $Id: lane.h,v 1.3 2000-10-03 02:54:56 itojun Exp $ */
|
||||
|
||||
#ifndef ETHER_ADDR_LEN
|
||||
#define ETHER_ADDR_LEN 6
|
||||
#endif
|
||||
|
||||
struct lecdatahdr_8023 {
|
||||
u_short le_header;
|
||||
u_char h_dest[ETHER_ADDR_LEN];
|
||||
u_char h_source[ETHER_ADDR_LEN];
|
||||
u_short h_type;
|
||||
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;
|
||||
};
|
||||
|
20
llc.h
20
llc.h
@ -18,7 +18,7 @@
|
||||
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/llc.h,v 1.6 1999-10-07 23:47:10 mcr Exp $ (LBL)
|
||||
* @(#) $Header: /tcpdump/master/tcpdump/llc.h,v 1.7 2000-10-03 02:54:57 itojun Exp $ (LBL)
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -32,19 +32,19 @@
|
||||
*/
|
||||
|
||||
struct llc {
|
||||
u_char dsap;
|
||||
u_char ssap;
|
||||
u_int8_t dsap;
|
||||
u_int8_t ssap;
|
||||
union {
|
||||
u_char u_ctl;
|
||||
u_short is_ctl;
|
||||
u_int8_t u_ctl;
|
||||
u_int16_t is_ctl;
|
||||
struct {
|
||||
u_char snap_ui;
|
||||
u_char snap_pi[5];
|
||||
u_int8_t snap_ui;
|
||||
u_int8_t snap_pi[5];
|
||||
} snap;
|
||||
struct {
|
||||
u_char snap_ui;
|
||||
u_char snap_orgcode[3];
|
||||
u_char snap_ethertype[2];
|
||||
u_int8_t snap_ui;
|
||||
u_int8_t snap_orgcode[3];
|
||||
u_int8_t snap_ethertype[2];
|
||||
} snap_ether;
|
||||
} ctl;
|
||||
};
|
||||
|
6
ntp.h
6
ntp.h
@ -1,4 +1,4 @@
|
||||
/* $Header: /tcpdump/master/tcpdump/ntp.h,v 1.3 1999-10-07 23:47:11 mcr Exp $ */
|
||||
/* $Header: /tcpdump/master/tcpdump/ntp.h,v 1.4 2000-10-03 02:54:57 itojun Exp $ */
|
||||
|
||||
/*
|
||||
* Based on ntp.h from the U of MD implementation
|
||||
@ -33,8 +33,8 @@ struct l_fixedpt {
|
||||
};
|
||||
|
||||
struct s_fixedpt {
|
||||
u_short int_part;
|
||||
u_short fraction;
|
||||
u_int16_t int_part;
|
||||
u_int16_t fraction;
|
||||
};
|
||||
|
||||
/* ================= Table 3.3. Packet Variables ================= */
|
||||
|
52
ospf.h
52
ospf.h
@ -91,14 +91,14 @@
|
||||
|
||||
/* link state advertisement header */
|
||||
struct lsa_hdr {
|
||||
u_short ls_age;
|
||||
u_char ls_options;
|
||||
u_char ls_type;
|
||||
u_int16_t ls_age;
|
||||
u_int8_t ls_options;
|
||||
u_int8_t ls_type;
|
||||
struct in_addr ls_stateid;
|
||||
struct in_addr ls_router;
|
||||
u_int32_t ls_seq;
|
||||
u_short ls_chksum;
|
||||
u_short ls_length;
|
||||
u_int16_t ls_chksum;
|
||||
u_int16_t ls_length;
|
||||
} ;
|
||||
|
||||
/* link state advertisement */
|
||||
@ -109,15 +109,15 @@ struct lsa {
|
||||
union {
|
||||
/* Router links advertisements */
|
||||
struct {
|
||||
u_char rla_flags;
|
||||
u_char rla_zero[1];
|
||||
u_short rla_count;
|
||||
u_int8_t rla_flags;
|
||||
u_int8_t rla_zero[1];
|
||||
u_int16_t rla_count;
|
||||
struct rlalink {
|
||||
struct in_addr link_id;
|
||||
struct in_addr link_data;
|
||||
u_char link_type;
|
||||
u_char link_toscount;
|
||||
u_short link_tos0metric;
|
||||
u_int8_t link_type;
|
||||
u_int8_t link_toscount;
|
||||
u_int16_t link_tos0metric;
|
||||
} rla_link[1]; /* may repeat */
|
||||
} un_rla;
|
||||
|
||||
@ -156,9 +156,9 @@ struct lsa {
|
||||
* TOS metric struct (will be 0 or more in router links update)
|
||||
*/
|
||||
struct tos_metric {
|
||||
u_char tos_type;
|
||||
u_char tos_zero;
|
||||
u_short tos_metric;
|
||||
u_int8_t tos_type;
|
||||
u_int8_t tos_zero;
|
||||
u_int16_t tos_metric;
|
||||
} ;
|
||||
|
||||
#define OSPF_AUTH_SIZE 8
|
||||
@ -167,22 +167,22 @@ struct tos_metric {
|
||||
* the main header
|
||||
*/
|
||||
struct ospfhdr {
|
||||
u_char ospf_version;
|
||||
u_char ospf_type;
|
||||
u_short ospf_len;
|
||||
u_int8_t ospf_version;
|
||||
u_int8_t ospf_type;
|
||||
u_int16_t ospf_len;
|
||||
struct in_addr ospf_routerid;
|
||||
struct in_addr ospf_areaid;
|
||||
u_short ospf_chksum;
|
||||
u_short ospf_authtype;
|
||||
u_char ospf_authdata[OSPF_AUTH_SIZE];
|
||||
u_int16_t ospf_chksum;
|
||||
u_int16_t ospf_authtype;
|
||||
u_int8_t ospf_authdata[OSPF_AUTH_SIZE];
|
||||
union {
|
||||
|
||||
/* Hello packet */
|
||||
struct {
|
||||
struct in_addr hello_mask;
|
||||
u_short hello_helloint;
|
||||
u_char hello_options;
|
||||
u_char hello_priority;
|
||||
u_int16_t hello_helloint;
|
||||
u_int8_t hello_options;
|
||||
u_int8_t hello_priority;
|
||||
u_int32_t hello_deadint;
|
||||
struct in_addr hello_dr;
|
||||
struct in_addr hello_bdr;
|
||||
@ -191,9 +191,9 @@ struct ospfhdr {
|
||||
|
||||
/* Database Description packet */
|
||||
struct {
|
||||
u_char db_zero[2];
|
||||
u_char db_options;
|
||||
u_char db_flags;
|
||||
u_int8_t db_zero[2];
|
||||
u_int8_t db_options;
|
||||
u_int8_t db_flags;
|
||||
u_int32_t db_seq;
|
||||
struct lsa_hdr db_lshdr[1]; /* may repeat */
|
||||
} un_db;
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-esp.c,v 1.12 2000-10-03 02:19:04 itojun Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-esp.c,v 1.13 2000-10-03 02:54:58 itojun Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -157,7 +157,7 @@ esp_print(register const u_char *bp, register const u_char *bp2, int *nhdr)
|
||||
}
|
||||
|
||||
ip = (struct ip *)bp2;
|
||||
switch (ip->ip_v) {
|
||||
switch (IP_V(ip)) {
|
||||
#ifdef INET6
|
||||
case 6:
|
||||
ip6 = (struct ip6_hdr *)bp2;
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.53 2000-09-29 04:58:39 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-icmp.c,v 1.54 2000-10-03 02:54:58 itojun Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -114,7 +114,7 @@ struct icmp {
|
||||
#define ICMP_TSLEN (8 + 3 * sizeof (u_int)) /* timestamp */
|
||||
#define ICMP_MASKLEN 12 /* address mask */
|
||||
#define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */
|
||||
#define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8)
|
||||
#define ICMP_ADVLEN(p) (8 + (IP_HL(&(p)->icmp_ip) << 2) + 8)
|
||||
/* N.B.: must separately check that ip_hl >= 5 */
|
||||
|
||||
/*
|
||||
@ -306,7 +306,7 @@ icmp_print(register const u_char *bp, u_int plen, register const u_char *bp2)
|
||||
case ICMP_UNREACH_PORT:
|
||||
TCHECK(dp->icmp_ip.ip_p);
|
||||
oip = &dp->icmp_ip;
|
||||
hlen = oip->ip_hl * 4;
|
||||
hlen = IP_HL(oip) * 4;
|
||||
ouh = (struct udphdr *)(((u_char *)oip) + hlen);
|
||||
dport = ntohs(ouh->uh_dport);
|
||||
switch (oip->ip_p) {
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.88 2000-09-29 04:58:40 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.89 2000-10-03 02:54:58 itojun Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -443,7 +443,7 @@ ip_print(register const u_char *bp, register u_int length)
|
||||
(void)printf("truncated-ip %d", length);
|
||||
return;
|
||||
}
|
||||
hlen = ip->ip_hl * 4;
|
||||
hlen = IP_HL(ip) * 4;
|
||||
if (hlen < sizeof (struct ip)) {
|
||||
(void)printf("bad-hlen %d", hlen);
|
||||
return;
|
||||
@ -736,7 +736,7 @@ ipN_print(register const u_char *bp, register u_int length)
|
||||
return;
|
||||
}
|
||||
memcpy (&hdr, (char *)ip, 4);
|
||||
switch (hdr.ip_v) {
|
||||
switch (IP_V(&hdr)) {
|
||||
case 4:
|
||||
ip_print (bp, length);
|
||||
return;
|
||||
@ -746,7 +746,7 @@ ipN_print(register const u_char *bp, register u_int length)
|
||||
return;
|
||||
#endif
|
||||
default:
|
||||
(void)printf("unknown ip %d", hdr.ip_v);
|
||||
(void)printf("unknown ip %d", IP_V(&hdr));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-isakmp.c,v 1.21 2000-09-29 04:58:42 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-isakmp.c,v 1.22 2000-10-03 02:54:59 itojun Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -200,7 +200,7 @@ cookie_record(cookie_t *in, const u_char *bp2)
|
||||
}
|
||||
|
||||
ip = (struct ip *)bp2;
|
||||
switch (ip->ip_v) {
|
||||
switch (IP_V(ip)) {
|
||||
case 4:
|
||||
memset(&cookiecache[ninitiator].iaddr, 0,
|
||||
sizeof(cookiecache[ninitiator].iaddr));
|
||||
@ -266,7 +266,7 @@ cookie_sidecheck(int i, const u_char *bp2, int initiator)
|
||||
|
||||
memset(&ss, 0, sizeof(ss));
|
||||
ip = (struct ip *)bp2;
|
||||
switch (ip->ip_v) {
|
||||
switch (IP_V(ip)) {
|
||||
case 4:
|
||||
sin = (struct sockaddr_in *)&ss;
|
||||
#ifdef HAVE_SOCKADDR_SA_LEN
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.85 2000-09-29 04:58:44 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-nfs.c,v 1.86 2000-10-03 02:54:59 itojun Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -226,7 +226,7 @@ print_nfsaddr(const u_char *bp, const char *s, const char *d)
|
||||
#endif
|
||||
|
||||
srcaddr[0] = dstaddr[0] = '\0';
|
||||
switch (((struct ip *)bp)->ip_v) {
|
||||
switch (IP_V((struct ip *)bp)) {
|
||||
case 4:
|
||||
ip = (struct ip *)bp;
|
||||
strlcpy(srcaddr, ipaddr_string(&ip->ip_src), sizeof(srcaddr));
|
||||
@ -827,7 +827,7 @@ xid_map_enter(const struct rpc_msg *rp, const u_char *bp)
|
||||
#endif
|
||||
struct xid_map_entry *xmep;
|
||||
|
||||
switch (((struct ip *)bp)->ip_v) {
|
||||
switch (IP_V((struct ip *)bp)) {
|
||||
case 4:
|
||||
ip = (struct ip *)bp;
|
||||
break;
|
||||
@ -884,7 +884,7 @@ xid_map_find(const struct rpc_msg *rp, const u_char *bp, u_int32_t *proc,
|
||||
do {
|
||||
xmep = &xid_map[i];
|
||||
cmp = 1;
|
||||
if (xmep->ipver != ip->ip_v || xmep->xid != xid)
|
||||
if (xmep->ipver != IP_V(ip) || xmep->xid != xid)
|
||||
goto nextitem;
|
||||
switch (xmep->ipver) {
|
||||
case 4:
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.36 2000-09-29 04:58:44 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.37 2000-10-03 02:55:00 itojun Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -119,7 +119,7 @@ null_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
if (eflag)
|
||||
null_print(p, ip, length);
|
||||
|
||||
switch (ip->ip_v) {
|
||||
switch (IP_V(ip)) {
|
||||
case 4:
|
||||
ip_print((const u_char *)ip, length);
|
||||
break;
|
||||
@ -129,7 +129,7 @@ null_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
break;
|
||||
#endif /* INET6 */
|
||||
default:
|
||||
printf("ip v%d", ip->ip_v);
|
||||
printf("ip v%d", IP_V(ip));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.22 2000-09-29 04:58:45 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.23 2000-10-03 02:55:00 itojun Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -634,7 +634,7 @@ pimv2_print(register const u_char *bp, register u_int len)
|
||||
if (bp >= ep)
|
||||
break;
|
||||
ip = (struct ip *)bp;
|
||||
switch (ip->ip_v) {
|
||||
switch (IP_V(ip)) {
|
||||
case 4: /* IPv4 */
|
||||
printf(" ");
|
||||
ip_print(bp, len);
|
||||
@ -646,7 +646,7 @@ pimv2_print(register const u_char *bp, register u_int len)
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
(void)printf(" IP ver %d", ip->ip_v);
|
||||
(void)printf(" IP ver %d", IP_V(ip));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
10
print-sl.c
10
print-sl.c
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-sl.c,v 1.53 2000-10-03 02:26:53 itojun Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-sl.c,v 1.54 2000-10-03 02:55:01 itojun Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -101,7 +101,7 @@ sl_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
if (eflag)
|
||||
sliplink_print(p, ip, length);
|
||||
|
||||
switch (ip->ip_v) {
|
||||
switch (IP_V(ip)) {
|
||||
case 4:
|
||||
ip_print((u_char *)ip, length);
|
||||
break;
|
||||
@ -111,7 +111,7 @@ sl_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
printf ("ip v%d", ip->ip_v);
|
||||
printf ("ip v%d", IP_V(ip));
|
||||
}
|
||||
|
||||
if (xflag)
|
||||
@ -192,7 +192,7 @@ sliplink_print(register const u_char *p, register const struct ip *ip,
|
||||
* has restored the IP header copy to IPPROTO_TCP.
|
||||
*/
|
||||
lastconn = ((struct ip *)&p[SLX_CHDR])->ip_p;
|
||||
hlen = ip->ip_hl;
|
||||
hlen = IP_HL(ip);
|
||||
hlen += TH_OFF((struct tcphdr *)&((int *)ip)[hlen]);
|
||||
lastlen[dir][lastconn] = length - (hlen << 2);
|
||||
printf("utcp %d: ", lastconn);
|
||||
@ -282,7 +282,7 @@ compressed_sl_print(const u_char *chdr, const struct ip *ip,
|
||||
* 'cp - chdr' is the length of the compressed header.
|
||||
* 'length - hlen' is the amount of data in the packet.
|
||||
*/
|
||||
hlen = ip->ip_hl;
|
||||
hlen = IP_HL(ip);
|
||||
hlen += TH_OFF((struct tcphdr *)&((int32_t *)ip)[hlen]);
|
||||
lastlen[dir][lastconn] = length - (hlen << 2);
|
||||
printf(" %d (%d)", lastlen[dir][lastconn], cp - chdr);
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-sunrpc.c,v 1.37 2000-09-29 04:58:50 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-sunrpc.c,v 1.38 2000-10-03 02:55:01 itojun Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -93,7 +93,7 @@ sunrpcrequest_print(register const u_char *bp, register u_int length,
|
||||
snprintf(dstid, sizeof(dstid), "0x%x", PMAPPORT);
|
||||
}
|
||||
|
||||
switch (((struct ip *)bp2)->ip_v) {
|
||||
switch (IP_V((struct ip *)bp2)) {
|
||||
case 4:
|
||||
ip = (struct ip *)bp2;
|
||||
printf("%s.%s > %s.%s: %d",
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-tcp.c,v 1.77 2000-10-03 02:26:53 itojun Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-tcp.c,v 1.78 2000-10-03 02:55:01 itojun Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -247,7 +247,7 @@ tcp_print(register const u_char *bp, register u_int length,
|
||||
tp = (struct tcphdr *)bp;
|
||||
ip = (struct ip *)bp2;
|
||||
#ifdef INET6
|
||||
if (ip->ip_v == 6)
|
||||
if (IP_V(ip) == 6)
|
||||
ip6 = (struct ip6_hdr *)bp2;
|
||||
else
|
||||
ip6 = NULL;
|
||||
@ -445,7 +445,7 @@ tcp_print(register const u_char *bp, register u_int length,
|
||||
return;
|
||||
}
|
||||
|
||||
if (ip->ip_v == 4 && vflag) {
|
||||
if (IP_V(ip) == 4 && vflag) {
|
||||
int sum;
|
||||
if (TTEST2(tp->th_sport, length)) {
|
||||
sum = tcp_cksum(ip, tp, length);
|
||||
@ -456,7 +456,7 @@ tcp_print(register const u_char *bp, register u_int length,
|
||||
}
|
||||
}
|
||||
#ifdef INET6
|
||||
if (ip->ip_v == 6 && ip6->ip6_plen && vflag) {
|
||||
if (IP_V(ip) == 6 && ip6->ip6_plen && vflag) {
|
||||
int sum;
|
||||
if (TTEST2(tp->th_sport, length)) {
|
||||
sum = tcp6_cksum(ip6, tp, length);
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-udp.c,v 1.80 2000-09-29 04:58:52 guy Exp $ (LBL)";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-udp.c,v 1.81 2000-10-03 02:55:02 itojun Exp $ (LBL)";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -427,7 +427,7 @@ udp_print(register const u_char *bp, u_int length, register const u_char *bp2)
|
||||
up = (struct udphdr *)bp;
|
||||
ip = (struct ip *)bp2;
|
||||
#ifdef INET6
|
||||
if (ip->ip_v == 6)
|
||||
if (IP_V(ip) == 6)
|
||||
ip6 = (struct ip6_hdr *)bp2;
|
||||
else
|
||||
ip6 = NULL;
|
||||
@ -597,7 +597,7 @@ udp_print(register const u_char *bp, u_int length, register const u_char *bp2)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ip->ip_v == 4 && vflag) {
|
||||
if (IP_V(ip) == 4 && vflag) {
|
||||
int sum = up->uh_sum;
|
||||
if (sum == 0) {
|
||||
(void)printf(" [no cksum]");
|
||||
@ -610,7 +610,7 @@ udp_print(register const u_char *bp, u_int length, register const u_char *bp2)
|
||||
}
|
||||
}
|
||||
#ifdef INET6
|
||||
if (ip->ip_v == 6 && ip6->ip6_plen && vflag) {
|
||||
if (IP_V(ip) == 6 && ip6->ip6_plen && vflag) {
|
||||
int sum = up->uh_sum;
|
||||
/* for IPv6, UDP checksum is mandatory */
|
||||
if (TTEST2(cp[0], length)) {
|
||||
|
24
rx.h
24
rx.h
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Rx protocol format
|
||||
*
|
||||
* $Id: rx.h,v 1.2 2000-02-08 20:57:07 kenh Exp $
|
||||
* $Id: rx.h,v 1.3 2000-10-03 02:55:02 itojun Exp $
|
||||
*/
|
||||
|
||||
#define FS_RX_PORT 7000
|
||||
@ -40,7 +40,7 @@ struct rx_header {
|
||||
u_int32_t callNumber;
|
||||
u_int32_t seq;
|
||||
u_int32_t serial;
|
||||
u_char type;
|
||||
u_int8_t type;
|
||||
#define RX_PACKET_TYPE_DATA 1
|
||||
#define RX_PACKET_TYPE_ACK 2
|
||||
#define RX_PACKET_TYPE_BUSY 3
|
||||
@ -51,16 +51,16 @@ struct rx_header {
|
||||
#define RX_PACKET_TYPE_DEBUG 8
|
||||
#define RX_PACKET_TYPE_PARAMS 9
|
||||
#define RX_PACKET_TYPE_VERSION 13
|
||||
u_char flags;
|
||||
u_int8_t flags;
|
||||
#define RX_CLIENT_INITIATED 1
|
||||
#define RX_REQUEST_ACK 2
|
||||
#define RX_LAST_PACKET 4
|
||||
#define RX_MORE_PACKETS 8
|
||||
#define RX_FREE_PACKET 16
|
||||
u_char userStatus;
|
||||
u_char securityIndex;
|
||||
u_short spare; /* How clever: even though the AFS */
|
||||
u_short serviceId; /* header files indicate that the */
|
||||
u_int8_t userStatus;
|
||||
u_int8_t securityIndex;
|
||||
u_int16_t spare; /* How clever: even though the AFS */
|
||||
u_int16_t serviceId; /* header files indicate that the */
|
||||
}; /* serviceId is first, it's really */
|
||||
/* encoded _after_ the spare field */
|
||||
/* I wasted a day figuring that out! */
|
||||
@ -70,15 +70,15 @@ struct rx_header {
|
||||
#define RX_MAXACKS 255
|
||||
|
||||
struct rx_ackPacket {
|
||||
u_short bufferSpace; /* Number of packet buffers available */
|
||||
u_short maxSkew; /* Max diff between ack'd packet and */
|
||||
u_int16_t bufferSpace; /* Number of packet buffers available */
|
||||
u_int16_t maxSkew; /* Max diff between ack'd packet and */
|
||||
/* highest packet received */
|
||||
u_int32_t firstPacket; /* The first packet in ack list */
|
||||
u_int32_t previousPacket; /* Previous packet recv'd (obsolete) */
|
||||
u_int32_t serial; /* # of packet that prompted the ack */
|
||||
u_char reason; /* Reason for acknowledgement */
|
||||
u_char nAcks; /* Number of acknowledgements */
|
||||
u_char acks[RX_MAXACKS]; /* Up to RX_MAXACKS acknowledgements */
|
||||
u_int8_t reason; /* Reason for acknowledgement */
|
||||
u_int8_t nAcks; /* Number of acknowledgements */
|
||||
u_int8_t acks[RX_MAXACKS]; /* Up to RX_MAXACKS acknowledgements */
|
||||
};
|
||||
|
||||
/*
|
||||
|
22
tcp.h
22
tcp.h
@ -1,4 +1,4 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/tcp.h,v 1.4 2000-10-03 02:26:53 itojun Exp $ (LBL) */
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/tcp.h,v 1.5 2000-10-03 02:55:02 itojun Exp $ (LBL) */
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
@ -57,28 +57,28 @@
|
||||
#error "Undefined or invalid BYTE_ORDER";
|
||||
#endif
|
||||
|
||||
typedef u_int tcp_seq;
|
||||
typedef u_int32_t tcp_seq;
|
||||
/*
|
||||
* TCP header.
|
||||
* Per RFC 793, September, 1981.
|
||||
*/
|
||||
struct tcphdr {
|
||||
u_short th_sport; /* source port */
|
||||
u_short th_dport; /* destination port */
|
||||
tcp_seq th_seq; /* sequence number */
|
||||
tcp_seq th_ack; /* acknowledgement number */
|
||||
u_char th_x2off;
|
||||
u_int16_t th_sport; /* source port */
|
||||
u_int16_t th_dport; /* destination port */
|
||||
tcp_seq th_seq; /* sequence number */
|
||||
tcp_seq th_ack; /* acknowledgement number */
|
||||
u_int8_t th_x2off;
|
||||
#define TH_OFF(th) ((th)->th_x2off & 0x0f) /* data offset, th_off */
|
||||
u_char th_flags;
|
||||
u_int8_t th_flags;
|
||||
#define TH_FIN 0x01
|
||||
#define TH_SYN 0x02
|
||||
#define TH_RST 0x04
|
||||
#define TH_PUSH 0x08
|
||||
#define TH_ACK 0x10
|
||||
#define TH_URG 0x20
|
||||
u_short th_win; /* window */
|
||||
u_short th_sum; /* checksum */
|
||||
u_short th_urp; /* urgent pointer */
|
||||
u_int16_t th_win; /* window */
|
||||
u_int16_t th_sum; /* checksum */
|
||||
u_int16_t th_urp; /* urgent pointer */
|
||||
};
|
||||
|
||||
#define TCPOPT_EOL 0
|
||||
|
14
token.h
14
token.h
@ -1,4 +1,4 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/token.h,v 1.2 2000-09-18 04:40:46 guy Exp $ (LBL) */
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/token.h,v 1.3 2000-10-03 02:55:03 itojun Exp $ (LBL) */
|
||||
/*
|
||||
* Copyright (c) 1998, Larry Lile
|
||||
* All rights reserved.
|
||||
@ -43,10 +43,10 @@
|
||||
#define SEGMENT_COUNT(trp) ((RIF_LENGTH(trp) - 2) / 2)
|
||||
|
||||
struct token_header {
|
||||
u_char token_ac;
|
||||
u_char token_fc;
|
||||
u_char token_dhost[TOKEN_RING_MAC_LEN];
|
||||
u_char token_shost[TOKEN_RING_MAC_LEN];
|
||||
u_short token_rcf;
|
||||
u_short token_rseg[ROUTING_SEGMENT_MAX];
|
||||
u_int8_t token_ac;
|
||||
u_int8_t token_fc;
|
||||
u_int8_t token_dhost[TOKEN_RING_MAC_LEN];
|
||||
u_int8_t token_shost[TOKEN_RING_MAC_LEN];
|
||||
u_int16_t token_rcf;
|
||||
u_int16_t token_rseg[ROUTING_SEGMENT_MAX];
|
||||
};
|
||||
|
10
udp.h
10
udp.h
@ -1,4 +1,4 @@
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/udp.h,v 1.1 2000-09-23 08:26:39 guy Exp $ (LBL) */
|
||||
/* @(#) $Header: /tcpdump/master/tcpdump/udp.h,v 1.2 2000-10-03 02:55:03 itojun Exp $ (LBL) */
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
@ -39,8 +39,8 @@
|
||||
* Per RFC 768, September, 1981.
|
||||
*/
|
||||
struct udphdr {
|
||||
u_short uh_sport; /* source port */
|
||||
u_short uh_dport; /* destination port */
|
||||
short uh_ulen; /* udp length */
|
||||
u_short uh_sum; /* udp checksum */
|
||||
u_int16_t uh_sport; /* source port */
|
||||
u_int16_t uh_dport; /* destination port */
|
||||
u_int16_t uh_ulen; /* udp length */
|
||||
u_int16_t uh_sum; /* udp checksum */
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user