From: Guy Harris Date: Wed, 23 Apr 2014 07:45:13 +0000 (-0700) Subject: More getting rid of old u_intN_t. X-Git-Tag: tcpdump-4.6.0~66 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/dbddfda2c806a98b1fc8fd86cc3c34a4f9915d70 More getting rid of old u_intN_t. --- diff --git a/Makefile.in b/Makefile.in index bac05dd1..e027970a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -341,7 +341,6 @@ EXTRA_DIST = \ strcasecmp.c \ tcpdump.1.in \ vfprintf.c \ - win32/Include/bittypes.h \ win32/Include/errno.h \ win32/Include/getopt.h \ win32/Include/w32_fzs.h \ diff --git a/addrtoname.h b/addrtoname.h index bdbcf369..252c570e 100644 --- a/addrtoname.h +++ b/addrtoname.h @@ -44,9 +44,9 @@ extern const char *getname(netdissect_options *, const u_char *); #ifdef INET6 extern const char *getname6(netdissect_options *, const u_char *); #endif -extern const char *intoa(u_int32_t); +extern const char *intoa(uint32_t); -extern void init_addrtoname(netdissect_options *, u_int32_t, u_int32_t); +extern void init_addrtoname(netdissect_options *, uint32_t, uint32_t); extern struct hnamemem *newhnamemem(void); #ifdef INET6 extern struct h6namemem *newh6namemem(void); diff --git a/ah.h b/ah.h index c22806af..5219e54c 100644 --- a/ah.h +++ b/ah.h @@ -38,19 +38,19 @@ #define _NETINET6_AH_H_ struct ah { - u_int8_t ah_nxt; /* Next Header */ - u_int8_t ah_len; /* Length of data, in 32bit */ - u_int16_t ah_reserve; /* Reserved for future use */ - u_int32_t ah_spi; /* Security parameter index */ + uint8_t ah_nxt; /* Next Header */ + uint8_t ah_len; /* Length of data, in 32bit */ + uint16_t ah_reserve; /* Reserved for future use */ + uint32_t ah_spi; /* Security parameter index */ /* variable size, 32bit bound*/ /* Authentication data */ }; struct newah { - u_int8_t ah_nxt; /* Next Header */ - u_int8_t ah_len; /* Length of data + 1, in 32bit */ - u_int16_t ah_reserve; /* Reserved for future use */ - u_int32_t ah_spi; /* Security parameter index */ - u_int32_t ah_seq; /* Sequence number field */ + uint8_t ah_nxt; /* Next Header */ + uint8_t ah_len; /* Length of data + 1, in 32bit */ + uint16_t ah_reserve; /* Reserved for future use */ + uint32_t ah_spi; /* Security parameter index */ + uint32_t ah_seq; /* Sequence number field */ /* variable size, 32bit bound*/ /* Authentication data */ }; diff --git a/appletalk.h b/appletalk.h index 06677767..a4ef1d56 100644 --- a/appletalk.h +++ b/appletalk.h @@ -22,9 +22,9 @@ */ struct LAP { - u_int8_t dst; - u_int8_t src; - u_int8_t type; + uint8_t dst; + uint8_t src; + uint8_t type; }; #define lapShortDDP 1 /* short DDP type */ #define lapDDP 2 /* DDP type */ @@ -33,22 +33,22 @@ struct LAP { /* Datagram Delivery Protocol */ struct atDDP { - 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; + uint16_t length; + uint16_t checksum; + uint16_t dstNet; + uint16_t srcNet; + uint8_t dstNode; + uint8_t srcNode; + uint8_t dstSkt; + uint8_t srcSkt; + uint8_t type; }; struct atShortDDP { - u_int16_t length; - u_int8_t dstSkt; - u_int8_t srcSkt; - u_int8_t type; + uint16_t length; + uint8_t dstSkt; + uint8_t srcSkt; + uint8_t type; }; #define ddpMaxWKS 0x7F @@ -72,9 +72,9 @@ struct atShortDDP { /* AppleTalk Transaction Protocol */ struct atATP { - u_int8_t control; - u_int8_t bitmap; - u_int16_t transID; + uint8_t control; + uint8_t bitmap; + uint16_t transID; int32_t userData; }; @@ -93,8 +93,8 @@ struct atATP { /* AppleTalk Echo Protocol */ struct atEcho { - u_int8_t echoFunction; - u_int8_t *echoData; + uint8_t echoFunction; + uint8_t *echoData; }; #define echoSkt 4 /* the echoer socket */ @@ -106,15 +106,15 @@ struct atEcho { /* Name Binding Protocol */ struct atNBP { - u_int8_t control; - u_int8_t id; + uint8_t control; + uint8_t id; }; struct atNBPtuple { - u_int16_t net; - u_int8_t node; - u_int8_t skt; - u_int8_t enumerator; + uint16_t net; + uint8_t node; + uint8_t skt; + uint8_t enumerator; }; #define nbpBrRq 0x10 @@ -140,8 +140,8 @@ struct atNBPtuple { /* Zone Information Protocol */ struct zipHeader { - u_int8_t command; - u_int8_t netcount; + uint8_t command; + uint8_t netcount; }; #define zipHeaderSize 2 diff --git a/bootp.h b/bootp.h index 4420f2b3..db2e5b6a 100644 --- a/bootp.h +++ b/bootp.h @@ -20,22 +20,22 @@ struct bootp { - 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 */ - u_int16_t bp_secs; /* seconds since boot began */ - u_int16_t bp_flags; /* flags - see bootp_flag_values[] + uint8_t bp_op; /* packet opcode type */ + uint8_t bp_htype; /* hardware addr type */ + uint8_t bp_hlen; /* hardware addr length */ + uint8_t bp_hops; /* gateway hops */ + uint32_t bp_xid; /* transaction ID */ + uint16_t bp_secs; /* seconds since boot began */ + uint16_t bp_flags; /* flags - see bootp_flag_values[] in print-bootp.c */ 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 */ - 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 */ + uint8_t bp_chaddr[16]; /* client hardware address */ + uint8_t bp_sname[64]; /* server host name */ + uint8_t bp_file[128]; /* boot file name */ + uint8_t bp_vend[64]; /* vendor-specific area */ } UNALIGNED; /* @@ -64,132 +64,132 @@ struct bootp { * the vendor field of the packet. */ -#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) +#define TAG_PAD ((uint8_t) 0) +#define TAG_SUBNET_MASK ((uint8_t) 1) +#define TAG_TIME_OFFSET ((uint8_t) 2) +#define TAG_GATEWAY ((uint8_t) 3) +#define TAG_TIME_SERVER ((uint8_t) 4) +#define TAG_NAME_SERVER ((uint8_t) 5) +#define TAG_DOMAIN_SERVER ((uint8_t) 6) +#define TAG_LOG_SERVER ((uint8_t) 7) +#define TAG_COOKIE_SERVER ((uint8_t) 8) +#define TAG_LPR_SERVER ((uint8_t) 9) +#define TAG_IMPRESS_SERVER ((uint8_t) 10) +#define TAG_RLP_SERVER ((uint8_t) 11) +#define TAG_HOSTNAME ((uint8_t) 12) +#define TAG_BOOTSIZE ((uint8_t) 13) +#define TAG_END ((uint8_t) 255) /* RFC1497 tags */ -#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) +#define TAG_DUMPPATH ((uint8_t) 14) +#define TAG_DOMAINNAME ((uint8_t) 15) +#define TAG_SWAP_SERVER ((uint8_t) 16) +#define TAG_ROOTPATH ((uint8_t) 17) +#define TAG_EXTPATH ((uint8_t) 18) /* RFC2132 */ -#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) +#define TAG_IP_FORWARD ((uint8_t) 19) +#define TAG_NL_SRCRT ((uint8_t) 20) +#define TAG_PFILTERS ((uint8_t) 21) +#define TAG_REASS_SIZE ((uint8_t) 22) +#define TAG_DEF_TTL ((uint8_t) 23) +#define TAG_MTU_TIMEOUT ((uint8_t) 24) +#define TAG_MTU_TABLE ((uint8_t) 25) +#define TAG_INT_MTU ((uint8_t) 26) +#define TAG_LOCAL_SUBNETS ((uint8_t) 27) +#define TAG_BROAD_ADDR ((uint8_t) 28) +#define TAG_DO_MASK_DISC ((uint8_t) 29) +#define TAG_SUPPLY_MASK ((uint8_t) 30) +#define TAG_DO_RDISC ((uint8_t) 31) +#define TAG_RTR_SOL_ADDR ((uint8_t) 32) +#define TAG_STATIC_ROUTE ((uint8_t) 33) +#define TAG_USE_TRAILERS ((uint8_t) 34) +#define TAG_ARP_TIMEOUT ((uint8_t) 35) +#define TAG_ETH_ENCAP ((uint8_t) 36) +#define TAG_TCP_TTL ((uint8_t) 37) +#define TAG_TCP_KEEPALIVE ((uint8_t) 38) +#define TAG_KEEPALIVE_GO ((uint8_t) 39) +#define TAG_NIS_DOMAIN ((uint8_t) 40) +#define TAG_NIS_SERVERS ((uint8_t) 41) +#define TAG_NTP_SERVERS ((uint8_t) 42) +#define TAG_VENDOR_OPTS ((uint8_t) 43) +#define TAG_NETBIOS_NS ((uint8_t) 44) +#define TAG_NETBIOS_DDS ((uint8_t) 45) +#define TAG_NETBIOS_NODE ((uint8_t) 46) +#define TAG_NETBIOS_SCOPE ((uint8_t) 47) +#define TAG_XWIN_FS ((uint8_t) 48) +#define TAG_XWIN_DM ((uint8_t) 49) +#define TAG_NIS_P_DOMAIN ((uint8_t) 64) +#define TAG_NIS_P_SERVERS ((uint8_t) 65) +#define TAG_MOBILE_HOME ((uint8_t) 68) +#define TAG_SMPT_SERVER ((uint8_t) 69) +#define TAG_POP3_SERVER ((uint8_t) 70) +#define TAG_NNTP_SERVER ((uint8_t) 71) +#define TAG_WWW_SERVER ((uint8_t) 72) +#define TAG_FINGER_SERVER ((uint8_t) 73) +#define TAG_IRC_SERVER ((uint8_t) 74) +#define TAG_STREETTALK_SRVR ((uint8_t) 75) +#define TAG_STREETTALK_STDA ((uint8_t) 76) /* DHCP options */ -#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) +#define TAG_REQUESTED_IP ((uint8_t) 50) +#define TAG_IP_LEASE ((uint8_t) 51) +#define TAG_OPT_OVERLOAD ((uint8_t) 52) +#define TAG_TFTP_SERVER ((uint8_t) 66) +#define TAG_BOOTFILENAME ((uint8_t) 67) +#define TAG_DHCP_MESSAGE ((uint8_t) 53) +#define TAG_SERVER_ID ((uint8_t) 54) +#define TAG_PARM_REQUEST ((uint8_t) 55) +#define TAG_MESSAGE ((uint8_t) 56) +#define TAG_MAX_MSG_SIZE ((uint8_t) 57) +#define TAG_RENEWAL_TIME ((uint8_t) 58) +#define TAG_REBIND_TIME ((uint8_t) 59) +#define TAG_VENDOR_CLASS ((uint8_t) 60) +#define TAG_CLIENT_ID ((uint8_t) 61) /* RFC 2241 */ -#define TAG_NDS_SERVERS ((u_int8_t) 85) -#define TAG_NDS_TREE_NAME ((u_int8_t) 86) -#define TAG_NDS_CONTEXT ((u_int8_t) 87) +#define TAG_NDS_SERVERS ((uint8_t) 85) +#define TAG_NDS_TREE_NAME ((uint8_t) 86) +#define TAG_NDS_CONTEXT ((uint8_t) 87) /* RFC 2242 */ -#define TAG_NDS_IPDOMAIN ((u_int8_t) 62) -#define TAG_NDS_IPINFO ((u_int8_t) 63) +#define TAG_NDS_IPDOMAIN ((uint8_t) 62) +#define TAG_NDS_IPINFO ((uint8_t) 63) /* RFC 2485 */ -#define TAG_OPEN_GROUP_UAP ((u_int8_t) 98) +#define TAG_OPEN_GROUP_UAP ((uint8_t) 98) /* RFC 2563 */ -#define TAG_DISABLE_AUTOCONF ((u_int8_t) 116) +#define TAG_DISABLE_AUTOCONF ((uint8_t) 116) /* RFC 2610 */ -#define TAG_SLP_DA ((u_int8_t) 78) -#define TAG_SLP_SCOPE ((u_int8_t) 79) +#define TAG_SLP_DA ((uint8_t) 78) +#define TAG_SLP_SCOPE ((uint8_t) 79) /* RFC 2937 */ -#define TAG_NS_SEARCH ((u_int8_t) 117) +#define TAG_NS_SEARCH ((uint8_t) 117) /* RFC 3011 */ -#define TAG_IP4_SUBNET_SELECT ((u_int8_t) 118) +#define TAG_IP4_SUBNET_SELECT ((uint8_t) 118) /* RFC 3442 */ -#define TAG_CLASSLESS_STATIC_RT ((u_int8_t) 121) -#define TAG_CLASSLESS_STA_RT_MS ((u_int8_t) 249) +#define TAG_CLASSLESS_STATIC_RT ((uint8_t) 121) +#define TAG_CLASSLESS_STA_RT_MS ((uint8_t) 249) /* ftp://ftp.isi.edu/.../assignments/bootp-dhcp-extensions */ -#define TAG_USER_CLASS ((u_int8_t) 77) -#define TAG_SLP_NAMING_AUTH ((u_int8_t) 80) -#define TAG_CLIENT_FQDN ((u_int8_t) 81) -#define TAG_AGENT_CIRCUIT ((u_int8_t) 82) -#define TAG_AGENT_REMOTE ((u_int8_t) 83) -#define TAG_AGENT_MASK ((u_int8_t) 84) -#define TAG_TZ_STRING ((u_int8_t) 88) -#define TAG_FQDN_OPTION ((u_int8_t) 89) -#define TAG_AUTH ((u_int8_t) 90) -#define TAG_VINES_SERVERS ((u_int8_t) 91) -#define TAG_SERVER_RANK ((u_int8_t) 92) -#define TAG_CLIENT_ARCH ((u_int8_t) 93) -#define TAG_CLIENT_NDI ((u_int8_t) 94) -#define TAG_CLIENT_GUID ((u_int8_t) 97) -#define TAG_LDAP_URL ((u_int8_t) 95) -#define TAG_6OVER4 ((u_int8_t) 96) -#define TAG_PRINTER_NAME ((u_int8_t) 100) -#define TAG_MDHCP_SERVER ((u_int8_t) 101) -#define TAG_IPX_COMPAT ((u_int8_t) 110) -#define TAG_NETINFO_PARENT ((u_int8_t) 112) -#define TAG_NETINFO_PARENT_TAG ((u_int8_t) 113) -#define TAG_URL ((u_int8_t) 114) -#define TAG_FAILOVER ((u_int8_t) 115) -#define TAG_EXTENDED_REQUEST ((u_int8_t) 126) -#define TAG_EXTENDED_OPTION ((u_int8_t) 127) +#define TAG_USER_CLASS ((uint8_t) 77) +#define TAG_SLP_NAMING_AUTH ((uint8_t) 80) +#define TAG_CLIENT_FQDN ((uint8_t) 81) +#define TAG_AGENT_CIRCUIT ((uint8_t) 82) +#define TAG_AGENT_REMOTE ((uint8_t) 83) +#define TAG_AGENT_MASK ((uint8_t) 84) +#define TAG_TZ_STRING ((uint8_t) 88) +#define TAG_FQDN_OPTION ((uint8_t) 89) +#define TAG_AUTH ((uint8_t) 90) +#define TAG_VINES_SERVERS ((uint8_t) 91) +#define TAG_SERVER_RANK ((uint8_t) 92) +#define TAG_CLIENT_ARCH ((uint8_t) 93) +#define TAG_CLIENT_NDI ((uint8_t) 94) +#define TAG_CLIENT_GUID ((uint8_t) 97) +#define TAG_LDAP_URL ((uint8_t) 95) +#define TAG_6OVER4 ((uint8_t) 96) +#define TAG_PRINTER_NAME ((uint8_t) 100) +#define TAG_MDHCP_SERVER ((uint8_t) 101) +#define TAG_IPX_COMPAT ((uint8_t) 110) +#define TAG_NETINFO_PARENT ((uint8_t) 112) +#define TAG_NETINFO_PARENT_TAG ((uint8_t) 113) +#define TAG_URL ((uint8_t) 114) +#define TAG_FAILOVER ((uint8_t) 115) +#define TAG_EXTENDED_REQUEST ((uint8_t) 126) +#define TAG_EXTENDED_OPTION ((uint8_t) 127) /* DHCP Message types (values for TAG_DHCP_MESSAGE option) */ @@ -208,14 +208,14 @@ struct bootp { */ struct cmu_vend { - u_int8_t v_magic[4]; /* magic number */ - u_int32_t v_flags; /* flags/opcodes, etc. */ + uint8_t v_magic[4]; /* magic number */ + uint32_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 */ - u_int8_t v_unused[24]; /* currently unused */ + uint8_t v_unused[24]; /* currently unused */ } UNALIGNED; diff --git a/cpack.h b/cpack.h index 383927f7..a7eb6d61 100644 --- a/cpack.h +++ b/cpack.h @@ -31,25 +31,25 @@ #define _CPACK_H struct cpack_state { - u_int8_t *c_buf; - u_int8_t *c_next; + uint8_t *c_buf; + uint8_t *c_next; size_t c_len; }; -int cpack_init(struct cpack_state *, u_int8_t *, size_t); +int cpack_init(struct cpack_state *, uint8_t *, size_t); -int cpack_uint8(struct cpack_state *, u_int8_t *); -int cpack_uint16(struct cpack_state *, u_int16_t *); -int cpack_uint32(struct cpack_state *, u_int32_t *); -int cpack_uint64(struct cpack_state *, u_int64_t *); +int cpack_uint8(struct cpack_state *, uint8_t *); +int cpack_uint16(struct cpack_state *, uint16_t *); +int cpack_uint32(struct cpack_state *, uint32_t *); +int cpack_uint64(struct cpack_state *, uint64_t *); -u_int8_t *cpack_next_boundary(u_int8_t *buf, u_int8_t *p, size_t alignment); -u_int8_t *cpack_align_and_reserve(struct cpack_state *cs, size_t wordsize); +uint8_t *cpack_next_boundary(uint8_t *buf, uint8_t *p, size_t alignment); +uint8_t *cpack_align_and_reserve(struct cpack_state *cs, size_t wordsize); -#define cpack_int8(__s, __p) cpack_uint8((__s), (u_int8_t*)(__p)) -#define cpack_int16(__s, __p) cpack_uint16((__s), (u_int16_t*)(__p)) -#define cpack_int32(__s, __p) cpack_uint32((__s), (u_int32_t*)(__p)) -#define cpack_int64(__s, __p) cpack_uint64((__s), (u_int64_t*)(__p)) +#define cpack_int8(__s, __p) cpack_uint8((__s), (uint8_t*)(__p)) +#define cpack_int16(__s, __p) cpack_uint16((__s), (uint16_t*)(__p)) +#define cpack_int32(__s, __p) cpack_uint32((__s), (uint32_t*)(__p)) +#define cpack_int64(__s, __p) cpack_uint64((__s), (uint64_t*)(__p)) extern int cpack_advance(struct cpack_state *, const size_t); diff --git a/decnet.h b/decnet.h index dfe51b2a..80c2fc0f 100644 --- a/decnet.h +++ b/decnet.h @@ -20,7 +20,7 @@ */ #ifndef WIN32 -typedef u_int8_t byte[1]; /* single byte field */ +typedef uint8_t byte[1]; /* single byte field */ #else /* * the keyword 'byte' generates conflicts in Windows @@ -28,17 +28,17 @@ typedef u_int8_t byte[1]; /* single byte field */ typedef unsigned char Byte[1]; /* single byte field */ #define byte Byte #endif /* WIN32 */ -typedef u_int8_t word[2]; /* 2 byte field */ -typedef u_int8_t longword[4]; /* 4 bytes field */ +typedef uint8_t word[2]; /* 2 byte field */ +typedef uint8_t longword[4]; /* 4 bytes field */ /* * Definitions for DECNET Phase IV protocol headers */ union etheraddress { - u_int8_t dne_addr[6]; /* full ethernet address */ + uint8_t dne_addr[6]; /* full ethernet address */ struct { - u_int8_t dne_hiord[4]; /* DECnet HIORD prefix */ - u_int8_t dne_nodeaddr[2]; /* DECnet node address */ + uint8_t dne_hiord[4]; /* DECnet HIORD prefix */ + uint8_t dne_nodeaddr[2]; /* DECnet node address */ } dne_remote; }; @@ -52,8 +52,8 @@ typedef union etheraddress etheraddr; /* Ethernet address */ #define DN_MAXADDL 20 /* max size of DECnet address */ struct dn_naddr { - u_int16_t a_len; /* length of address */ - u_int8_t a_addr[DN_MAXADDL]; /* address as bytes */ + uint16_t a_len; /* length of address */ + uint8_t a_addr[DN_MAXADDL]; /* address as bytes */ }; /* diff --git a/ether.h b/ether.h index cd407db2..2b26cab3 100644 --- a/ether.h +++ b/ether.h @@ -44,9 +44,9 @@ * Structure of a DEC/Intel/Xerox or 802.3 Ethernet header. */ struct ether_header { - u_int8_t ether_dhost[ETHER_ADDR_LEN]; - u_int8_t ether_shost[ETHER_ADDR_LEN]; - u_int16_t ether_type; + uint8_t ether_dhost[ETHER_ADDR_LEN]; + uint8_t ether_shost[ETHER_ADDR_LEN]; + uint16_t ether_type; }; /* diff --git a/extract.h b/extract.h index fe69bbcc..d2174ba2 100644 --- a/extract.h +++ b/extract.h @@ -36,7 +36,7 @@ * MIPS or Alpha, which has instructions that can help when doing * unaligned loads. * - * Declare packed structures containing a u_int16_t and a u_int32_t, + * Declare packed structures containing a uint16_t and a uint32_t, * cast the pointer to point to one of those, and fetch through it; * the GCC manual doesn't appear to explicitly say that * __attribute__((packed)) causes the compiler to generate unaligned-safe @@ -63,9 +63,9 @@ * line is aligned, e.g. * * #pragma unalign 1 - * typedef u_int16_t unaligned_u_int16_t; + * typedef uint16_t unaligned_uint16_t; * - * to define unaligned_u_int16_t as a 16-bit unaligned data type. + * to define unaligned_uint16_t as a 16-bit unaligned data type. * This could be presumably used, in sufficiently recent versions of * the compiler, with macros similar to those below. This would be * useful only if that compiler could generate better code for PA-RISC @@ -81,30 +81,30 @@ * accesses for *specific* items? */ typedef struct { - u_int16_t val; -} __attribute__((packed)) unaligned_u_int16_t; + uint16_t val; +} __attribute__((packed)) unaligned_uint16_t; typedef struct { - u_int32_t val; -} __attribute__((packed)) unaligned_u_int32_t; + uint32_t val; +} __attribute__((packed)) unaligned_uint32_t; -static inline u_int16_t +static inline uint16_t EXTRACT_16BITS(const void *p) { - return ((u_int16_t)ntohs(((const unaligned_u_int16_t *)(p))->val)); + return ((uint16_t)ntohs(((const unaligned_uint16_t *)(p))->val)); } -static inline u_int32_t +static inline uint32_t EXTRACT_32BITS(const void *p) { - return ((u_int32_t)ntohl(((const unaligned_u_int32_t *)(p))->val)); + return ((uint32_t)ntohl(((const unaligned_uint32_t *)(p))->val)); } -static inline u_int64_t +static inline uint64_t EXTRACT_64BITS(const void *p) { - return ((u_int64_t)(((u_int64_t)ntohl(((const unaligned_u_int32_t *)(p) + 0)->val)) << 32 | \ - ((u_int64_t)ntohl(((const unaligned_u_int32_t *)(p) + 1)->val)) << 0)); + return ((uint64_t)(((uint64_t)ntohl(((const unaligned_uint32_t *)(p) + 0)->val)) << 32 | \ + ((uint64_t)ntohl(((const unaligned_uint32_t *)(p) + 1)->val)) << 0)); } #else /* have to do it a byte at a time */ @@ -116,78 +116,78 @@ EXTRACT_64BITS(const void *p) * assemble them. */ #define EXTRACT_16BITS(p) \ - ((u_int16_t)((u_int16_t)*((const u_int8_t *)(p) + 0) << 8 | \ - (u_int16_t)*((const u_int8_t *)(p) + 1))) + ((uint16_t)((uint16_t)*((const uint8_t *)(p) + 0) << 8 | \ + (uint16_t)*((const uint8_t *)(p) + 1))) #define EXTRACT_32BITS(p) \ - ((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 0) << 24 | \ - (u_int32_t)*((const u_int8_t *)(p) + 1) << 16 | \ - (u_int32_t)*((const u_int8_t *)(p) + 2) << 8 | \ - (u_int32_t)*((const u_int8_t *)(p) + 3))) + ((uint32_t)((uint32_t)*((const uint8_t *)(p) + 0) << 24 | \ + (uint32_t)*((const uint8_t *)(p) + 1) << 16 | \ + (uint32_t)*((const uint8_t *)(p) + 2) << 8 | \ + (uint32_t)*((const uint8_t *)(p) + 3))) #define EXTRACT_64BITS(p) \ - ((u_int64_t)((u_int64_t)*((const u_int8_t *)(p) + 0) << 56 | \ - (u_int64_t)*((const u_int8_t *)(p) + 1) << 48 | \ - (u_int64_t)*((const u_int8_t *)(p) + 2) << 40 | \ - (u_int64_t)*((const u_int8_t *)(p) + 3) << 32 | \ - (u_int64_t)*((const u_int8_t *)(p) + 4) << 24 | \ - (u_int64_t)*((const u_int8_t *)(p) + 5) << 16 | \ - (u_int64_t)*((const u_int8_t *)(p) + 6) << 8 | \ - (u_int64_t)*((const u_int8_t *)(p) + 7))) + ((uint64_t)((uint64_t)*((const uint8_t *)(p) + 0) << 56 | \ + (uint64_t)*((const uint8_t *)(p) + 1) << 48 | \ + (uint64_t)*((const uint8_t *)(p) + 2) << 40 | \ + (uint64_t)*((const uint8_t *)(p) + 3) << 32 | \ + (uint64_t)*((const uint8_t *)(p) + 4) << 24 | \ + (uint64_t)*((const uint8_t *)(p) + 5) << 16 | \ + (uint64_t)*((const uint8_t *)(p) + 6) << 8 | \ + (uint64_t)*((const uint8_t *)(p) + 7))) #endif /* must special-case unaligned accesses */ #else /* LBL_ALIGN */ /* * The processor natively handles unaligned loads, so we can just * cast the pointer and fetch through it. */ -static inline u_int16_t +static inline uint16_t EXTRACT_16BITS(const void *p) { - return ((u_int16_t)ntohs(*(const u_int16_t *)(p))); + return ((uint16_t)ntohs(*(const uint16_t *)(p))); } -static inline u_int32_t +static inline uint32_t EXTRACT_32BITS(const void *p) { - return ((u_int32_t)ntohl(*(const u_int32_t *)(p))); + return ((uint32_t)ntohl(*(const uint32_t *)(p))); } -static inline u_int64_t +static inline uint64_t EXTRACT_64BITS(const void *p) { - return ((u_int64_t)(((u_int64_t)ntohl(*((const u_int32_t *)(p) + 0))) << 32 | \ - ((u_int64_t)ntohl(*((const u_int32_t *)(p) + 1))) << 0)); + return ((uint64_t)(((uint64_t)ntohl(*((const uint32_t *)(p) + 0))) << 32 | \ + ((uint64_t)ntohl(*((const uint32_t *)(p) + 1))) << 0)); } #endif /* LBL_ALIGN */ #define EXTRACT_24BITS(p) \ - ((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 0) << 16 | \ - (u_int32_t)*((const u_int8_t *)(p) + 1) << 8 | \ - (u_int32_t)*((const u_int8_t *)(p) + 2))) + ((uint32_t)((uint32_t)*((const uint8_t *)(p) + 0) << 16 | \ + (uint32_t)*((const uint8_t *)(p) + 1) << 8 | \ + (uint32_t)*((const uint8_t *)(p) + 2))) #define EXTRACT_40BITS(p) \ - ((u_int64_t)((u_int64_t)*((const u_int8_t *)(p) + 0) << 32 | \ - (u_int64_t)*((const u_int8_t *)(p) + 1) << 24 | \ - (u_int64_t)*((const u_int8_t *)(p) + 2) << 16 | \ - (u_int64_t)*((const u_int8_t *)(p) + 3) << 8 | \ - (u_int64_t)*((const u_int8_t *)(p) + 4))) + ((uint64_t)((uint64_t)*((const uint8_t *)(p) + 0) << 32 | \ + (uint64_t)*((const uint8_t *)(p) + 1) << 24 | \ + (uint64_t)*((const uint8_t *)(p) + 2) << 16 | \ + (uint64_t)*((const uint8_t *)(p) + 3) << 8 | \ + (uint64_t)*((const uint8_t *)(p) + 4))) #define EXTRACT_48BITS(p) \ - ((u_int64_t)((u_int64_t)*((const u_int8_t *)(p) + 0) << 40 | \ - (u_int64_t)*((const u_int8_t *)(p) + 1) << 32 | \ - (u_int64_t)*((const u_int8_t *)(p) + 2) << 24 | \ - (u_int64_t)*((const u_int8_t *)(p) + 3) << 16 | \ - (u_int64_t)*((const u_int8_t *)(p) + 4) << 8 | \ - (u_int64_t)*((const u_int8_t *)(p) + 5))) + ((uint64_t)((uint64_t)*((const uint8_t *)(p) + 0) << 40 | \ + (uint64_t)*((const uint8_t *)(p) + 1) << 32 | \ + (uint64_t)*((const uint8_t *)(p) + 2) << 24 | \ + (uint64_t)*((const uint8_t *)(p) + 3) << 16 | \ + (uint64_t)*((const uint8_t *)(p) + 4) << 8 | \ + (uint64_t)*((const uint8_t *)(p) + 5))) #define EXTRACT_56BITS(p) \ - ((u_int64_t)((u_int64_t)*((const u_int8_t *)(p) + 0) << 48 | \ - (u_int64_t)*((const u_int8_t *)(p) + 1) << 40 | \ - (u_int64_t)*((const u_int8_t *)(p) + 2) << 32 | \ - (u_int64_t)*((const u_int8_t *)(p) + 3) << 24 | \ - (u_int64_t)*((const u_int8_t *)(p) + 4) << 16 | \ - (u_int64_t)*((const u_int8_t *)(p) + 5) << 8 | \ - (u_int64_t)*((const u_int8_t *)(p) + 6))) + ((uint64_t)((uint64_t)*((const uint8_t *)(p) + 0) << 48 | \ + (uint64_t)*((const uint8_t *)(p) + 1) << 40 | \ + (uint64_t)*((const uint8_t *)(p) + 2) << 32 | \ + (uint64_t)*((const uint8_t *)(p) + 3) << 24 | \ + (uint64_t)*((const uint8_t *)(p) + 4) << 16 | \ + (uint64_t)*((const uint8_t *)(p) + 5) << 8 | \ + (uint64_t)*((const uint8_t *)(p) + 6))) /* * Macros to extract possibly-unaligned little-endian integral values. @@ -195,23 +195,23 @@ EXTRACT_64BITS(const void *p) */ #define EXTRACT_LE_8BITS(p) (*(p)) #define EXTRACT_LE_16BITS(p) \ - ((u_int16_t)((u_int16_t)*((const u_int8_t *)(p) + 1) << 8 | \ - (u_int16_t)*((const u_int8_t *)(p) + 0))) + ((uint16_t)((uint16_t)*((const uint8_t *)(p) + 1) << 8 | \ + (uint16_t)*((const uint8_t *)(p) + 0))) #define EXTRACT_LE_32BITS(p) \ - ((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 3) << 24 | \ - (u_int32_t)*((const u_int8_t *)(p) + 2) << 16 | \ - (u_int32_t)*((const u_int8_t *)(p) + 1) << 8 | \ - (u_int32_t)*((const u_int8_t *)(p) + 0))) + ((uint32_t)((uint32_t)*((const uint8_t *)(p) + 3) << 24 | \ + (uint32_t)*((const uint8_t *)(p) + 2) << 16 | \ + (uint32_t)*((const uint8_t *)(p) + 1) << 8 | \ + (uint32_t)*((const uint8_t *)(p) + 0))) #define EXTRACT_LE_24BITS(p) \ - ((u_int32_t)((u_int32_t)*((const u_int8_t *)(p) + 2) << 16 | \ - (u_int32_t)*((const u_int8_t *)(p) + 1) << 8 | \ - (u_int32_t)*((const u_int8_t *)(p) + 0))) + ((uint32_t)((uint32_t)*((const uint8_t *)(p) + 2) << 16 | \ + (uint32_t)*((const uint8_t *)(p) + 1) << 8 | \ + (uint32_t)*((const uint8_t *)(p) + 0))) #define EXTRACT_LE_64BITS(p) \ - ((u_int64_t)((u_int64_t)*((const u_int8_t *)(p) + 7) << 56 | \ - (u_int64_t)*((const u_int8_t *)(p) + 6) << 48 | \ - (u_int64_t)*((const u_int8_t *)(p) + 5) << 40 | \ - (u_int64_t)*((const u_int8_t *)(p) + 4) << 32 | \ - (u_int64_t)*((const u_int8_t *)(p) + 3) << 24 | \ - (u_int64_t)*((const u_int8_t *)(p) + 2) << 16 | \ - (u_int64_t)*((const u_int8_t *)(p) + 1) << 8 | \ - (u_int64_t)*((const u_int8_t *)(p) + 0))) + ((uint64_t)((uint64_t)*((const uint8_t *)(p) + 7) << 56 | \ + (uint64_t)*((const uint8_t *)(p) + 6) << 48 | \ + (uint64_t)*((const uint8_t *)(p) + 5) << 40 | \ + (uint64_t)*((const uint8_t *)(p) + 4) << 32 | \ + (uint64_t)*((const uint8_t *)(p) + 3) << 24 | \ + (uint64_t)*((const uint8_t *)(p) + 2) << 16 | \ + (uint64_t)*((const uint8_t *)(p) + 1) << 8 | \ + (uint64_t)*((const uint8_t *)(p) + 0))) diff --git a/interface.h b/interface.h index 37053496..299d010e 100644 --- a/interface.h +++ b/interface.h @@ -117,7 +117,7 @@ extern int32_t thiszone; /* seconds offset from gmt to local time */ /* Bail if "var" was not captured */ #define TCHECK(var) TCHECK2(var, sizeof(var)) -extern int mask2plen(u_int32_t); +extern int mask2plen(uint32_t); extern const char *tok2strary_internal(const char **, int, const char *, int); #define tok2strary(a,f,i) tok2strary_internal(a, sizeof(a)/sizeof(a[0]),f,i) @@ -141,8 +141,8 @@ extern const char *dnnum_string(u_short); /* checksum routines */ extern void init_checksum(void); -extern u_int16_t verify_crc10_cksum(u_int16_t, const u_char *, int); -extern u_int16_t create_osi_cksum(const u_int8_t *, int, int); +extern uint16_t verify_crc10_cksum(uint16_t, const u_char *, int); +extern uint16_t create_osi_cksum(const uint8_t *, int, int); /* The printer routines. */ @@ -150,18 +150,18 @@ extern u_int16_t create_osi_cksum(const u_int8_t *, int, int); extern char *q922_string(const u_char *); extern char *smb_errstr(int, int); -extern const char *nt_errstr(u_int32_t); +extern const char *nt_errstr(uint32_t); #ifdef INET6 extern int mask62plen(const u_char *); #endif /*INET6*/ struct cksum_vec { - const u_int8_t *ptr; + const uint8_t *ptr; int len; }; -extern u_int16_t in_cksum(const struct cksum_vec *, int); -extern u_int16_t in_cksum_shouldbe(u_int16_t, u_int16_t); +extern uint16_t in_cksum(const struct cksum_vec *, int); +extern uint16_t in_cksum_shouldbe(uint16_t, uint16_t); #ifndef HAVE_BPF_DUMP struct bpf_program; diff --git a/ip.h b/ip.h index 64ec5dc6..37570f36 100644 --- a/ip.h +++ b/ip.h @@ -50,19 +50,19 @@ * against negative integers quite easily, and fail in subtle ways. */ struct ip { - u_int8_t ip_vhl; /* header length, version */ + uint8_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 */ + uint8_t ip_tos; /* type of service */ + uint16_t ip_len; /* total length */ + uint16_t ip_id; /* identification */ + uint16_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_int8_t ip_ttl; /* time to live */ - u_int8_t ip_p; /* protocol */ - u_int16_t ip_sum; /* checksum */ + uint8_t ip_ttl; /* time to live */ + uint8_t ip_p; /* protocol */ + uint16_t ip_sum; /* checksum */ struct in_addr ip_src,ip_dst; /* source and dest address */ } UNALIGNED; @@ -123,17 +123,17 @@ struct ip { * Time stamp option structure. */ struct ip_timestamp { - 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_oflwflg; /* flags, overflow counter */ + uint8_t ipt_code; /* IPOPT_TS */ + uint8_t ipt_len; /* size of structure (variable) */ + uint8_t ipt_ptr; /* index of current entry */ + uint8_t ipt_oflwflg; /* flags, overflow counter */ #define IPTS_OFLW(ip) (((ipt)->ipt_oflwflg & 0xf0) >> 4) #define IPTS_FLG(ip) ((ipt)->ipt_oflwflg & 0x0f) union ipt_timestamp { - u_int32_t ipt_time[1]; + uint32_t ipt_time[1]; struct ipt_ta { struct in_addr ipt_addr; - u_int32_t ipt_time; + uint32_t ipt_time; } ipt_ta[1]; } ipt_timestamp; } UNALIGNED; diff --git a/ip6.h b/ip6.h index f1032ec2..1ad91498 100644 --- a/ip6.h +++ b/ip6.h @@ -76,12 +76,12 @@ struct ip6_hdr { union { struct ip6_hdrctl { - u_int32_t ip6_un1_flow; /* 20 bits of flow-ID */ - u_int16_t ip6_un1_plen; /* payload length */ - u_int8_t ip6_un1_nxt; /* next header */ - u_int8_t ip6_un1_hlim; /* hop limit */ + uint32_t ip6_un1_flow; /* 20 bits of flow-ID */ + uint16_t ip6_un1_plen; /* payload length */ + uint8_t ip6_un1_nxt; /* next header */ + uint8_t ip6_un1_hlim; /* hop limit */ } ip6_un1; - u_int8_t ip6_un2_vfc; /* 4 bits version, top 4 bits class */ + uint8_t ip6_un2_vfc; /* 4 bits version, top 4 bits class */ } ip6_ctlun; struct in6_addr ip6_src; /* source address */ struct in6_addr ip6_dst; /* destination address */ @@ -96,8 +96,8 @@ struct ip6_hdr { #define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim /* in network endian */ -#define IPV6_FLOWINFO_MASK ((u_int32_t)htonl(0x0fffffff)) /* flow info (28 bits) */ -#define IPV6_FLOWLABEL_MASK ((u_int32_t)htonl(0x000fffff)) /* flow label (20 bits) */ +#define IPV6_FLOWINFO_MASK ((uint32_t)htonl(0x0fffffff)) /* flow info (28 bits) */ +#define IPV6_FLOWLABEL_MASK ((uint32_t)htonl(0x000fffff)) /* flow label (20 bits) */ #if 1 /* ECN bits proposed by Sally Floyd */ #define IP6TOS_CE 0x01 /* congestion experienced */ @@ -109,21 +109,21 @@ struct ip6_hdr { */ struct ip6_ext { - u_int8_t ip6e_nxt; - u_int8_t ip6e_len; + uint8_t ip6e_nxt; + uint8_t ip6e_len; } UNALIGNED; /* Hop-by-Hop options header */ struct ip6_hbh { - u_int8_t ip6h_nxt; /* next header */ - u_int8_t ip6h_len; /* length in units of 8 octets */ + uint8_t ip6h_nxt; /* next header */ + uint8_t ip6h_len; /* length in units of 8 octets */ /* followed by options */ } UNALIGNED; /* Destination options header */ struct ip6_dest { - u_int8_t ip6d_nxt; /* next header */ - u_int8_t ip6d_len; /* length in units of 8 octets */ + uint8_t ip6d_nxt; /* next header */ + uint8_t ip6d_len; /* length in units of 8 octets */ /* followed by options */ } UNALIGNED; @@ -165,30 +165,30 @@ struct ip6_dest { /* Routing header */ struct ip6_rthdr { - u_int8_t ip6r_nxt; /* next header */ - u_int8_t ip6r_len; /* length in units of 8 octets */ - u_int8_t ip6r_type; /* routing type */ - u_int8_t ip6r_segleft; /* segments left */ + uint8_t ip6r_nxt; /* next header */ + uint8_t ip6r_len; /* length in units of 8 octets */ + uint8_t ip6r_type; /* routing type */ + uint8_t ip6r_segleft; /* segments left */ /* followed by routing type specific data */ } UNALIGNED; /* Type 0 Routing header */ struct ip6_rthdr0 { - u_int8_t ip6r0_nxt; /* next header */ - u_int8_t ip6r0_len; /* length in units of 8 octets */ - u_int8_t ip6r0_type; /* always zero */ - u_int8_t ip6r0_segleft; /* segments left */ - u_int8_t ip6r0_reserved; /* reserved field */ - u_int8_t ip6r0_slmap[3]; /* strict/loose bit map */ + uint8_t ip6r0_nxt; /* next header */ + uint8_t ip6r0_len; /* length in units of 8 octets */ + uint8_t ip6r0_type; /* always zero */ + uint8_t ip6r0_segleft; /* segments left */ + uint8_t ip6r0_reserved; /* reserved field */ + uint8_t ip6r0_slmap[3]; /* strict/loose bit map */ struct in6_addr ip6r0_addr[1]; /* up to 23 addresses */ } UNALIGNED; /* Fragment header */ struct ip6_frag { - u_int8_t ip6f_nxt; /* next header */ - u_int8_t ip6f_reserved; /* reserved field */ - u_int16_t ip6f_offlg; /* offset, reserved, and flag */ - u_int32_t ip6f_ident; /* identification */ + uint8_t ip6f_nxt; /* next header */ + uint8_t ip6f_reserved; /* reserved field */ + uint16_t ip6f_offlg; /* offset, reserved, and flag */ + uint32_t ip6f_ident; /* identification */ } UNALIGNED; #define IP6F_OFF_MASK 0xfff8 /* mask out offset from ip6f_offlg */ @@ -196,6 +196,6 @@ struct ip6_frag { #define IP6F_MORE_FRAG 0x0001 /* more-fragments flag */ /* in print-ip6.c */ -extern int nextproto6_cksum(const struct ip6_hdr *, const u_int8_t *, u_int, u_int, u_int); +extern int nextproto6_cksum(const struct ip6_hdr *, const uint8_t *, u_int, u_int, u_int); #endif /* not _NETINET_IP6_H_ */ diff --git a/missing/getnameinfo.c b/missing/getnameinfo.c index 9134ef07..63aba731 100644 --- a/missing/getnameinfo.c +++ b/missing/getnameinfo.c @@ -107,7 +107,7 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags) u_short port; int family, i; char *addr, *p; - u_int32_t v4a; + uint32_t v4a; int h_error; char numserv[512]; char numaddr[512]; @@ -163,7 +163,7 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags) switch (sa->sa_family) { case AF_INET: - v4a = (u_int32_t) + v4a = (uint32_t) ntohl(((struct sockaddr_in *)sa)->sin_addr.s_addr); if (IN_MULTICAST(v4a) || IN_EXPERIMENTAL(v4a)) flags |= NI_NUMERICHOST; diff --git a/nameser.h b/nameser.h index 517544cf..11e71ef8 100644 --- a/nameser.h +++ b/nameser.h @@ -224,13 +224,13 @@ * Structure for query header. */ typedef struct { - u_int16_t id; /* query identification number */ - u_int8_t flags1; /* first byte of flags */ - u_int8_t flags2; /* second byte of flags */ - u_int16_t qdcount; /* number of question entries */ - u_int16_t ancount; /* number of answer entries */ - u_int16_t nscount; /* number of authority entries */ - u_int16_t arcount; /* number of resource entries */ + uint16_t id; /* query identification number */ + uint8_t flags1; /* first byte of flags */ + uint8_t flags2; /* second byte of flags */ + uint16_t qdcount; /* number of question entries */ + uint16_t ancount; /* number of answer entries */ + uint16_t nscount; /* number of authority entries */ + uint16_t arcount; /* number of resource entries */ } HEADER; /* @@ -261,36 +261,36 @@ struct rrec { int16_t r_zone; /* zone number */ int16_t r_class; /* class number */ int16_t r_type; /* type number */ - u_int32_t r_ttl; /* time to live */ + uint32_t r_ttl; /* time to live */ int r_size; /* size of data area */ char *r_data; /* pointer to data */ }; /* * Inline versions of get/put short/long. Pointer is advanced. - * We also assume that a "u_int16_t" holds 2 "chars" - * and that a "u_int32_t" holds 4 "chars". + * We also assume that a "uint16_t" holds 2 "chars" + * and that a "uint32_t" holds 4 "chars". * * These macros demonstrate the property of C whereby it can be * portable or it can be elegant but never both. */ #define GETSHORT(s, cp) { \ register u_char *t_cp = (u_char *)(cp); \ - (s) = ((u_int16_t)t_cp[0] << 8) | (u_int16_t)t_cp[1]; \ + (s) = ((uint16_t)t_cp[0] << 8) | (uint16_t)t_cp[1]; \ (cp) += 2; \ } #define GETLONG(l, cp) { \ register u_char *t_cp = (u_char *)(cp); \ - (l) = (((u_int32_t)t_cp[0]) << 24) \ - | (((u_int32_t)t_cp[1]) << 16) \ - | (((u_int32_t)t_cp[2]) << 8) \ - | (((u_int32_t)t_cp[3])); \ + (l) = (((uint32_t)t_cp[0]) << 24) \ + | (((uint32_t)t_cp[1]) << 16) \ + | (((uint32_t)t_cp[2]) << 8) \ + | (((uint32_t)t_cp[3])); \ (cp) += 4; \ } #define PUTSHORT(s, cp) { \ - register u_int16_t t_s = (u_int16_t)(s); \ + register uint16_t t_s = (uint16_t)(s); \ register u_char *t_cp = (u_char *)(cp); \ *t_cp++ = t_s >> 8; \ *t_cp = t_s; \ @@ -302,7 +302,7 @@ struct rrec { * were depending on this "feature", you will lose. */ #define PUTLONG(l, cp) { \ - register u_int32_t t_l = (u_int32_t)(l); \ + register uint32_t t_l = (uint32_t)(l); \ register u_char *t_cp = (u_char *)(cp); \ *t_cp++ = t_l >> 24; \ *t_cp++ = t_l >> 16; \ diff --git a/netdissect.h b/netdissect.h index 21dee314..8289c338 100644 --- a/netdissect.h +++ b/netdissect.h @@ -512,8 +512,8 @@ extern void print_data(netdissect_options *, const unsigned char *, int); extern void decnet_print(netdissect_options *, const u_char *, u_int, u_int); extern void tcp_print(netdissect_options *, const u_char *, u_int, const u_char *, int); extern void ospf_print(netdissect_options *, const u_char *, u_int, const u_char *); -extern int ospf_print_te_lsa(netdissect_options *, const u_int8_t *, u_int); -extern int ospf_print_grace_lsa(netdissect_options *, const u_int8_t *, u_int); +extern int ospf_print_te_lsa(netdissect_options *, const uint8_t *, u_int); +extern int ospf_print_grace_lsa(netdissect_options *, const uint8_t *, u_int); extern u_int ppp_print(netdissect_options *, register const u_char *, u_int); extern u_int ppp_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); extern u_int ppp_hdlc_if_print(netdissect_options *, const struct pcap_pkthdr *, const u_char *); @@ -529,7 +529,7 @@ extern void m3ua_print(netdissect_options *, const u_char *, const u_int); extern void ascii_print(netdissect_options *,u_int); extern void default_print(netdissect_options *,const u_char *, u_int); extern char *smb_errstr(netdissect_options *,int, int); -extern const char *nt_errstr(netdissect_options *, u_int32_t); +extern const char *nt_errstr(netdissect_options *, uint32_t); #endif extern u_int ipnet_if_print(netdissect_options *,const struct pcap_pkthdr *, const u_char *); @@ -557,13 +557,13 @@ extern void babel_print(netdissect_options *, const u_char *, u_int); #if 0 struct cksum_vec { - const u_int8_t *ptr; + const uint8_t *ptr; int len; }; -extern u_int16_t in_cksum(const struct cksum_vec *, int); -extern u_int16_t in_cksum_shouldbe(u_int16_t, u_int16_t); +extern uint16_t in_cksum(const struct cksum_vec *, int); +extern uint16_t in_cksum_shouldbe(uint16_t, uint16_t); #endif -extern int nextproto4_cksum(netdissect_options *ndo, const struct ip *, const u_int8_t *, u_int, u_int, u_int); +extern int nextproto4_cksum(netdissect_options *ndo, const struct ip *, const uint8_t *, u_int, u_int, u_int); extern int decode_prefix4(netdissect_options *ndo, const u_char *, u_int, char *, u_int); #ifdef INET6 extern int decode_prefix6(netdissect_options *ndo, const u_char *, u_int, char *, u_int); diff --git a/nfs.h b/nfs.h index 056a9099..da7bc508 100644 --- a/nfs.h +++ b/nfs.h @@ -238,11 +238,11 @@ txdr_unsigned(((t) == VFIFO) ? MAKEIMODE(VCHR, (m)) : \ MAKEIMODE((t), (m))) #define vtonfsv3_mode(m) txdr_unsigned((m) & 07777) -#define nfstov_mode(a) (fxdr_unsigned(u_int16_t, (a))&07777) +#define nfstov_mode(a) (fxdr_unsigned(uint16_t, (a))&07777) #define vtonfsv2_type(a) txdr_unsigned(nfsv2_type[((int32_t)(a))]) #define vtonfsv3_type(a) txdr_unsigned(nfsv3_type[((int32_t)(a))]) -#define nfsv2tov_type(a) nv2tov_type[fxdr_unsigned(u_int32_t,(a))&0x7] -#define nfsv3tov_type(a) nv3tov_type[fxdr_unsigned(u_int32_t,(a))&0x7] +#define nfsv2tov_type(a) nv2tov_type[fxdr_unsigned(uint32_t,(a))&0x7] +#define nfsv3tov_type(a) nv3tov_type[fxdr_unsigned(uint32_t,(a))&0x7] /* File types */ typedef enum { NFNON=0, NFREG=1, NFDIR=2, NFBLK=3, NFCHR=4, NFLNK=5, @@ -266,14 +266,14 @@ union nfsfh { typedef union nfsfh nfsfh_t; struct nfsv2_time { - u_int32_t nfsv2_sec; - u_int32_t nfsv2_usec; + uint32_t nfsv2_sec; + uint32_t nfsv2_usec; }; typedef struct nfsv2_time nfstime2; struct nfsv3_time { - u_int32_t nfsv3_sec; - u_int32_t nfsv3_nsec; + uint32_t nfsv3_sec; + uint32_t nfsv3_nsec; }; typedef struct nfsv3_time nfstime3; @@ -282,7 +282,7 @@ typedef struct nfsv3_time nfstime3; * protocol and to facilitate xdr conversion. */ struct nfs_uquad { - u_int32_t nfsuquad[2]; + uint32_t nfsuquad[2]; }; typedef struct nfs_uquad nfsuint64; @@ -290,8 +290,8 @@ typedef struct nfs_uquad nfsuint64; * NFS Version 3 special file number. */ struct nfsv3_spec { - u_int32_t specdata1; - u_int32_t specdata2; + uint32_t specdata1; + uint32_t specdata2; }; typedef struct nfsv3_spec nfsv3spec; @@ -305,19 +305,19 @@ typedef struct nfsv3_spec nfsv3spec; * NFSX_FATTR(v3) macro. */ struct nfs_fattr { - u_int32_t fa_type; - u_int32_t fa_mode; - u_int32_t fa_nlink; - u_int32_t fa_uid; - u_int32_t fa_gid; + uint32_t fa_type; + uint32_t fa_mode; + uint32_t fa_nlink; + uint32_t fa_uid; + uint32_t fa_gid; union { struct { - u_int32_t nfsv2fa_size; - u_int32_t nfsv2fa_blocksize; - u_int32_t nfsv2fa_rdev; - u_int32_t nfsv2fa_blocks; - u_int32_t nfsv2fa_fsid; - u_int32_t nfsv2fa_fileid; + uint32_t nfsv2fa_size; + uint32_t nfsv2fa_blocksize; + uint32_t nfsv2fa_rdev; + uint32_t nfsv2fa_blocks; + uint32_t nfsv2fa_fsid; + uint32_t nfsv2fa_fileid; nfstime2 nfsv2fa_atime; nfstime2 nfsv2fa_mtime; nfstime2 nfsv2fa_ctime; @@ -355,10 +355,10 @@ struct nfs_fattr { #define fa3_ctime fa_un.fa_nfsv3.nfsv3fa_ctime struct nfsv2_sattr { - u_int32_t sa_mode; - u_int32_t sa_uid; - u_int32_t sa_gid; - u_int32_t sa_size; + uint32_t sa_mode; + uint32_t sa_uid; + uint32_t sa_gid; + uint32_t sa_size; nfstime2 sa_atime; nfstime2 sa_mtime; }; @@ -367,28 +367,28 @@ struct nfsv2_sattr { * NFS Version 3 sattr structure for the new node creation case. */ struct nfsv3_sattr { - u_int32_t sa_modeset; - u_int32_t sa_mode; - u_int32_t sa_uidset; - u_int32_t sa_uid; - u_int32_t sa_gidset; - u_int32_t sa_gid; - u_int32_t sa_sizeset; - u_int32_t sa_size; - u_int32_t sa_atimetype; + uint32_t sa_modeset; + uint32_t sa_mode; + uint32_t sa_uidset; + uint32_t sa_uid; + uint32_t sa_gidset; + uint32_t sa_gid; + uint32_t sa_sizeset; + uint32_t sa_size; + uint32_t sa_atimetype; nfstime3 sa_atime; - u_int32_t sa_mtimetype; + uint32_t sa_mtimetype; nfstime3 sa_mtime; }; struct nfs_statfs { union { struct { - u_int32_t nfsv2sf_tsize; - u_int32_t nfsv2sf_bsize; - u_int32_t nfsv2sf_blocks; - u_int32_t nfsv2sf_bfree; - u_int32_t nfsv2sf_bavail; + uint32_t nfsv2sf_tsize; + uint32_t nfsv2sf_bsize; + uint32_t nfsv2sf_blocks; + uint32_t nfsv2sf_bfree; + uint32_t nfsv2sf_bavail; } sf_nfsv2; struct { nfsuint64 nfsv3sf_tbytes; @@ -397,7 +397,7 @@ struct nfs_statfs { nfsuint64 nfsv3sf_tfiles; nfsuint64 nfsv3sf_ffiles; nfsuint64 nfsv3sf_afiles; - u_int32_t nfsv3sf_invarsec; + uint32_t nfsv3sf_invarsec; } sf_nfsv3; } sf_un; }; @@ -416,23 +416,23 @@ struct nfs_statfs { #define sf_invarsec sf_un.sf_nfsv3.nfsv3sf_invarsec struct nfsv3_fsinfo { - u_int32_t fs_rtmax; - u_int32_t fs_rtpref; - u_int32_t fs_rtmult; - u_int32_t fs_wtmax; - u_int32_t fs_wtpref; - u_int32_t fs_wtmult; - u_int32_t fs_dtpref; + uint32_t fs_rtmax; + uint32_t fs_rtpref; + uint32_t fs_rtmult; + uint32_t fs_wtmax; + uint32_t fs_wtpref; + uint32_t fs_wtmult; + uint32_t fs_dtpref; nfsuint64 fs_maxfilesize; nfstime3 fs_timedelta; - u_int32_t fs_properties; + uint32_t fs_properties; }; struct nfsv3_pathconf { - u_int32_t pc_linkmax; - u_int32_t pc_namemax; - u_int32_t pc_notrunc; - u_int32_t pc_chownrestricted; - u_int32_t pc_caseinsensitive; - u_int32_t pc_casepreserving; + uint32_t pc_linkmax; + uint32_t pc_namemax; + uint32_t pc_notrunc; + uint32_t pc_chownrestricted; + uint32_t pc_caseinsensitive; + uint32_t pc_casepreserving; }; diff --git a/nfsfh.h b/nfsfh.h index 2703415a..cfd073bd 100644 --- a/nfsfh.h +++ b/nfsfh.h @@ -44,8 +44,8 @@ * that we might be spying upon use different external representations. */ typedef struct { - u_int32_t Minor; /* upper case to avoid clashing with macro names */ - u_int32_t Major; + uint32_t Minor; /* upper case to avoid clashing with macro names */ + uint32_t Major; } my_devt; #define dev_eq(a,b) ((a.Minor == b.Minor) && (a.Major == b.Major)) @@ -57,10 +57,10 @@ typedef struct { typedef struct { my_devt Fsid_dev; /* XXX avoid name conflict with AIX */ char Opaque_Handle[2 * 32 + 1]; - u_int32_t fsid_code; + uint32_t fsid_code; } my_fsid; #define fsid_eq(a,b) ((a.fsid_code == b.fsid_code) &&\ dev_eq(a.Fsid_dev, b.Fsid_dev)) -extern void Parse_fh(const unsigned char *, int, my_fsid *, u_int32_t *, const char **, const char **, int); +extern void Parse_fh(const unsigned char *, int, my_fsid *, uint32_t *, const char **, const char **, int); diff --git a/ospf.h b/ospf.h index afcd50c5..b47aaf69 100644 --- a/ospf.h +++ b/ospf.h @@ -148,14 +148,14 @@ * TOS metric struct (will be 0 or more in router links update) */ struct tos_metric { - u_int8_t tos_type; - u_int8_t reserved; - u_int8_t tos_metric[2]; + uint8_t tos_type; + uint8_t reserved; + uint8_t tos_metric[2]; }; struct tos_link { - u_int8_t link_type; - u_int8_t link_tos_count; - u_int8_t tos_metric[2]; + uint8_t link_type; + uint8_t link_tos_count; + uint8_t tos_metric[2]; }; union un_tos { struct tos_link link; @@ -164,20 +164,20 @@ union un_tos { /* link state advertisement header */ struct lsa_hdr { - u_int16_t ls_age; - u_int8_t ls_options; - u_int8_t ls_type; + uint16_t ls_age; + uint8_t ls_options; + uint8_t ls_type; union { struct in_addr lsa_id; struct { /* opaque LSAs change the LSA-ID field */ - u_int8_t opaque_type; - u_int8_t opaque_id[3]; + uint8_t opaque_type; + uint8_t opaque_id[3]; } opaque_field; } un_lsa_id; struct in_addr ls_router; - u_int32_t ls_seq; - u_int16_t ls_chksum; - u_int16_t ls_length; + uint32_t ls_seq; + uint16_t ls_chksum; + uint16_t ls_length; }; /* link state advertisement */ @@ -188,9 +188,9 @@ struct lsa { union { /* Router links advertisements */ struct { - u_int8_t rla_flags; - u_int8_t rla_zero[1]; - u_int16_t rla_count; + uint8_t rla_flags; + uint8_t rla_zero[1]; + uint16_t rla_count; struct rlalink { struct in_addr link_id; struct in_addr link_data; @@ -207,14 +207,14 @@ struct lsa { /* Summary links advertisements */ struct { struct in_addr sla_mask; - u_int32_t sla_tosmetric[1]; /* may repeat */ + uint32_t sla_tosmetric[1]; /* may repeat */ } un_sla; /* AS external links advertisements */ struct { struct in_addr asla_mask; struct aslametric { - u_int32_t asla_tosmetric; + uint32_t asla_tosmetric; struct in_addr asla_forward; struct in_addr asla_tag; } asla_metric[1]; /* may repeat */ @@ -222,34 +222,34 @@ struct lsa { /* Multicast group membership */ struct mcla { - u_int32_t mcla_vtype; + uint32_t mcla_vtype; struct in_addr mcla_vid; } un_mcla[1]; /* Opaque TE LSA */ struct { - u_int16_t type; - u_int16_t length; - u_int8_t data[1]; /* may repeat */ + uint16_t type; + uint16_t length; + uint8_t data[1]; /* may repeat */ } un_te_lsa_tlv; /* Opaque Grace LSA */ struct { - u_int16_t type; - u_int16_t length; - u_int8_t data[1]; /* may repeat */ + uint16_t type; + uint16_t length; + uint8_t data[1]; /* may repeat */ } un_grace_tlv; /* Opaque Router information LSA */ struct { - u_int16_t type; - u_int16_t length; - u_int8_t data[1]; /* may repeat */ + uint16_t type; + uint16_t length; + uint8_t data[1]; /* may repeat */ } un_ri_tlv; /* Unknown LSA */ struct unknown { - u_int8_t data[1]; /* may repeat */ + uint8_t data[1]; /* may repeat */ } un_unknown[1]; } lsa_un; @@ -261,23 +261,23 @@ struct lsa { * the main header */ struct ospfhdr { - u_int8_t ospf_version; - u_int8_t ospf_type; - u_int16_t ospf_len; + uint8_t ospf_version; + uint8_t ospf_type; + uint16_t ospf_len; struct in_addr ospf_routerid; struct in_addr ospf_areaid; - u_int16_t ospf_chksum; - u_int16_t ospf_authtype; - u_int8_t ospf_authdata[OSPF_AUTH_SIZE]; + uint16_t ospf_chksum; + uint16_t ospf_authtype; + uint8_t ospf_authdata[OSPF_AUTH_SIZE]; union { /* Hello packet */ struct { struct in_addr hello_mask; - u_int16_t hello_helloint; - u_int8_t hello_options; - u_int8_t hello_priority; - u_int32_t hello_deadint; + uint16_t hello_helloint; + uint8_t hello_options; + uint8_t hello_priority; + uint32_t hello_deadint; struct in_addr hello_dr; struct in_addr hello_bdr; struct in_addr hello_neighbor[1]; /* may repeat */ @@ -285,21 +285,21 @@ struct ospfhdr { /* Database Description packet */ struct { - u_int16_t db_ifmtu; - u_int8_t db_options; - u_int8_t db_flags; - u_int32_t db_seq; + uint16_t db_ifmtu; + uint8_t db_options; + uint8_t db_flags; + uint32_t db_seq; struct lsa_hdr db_lshdr[1]; /* may repeat */ } un_db; /* Link State Request */ struct lsr { - u_int8_t ls_type[4]; + uint8_t ls_type[4]; union { struct in_addr ls_stateid; struct { /* opaque LSAs change the LSA-ID field */ - u_int8_t opaque_type; - u_int8_t opaque_id[3]; + uint8_t opaque_type; + uint8_t opaque_id[3]; } opaque_field; } un_ls_stateid; struct in_addr ls_router; @@ -307,7 +307,7 @@ struct ospfhdr { /* Link State Update */ struct { - u_int32_t lsu_count; + uint32_t lsu_count; struct lsa lsu_lsa[1]; /* may repeat */ } un_lsu; diff --git a/print-atm.c b/print-atm.c index 285c6a40..2531880b 100644 --- a/print-atm.c +++ b/print-atm.c @@ -246,7 +246,7 @@ static void sig_print(netdissect_options *ndo, const u_char *p, int caplen) { - bpf_u_int32 call_ref; + uint32_t call_ref; if (caplen < PROTO_POS) { ND_PRINT((ndo, "%s", tstr)); diff --git a/rpc_auth.h b/rpc_auth.h index ef921b09..3cc9b30c 100644 --- a/rpc_auth.h +++ b/rpc_auth.h @@ -65,8 +65,8 @@ enum sunrpc_auth_stat { * Authentication info. Opaque to client. */ struct sunrpc_opaque_auth { - u_int32_t oa_flavor; /* flavor of auth */ - u_int32_t oa_len; /* length of opaque body */ + uint32_t oa_flavor; /* flavor of auth */ + uint32_t oa_len; /* length of opaque body */ /* zero or more bytes of body */ }; diff --git a/rpc_msg.h b/rpc_msg.h index 1f304ab6..88e7319b 100644 --- a/rpc_msg.h +++ b/rpc_msg.h @@ -38,7 +38,7 @@ * Copyright (C) 1984, Sun Microsystems, Inc. */ -#define SUNRPC_MSG_VERSION ((u_int32_t) 2) +#define SUNRPC_MSG_VERSION ((uint32_t) 2) /* * Bottom up definition of an rpc message. @@ -78,13 +78,13 @@ enum sunrpc_reject_stat { * Reply to an rpc request that was rejected by the server. */ struct sunrpc_rejected_reply { - u_int32_t rj_stat; /* enum reject_stat */ + uint32_t rj_stat; /* enum reject_stat */ union { struct { - u_int32_t low; - u_int32_t high; + uint32_t low; + uint32_t high; } RJ_versions; - u_int32_t RJ_why; /* enum auth_stat - why authentication did not work */ + uint32_t RJ_why; /* enum auth_stat - why authentication did not work */ } ru; #define rj_vers ru.RJ_versions #define rj_why ru.RJ_why @@ -94,7 +94,7 @@ struct sunrpc_rejected_reply { * Body of a reply to an rpc request. */ struct sunrpc_reply_body { - u_int32_t rp_stat; /* enum reply_stat */ + uint32_t rp_stat; /* enum reply_stat */ struct sunrpc_rejected_reply rp_reject; /* if rejected */ }; @@ -102,10 +102,10 @@ struct sunrpc_reply_body { * Body of an rpc request call. */ struct sunrpc_call_body { - u_int32_t cb_rpcvers; /* must be equal to two */ - u_int32_t cb_prog; - u_int32_t cb_vers; - u_int32_t cb_proc; + uint32_t cb_rpcvers; /* must be equal to two */ + uint32_t cb_prog; + uint32_t cb_vers; + uint32_t cb_proc; struct sunrpc_opaque_auth cb_cred; /* followed by opaque verifier */ }; @@ -114,8 +114,8 @@ struct sunrpc_call_body { * The rpc message */ struct sunrpc_msg { - u_int32_t rm_xid; - u_int32_t rm_direction; /* enum msg_type */ + uint32_t rm_xid; + uint32_t rm_direction; /* enum msg_type */ union { struct sunrpc_call_body RM_cmb; struct sunrpc_reply_body RM_rmb; diff --git a/rpl.h b/rpl.h index 59d865e3..c48784ba 100644 --- a/rpl.h +++ b/rpl.h @@ -38,35 +38,35 @@ enum ND_RPL_DIO_FLAGS { /* section 6 of draft-ietf-roll-rpl-19 */ struct nd_rpl_security { - u_int8_t rpl_sec_t_reserved; /* bit 7 is T-bit */ - u_int8_t rpl_sec_algo; - u_int16_t rpl_sec_kim_lvl_flags; /* bit 15/14, KIM */ + uint8_t rpl_sec_t_reserved; /* bit 7 is T-bit */ + uint8_t rpl_sec_algo; + uint16_t rpl_sec_kim_lvl_flags; /* bit 15/14, KIM */ /* bit 10-8, LVL, bit 7-0 flags */ - u_int32_t rpl_sec_counter; + uint32_t rpl_sec_counter; #if 0 - u_int8_t rpl_sec_ki[0]; /* depends upon kim */ + uint8_t rpl_sec_ki[0]; /* depends upon kim */ #endif }; /* section 6.2.1, DODAG Information Solication (DIS_IS) */ struct nd_rpl_dis_is { - u_int8_t rpl_dis_flags; - u_int8_t rpl_dis_reserved; + uint8_t rpl_dis_flags; + uint8_t rpl_dis_reserved; #if 0 - u_int8_t rpl_dis_options[0]; + uint8_t rpl_dis_options[0]; #endif }; /* section 6.3.1, DODAG Information Object (DIO) */ struct nd_rpl_dio { - u_int8_t rpl_instanceid; - u_int8_t rpl_version; - u_int16_t rpl_dagrank; - u_int8_t rpl_mopprf; /* bit 7=G, 5-3=MOP, 2-0=PRF */ - u_int8_t rpl_dtsn; /* Dest. Advertisement Trigger Sequence Number */ - u_int8_t rpl_flags; /* no flags defined yet */ - u_int8_t rpl_resv1; - u_int8_t rpl_dagid[DAGID_LEN]; + uint8_t rpl_instanceid; + uint8_t rpl_version; + uint16_t rpl_dagrank; + uint8_t rpl_mopprf; /* bit 7=G, 5-3=MOP, 2-0=PRF */ + uint8_t rpl_dtsn; /* Dest. Advertisement Trigger Sequence Number */ + uint8_t rpl_flags; /* no flags defined yet */ + uint8_t rpl_resv1; + uint8_t rpl_dagid[DAGID_LEN]; }; #define RPL_DIO_GROUND_FLAG 0x80 #define RPL_DIO_MOP_SHIFT 3 @@ -97,8 +97,8 @@ enum RPL_SUBOPT { }; struct rpl_dio_genoption { - u_int8_t rpl_dio_type; - u_int8_t rpl_dio_len; /* suboption length, not including type/len */ + uint8_t rpl_dio_type; + uint8_t rpl_dio_len; /* suboption length, not including type/len */ }; #define RPL_DIO_GENOPTION_LEN 2 @@ -106,23 +106,23 @@ struct rpl_dio_genoption { #define RPL_DIO_LIFETIME_DISCONNECT 0 struct rpl_dio_destprefix { - u_int8_t rpl_dio_type; - u_int8_t rpl_dio_len; - u_int8_t rpl_dio_prefixlen; /* in bits */ - u_int8_t rpl_dio_prf; /* flags, including Route Preference */ - u_int32_t rpl_dio_prefixlifetime; /* in seconds */ + uint8_t rpl_dio_type; + uint8_t rpl_dio_len; + uint8_t rpl_dio_prefixlen; /* in bits */ + uint8_t rpl_dio_prf; /* flags, including Route Preference */ + uint32_t rpl_dio_prefixlifetime; /* in seconds */ #if 0 - u_int8_t rpl_dio_prefix[0]; /* variable number of bytes */ + uint8_t rpl_dio_prefix[0]; /* variable number of bytes */ #endif }; /* section 6.4.1, DODAG Information Object (DIO) */ struct nd_rpl_dao { - u_int8_t rpl_instanceid; - u_int8_t rpl_flags; /* bit 7=K, 6=D */ - u_int8_t rpl_resv; - u_int8_t rpl_daoseq; - u_int8_t rpl_dagid[DAGID_LEN]; /* present when D set. */ + uint8_t rpl_instanceid; + uint8_t rpl_flags; /* bit 7=K, 6=D */ + uint8_t rpl_resv; + uint8_t rpl_daoseq; + uint8_t rpl_dagid[DAGID_LEN]; /* present when D set. */ }; #define ND_RPL_DAO_MIN_LEN 4 /* length without DAGID */ @@ -137,22 +137,22 @@ struct nd_rpl_dao { #define RPL_DAO_D(X) (((X)&RPL_DAO_D_MASK) >> RPL_DAO_D_SHIFT) struct rpl_dao_target { - u_int8_t rpl_dao_type; - u_int8_t rpl_dao_len; - u_int8_t rpl_dao_flags; /* unused */ - u_int8_t rpl_dao_prefixlen; /* in bits */ + uint8_t rpl_dao_type; + uint8_t rpl_dao_len; + uint8_t rpl_dao_flags; /* unused */ + uint8_t rpl_dao_prefixlen; /* in bits */ #if 0 - u_int8_t rpl_dao_prefix[0]; /* variable number of bytes */ + uint8_t rpl_dao_prefix[0]; /* variable number of bytes */ #endif }; /* section 6.5.1, Destination Advertisement Object Acknowledgement (DAO-ACK) */ struct nd_rpl_daoack { - u_int8_t rpl_instanceid; - u_int8_t rpl_flags; /* bit 7=D */ - u_int8_t rpl_daoseq; - u_int8_t rpl_status; - u_int8_t rpl_dagid[DAGID_LEN]; /* present when D set. */ + uint8_t rpl_instanceid; + uint8_t rpl_flags; /* bit 7=D */ + uint8_t rpl_daoseq; + uint8_t rpl_status; + uint8_t rpl_dagid[DAGID_LEN]; /* present when D set. */ }; #define ND_RPL_DAOACK_MIN_LEN 4 /* length without DAGID */ /* indicates if the DAGID is present */ diff --git a/tcp.h b/tcp.h index 9d10c6cd..d48b8304 100644 --- a/tcp.h +++ b/tcp.h @@ -33,21 +33,21 @@ * @(#)tcp.h 8.1 (Berkeley) 6/10/93 */ -typedef u_int32_t tcp_seq; +typedef uint32_t tcp_seq; /* * TCP header. * Per RFC 793, September, 1981. */ struct tcphdr { - u_int16_t th_sport; /* source port */ - u_int16_t th_dport; /* destination port */ + uint16_t th_sport; /* source port */ + uint16_t th_dport; /* destination port */ tcp_seq th_seq; /* sequence number */ tcp_seq th_ack; /* acknowledgement number */ - u_int8_t th_offx2; /* data offset, rsvd */ - u_int8_t th_flags; - u_int16_t th_win; /* window */ - u_int16_t th_sum; /* checksum */ - u_int16_t th_urp; /* urgent pointer */ + uint8_t th_offx2; /* data offset, rsvd */ + uint8_t th_flags; + uint16_t th_win; /* window */ + uint16_t th_sum; /* checksum */ + uint16_t th_urp; /* urgent pointer */ } UNALIGNED; #define TH_OFF(th) (((th)->th_offx2 & 0xf0) >> 4) diff --git a/tcpdump-stdinc.h b/tcpdump-stdinc.h index 0a94bb59..cf763cff 100644 --- a/tcpdump-stdinc.h +++ b/tcpdump-stdinc.h @@ -44,7 +44,6 @@ #include #include #include -#include "bittypes.h" #include #include #include @@ -56,6 +55,84 @@ #define NBBY 8 #endif +#ifndef uint8_t +#define uint8_t unsigned char +#endif + +#ifndef int8_t +#define int8_t signed char +#endif + +#ifndef uint16_t +#define uint16_t unsigned short +#endif + +#ifndef int16_t +#define int16_t signed short +#endif + +#ifndef uint32_t +#define uint32_t unsigned int +#endif + +#ifndef int32_t +#define int32_t signed int +#endif + +#ifdef _MSC_EXTENSIONS + +#ifndef uint64_t +#define uint64_t unsigned _int64 +#endif + +#ifndef int64_t +#define int64_t _int64 +#endif + +#ifndef PRId64 +#define PRId64 "I64d" +#endif + +#ifndef PRIo64 +#define PRIo64 "I64o" +#endif + +#ifndef PRIu64 +#define PRIu64 "I64u" +#endif + +#ifndef PRIx64 +#define PRIx64 "I64x" +#endif + +#else /* _MSC_EXTENSIONS */ + +#ifndef uint64_t +#define uint64_t unsigned long long +#endif + +#ifndef int64_t +#define int64_t long long +#endif + +#ifndef PRId64 +#define PRId64 "lld" +#endif + +#ifndef PRIo64 +#define PRIo64 "llo" +#endif + +#ifndef PRIu64 +#define PRIu64 "llu" +#endif + +#ifndef PRIx64 +#define PRIx64 "llx" +#endif + +#endif /* _MSC_EXTENSIONS */ + #if !defined(__MINGW32__) && !defined(__WATCOMC__) #define stat _stat #define open _open diff --git a/udp.h b/udp.h index 084fe843..4bc90a79 100644 --- a/udp.h +++ b/udp.h @@ -38,10 +38,10 @@ * Per RFC 768, September, 1981. */ struct udphdr { - 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 */ + uint16_t uh_sport; /* source port */ + uint16_t uh_dport; /* destination port */ + uint16_t uh_ulen; /* udp length */ + uint16_t uh_sum; /* udp checksum */ }; #define TFTP_PORT 69 /*XXX*/ diff --git a/win32/Include/bittypes.h b/win32/Include/bittypes.h deleted file mode 100644 index 95aa9faa..00000000 --- a/win32/Include/bittypes.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 1999 WIDE Project. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -#ifndef _BITTYPES_H -#define _BITTYPES_H - -#ifndef HAVE_U_INT8_T -typedef unsigned char u_int8_t; -typedef signed char int8_t; -#endif /* HAVE_U_INT8_T */ - -#ifndef HAVE_U_INT16_T -typedef unsigned short u_int16_t; -typedef signed short int16_t; -#endif /* HAVE_U_INT16_T */ - -#ifndef HAVE_U_INT32_T -typedef unsigned int u_int32_t; -typedef signed int int32_t; -#endif /* HAVE_U_INT32_T */ - -#ifndef HAVE_U_INT64_T -#ifdef _MSC_EXTENSIONS -typedef unsigned _int64 u_int64_t; -typedef _int64 int64_t; -#else /* _MSC_EXTENSIONS */ -typedef unsigned long long u_int64_t; -typedef long long int64_t; -#endif /* _MSC_EXTENSIONS */ -#endif /* HAVE_U_INT64_T */ - -#ifndef PRId64 -#ifdef _MSC_EXTENSIONS -#define PRId64 "I64d" -#else /* _MSC_EXTENSIONS */ -#define PRId64 "lld" -#endif /* _MSC_EXTENSIONS */ -#endif /* PRId64 */ - -#ifndef PRIo64 -#ifdef _MSC_EXTENSIONS -#define PRIo64 "I64o" -#else /* _MSC_EXTENSIONS */ -#define PRIo64 "llo" -#endif /* _MSC_EXTENSIONS */ -#endif /* PRIo64 */ - -#ifndef PRIx64 -#ifdef _MSC_EXTENSIONS -#define PRIx64 "I64x" -#else /* _MSC_EXTENSIONS */ -#define PRIx64 "llx" -#endif /* _MSC_EXTENSIONS */ -#endif /* PRIx64 */ - -#ifndef PRIu64 -#ifdef _MSC_EXTENSIONS -#define PRIu64 "I64u" -#else /* _MSC_EXTENSIONS */ -#define PRIu64 "llu" -#endif /* _MSC_EXTENSIONS */ -#endif /* PRIu64 */ - -#endif /* _BITTYPES_H */