Changeset 11041eb
- Timestamp:
- 07/02/13 14:19:40 (8 years ago)
- Branches:
- 4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
- Children:
- da46c9d
- Parents:
- fdb5e98
- Location:
- lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/format_pcapfile.c
rc909fad r11041eb 456 456 } 457 457 458 hdr.ts_sec = tv.tv_sec; 459 hdr.ts_usec = tv.tv_usec; 458 459 hdr.ts_sec = (uint32_t)tv.tv_sec; 460 hdr.ts_usec = (uint32_t)tv.tv_usec; 460 461 hdr.caplen = trace_get_capture_length(packet); 461 462 assert(hdr.caplen < LIBTRACE_PACKET_BUFSIZE); -
lib/libtrace.h.in
rd57ae6f r11041eb 65 65 #ifndef WIN32 66 66 #include <sys/time.h> 67 #endif 68 69 /* Deal with missing byte order macros */ 70 #include <sys/param.h> 71 72 #if defined(BYTE_ORDER) && !defined(__BYTE_ORDER) 73 #define __BYTE_ORDER BYTE_ORDER 74 #endif 75 76 #if defined(BIG_ENDIAN) && !defined(__BIG_ENDIAN) 77 #define __BIG_ENDIAN BIG_ENDIAN 78 #endif 79 80 #if defined(LITTLE_ENDIAN) && !defined(__LITTLE_ENDIAN) 81 #define __LITTLE_ENDIAN LITTLE_ENDIAN 67 82 #endif 68 83 … … 510 525 typedef struct libtrace_ip 511 526 { 512 #if BYTE_ORDER ==LITTLE_ENDIAN527 #if __BYTE_ORDER == __LITTLE_ENDIAN 513 528 LT_BITFIELD8 ip_hl:4; /**< Header Length */ 514 529 LT_BITFIELD8 ip_v:4; /**< Version */ 515 #elif BYTE_ORDER ==BIG_ENDIAN530 #elif __BYTE_ORDER == __BIG_ENDIAN 516 531 LT_BITFIELD8 ip_v:4; /**< Version */ 517 532 LT_BITFIELD8 ip_hl:4; /**< Header Length */ … … 567 582 uint32_t seq; /**< Sequence number */ 568 583 uint32_t ack_seq; /**< Acknowledgement Number */ 569 # if BYTE_ORDER ==LITTLE_ENDIAN584 # if __BYTE_ORDER == __LITTLE_ENDIAN 570 585 LT_BITFIELD8 ecn_ns:1; /**< ECN Nonce Sum */ 571 586 LT_BITFIELD8 res1:3; /**< Reserved bits */ … … 579 594 LT_BITFIELD8 ece:1; /**< ECN Echo */ 580 595 LT_BITFIELD8 cwr:1; /**< ECN CWR */ 581 # elif BYTE_ORDER ==BIG_ENDIAN596 # elif __BYTE_ORDER == __BIG_ENDIAN 582 597 LT_BITFIELD8 doff:4; /**< Data offset */ 583 598 LT_BITFIELD8 res1:3; /**< Reserved bits */ … … 758 773 /** 802.11 header */ 759 774 typedef struct libtrace_80211_t { 760 #if BYTE_ORDER ==LITTLE_ENDIAN775 #if __BYTE_ORDER == __LITTLE_ENDIAN 761 776 LT_BITFIELD32 protocol:2; /**< Protocol Version */ 762 777 LT_BITFIELD32 type:2; /**< Frame Type */ … … 768 783 #endif 769 784 770 #if BYTE_ORDER ==LITTLE_ENDIAN785 #if __BYTE_ORDER == __LITTLE_ENDIAN 771 786 LT_BITFIELD32 to_ds:1; /**< Packet to Distribution Service */ 772 787 LT_BITFIELD32 from_ds:1; /**< Packet from Distribution Service */ … … 828 843 /** Options Field present in some OSPFv2 packets */ 829 844 typedef struct libtrace_ospf_options_t { 830 #if BYTE_ORDER ==LITTLE_ENDIAN845 #if __BYTE_ORDER == __LITTLE_ENDIAN 831 846 LT_BITFIELD8 unused1:1; 832 847 LT_BITFIELD8 e_bit:1; … … 836 851 LT_BITFIELD8 dc_bit:1; 837 852 LT_BITFIELD8 unused2:2; 838 #elif BYTE_ORDER ==BIG_ENDIAN853 #elif __BYTE_ORDER == __BIG_ENDIAN 839 854 LT_BITFIELD8 unused2:2; 840 855 LT_BITFIELD8 dc_bit:1; … … 880 895 uint16_t mtu; /**< Interface MTU */ 881 896 libtrace_ospf_options_t db_desc_options; /**< Options */ 882 #if BYTE_ORDER ==LITTLE_ENDIAN897 #if __BYTE_ORDER == __LITTLE_ENDIAN 883 898 LT_BITFIELD8 db_desc_ms:1; /**< If set, this router is the master */ 884 899 LT_BITFIELD8 db_desc_m:1; /**< If set, more packets to follow */ 885 900 LT_BITFIELD8 db_desc_i:1; /**< If set, this is the first packet in sequence */ 886 901 LT_BITFIELD8 zero:5; 887 #elif BYTE_ORDER ==BIG_ENDIAN902 #elif __BYTE_ORDER == __BIG_ENDIAN 888 903 LT_BITFIELD8 zero:5; 889 904 LT_BITFIELD8 db_desc_i:1; /**< If set, this is the first packet in sequence */ … … 914 929 { 915 930 struct in_addr netmask; /**< Netmask for the destination */ 916 #if BYTE_ORDER ==LITTLE_ENDIAN931 #if __BYTE_ORDER == __LITTLE_ENDIAN 917 932 LT_BITFIELD8 tos:7; 918 933 LT_BITFIELD8 e:1; /**< If set, metric is Type 2. Else, Type 1 */ 919 #elif BYTE_ORDER ==BIG_ENDIAN934 #elif __BYTE_ORDER == __BIG_ENDIAN 920 935 LT_BITFIELD8 e:1; /**< If set, metric is Type 2. Else, Type 1 */ 921 936 LT_BITFIELD8 tos:7; … … 959 974 typedef struct libtrace_ospf_router_lsa_t 960 975 { 961 #if BYTE_ORDER ==LITTLE_ENDIAN976 #if __BYTE_ORDER == __LITTLE_ENDIAN 962 977 LT_BITFIELD8 b:1; /**< Area Border Router Flag */ 963 978 LT_BITFIELD8 e:1; /**< External Router Flag */ 964 979 LT_BITFIELD8 v:1; /**< Virtual Endpoint Flag */ 965 980 LT_BITFIELD8 zero:5; 966 #elif BYTE_ORDER ==BIG_ENDIAN981 #elif __BYTE_ORDER == __BIG_ENDIAN 967 982 LT_BITFIELD8 zero:5; 968 983 LT_BITFIELD8 v:1; /**< Virtual Endpoint Flag */ -
lib/trace.c
ra464de7 r11041eb 48 48 #endif 49 49 #include <stdarg.h> 50 #include <sys/param.h> 50 51 51 52 #ifdef HAVE_LIMITS_H … … 923 924 #if __BYTE_ORDER == __BIG_ENDIAN 924 925 tv.tv_sec = ts & 0xFFFFFFFF; 926 tv.tv_usec = ((ts >> 32) * 1000000) & 0xFFFFFFFF; 925 927 #elif __BYTE_ORDER == __LITTLE_ENDIAN 926 928 tv.tv_sec = ts >> 32; 929 tv.tv_usec = ((ts&0xFFFFFFFF)*1000000)>>32; 927 930 #else 928 931 #error "What on earth are you running this on?" 929 932 #endif 930 tv.tv_usec = ((ts&0xFFFFFFFF)*1000000)>>32;931 933 if (tv.tv_usec >= 1000000) { 932 934 tv.tv_usec -= 1000000; … … 961 963 #if __BYTE_ORDER == __BIG_ENDIAN 962 964 ts.tv_sec = erfts & 0xFFFFFFFF; 965 tv.tv_nsec = ((ts >> 32) * 1000000000) & 0xFFFFFFFF; 963 966 #elif __BYTE_ORDER == __LITTLE_ENDIAN 964 967 ts.tv_sec = erfts >> 32; 968 ts.tv_nsec = ((erfts&0xFFFFFFFF)*1000000000)>>32; 965 969 #else 966 970 #error "What on earth are you running this on?" 967 971 #endif 968 ts.tv_nsec = ((erfts&0xFFFFFFFF)*1000000000)>>32;969 972 if (ts.tv_nsec >= 1000000000) { 970 973 ts.tv_nsec -= 1000000000; … … 1636 1639 #if __BYTE_ORDER == __BIG_ENDIAN 1637 1640 tv.tv_sec = ts & 0xFFFFFFFF; 1641 tv.tv_usec = ((ts >> 32) * 1000000) & 0xFFFFFFFF; 1638 1642 #elif __BYTE_ORDER == __LITTLE_ENDIAN 1639 1643 tv.tv_sec = ts >> 32; 1644 tv.tv_usec = ((ts&0xFFFFFFFF)*1000000)>>32; 1640 1645 #else 1641 1646 #error "What on earth are you running this on?" 1642 1647 #endif 1643 tv.tv_usec = ((ts&0xFFFFFFFF)*1000000)>>32;1644 1648 if (tv.tv_usec >= 1000000) { 1645 1649 tv.tv_usec -= 1000000;
Note: See TracChangeset
for help on using the changeset viewer.