Changeset 5d4e520


Ignore:
Timestamp:
10/28/08 17:34:47 (12 years ago)
Author:
Perry Lorier <perry@…>
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:
aa22b5b
Parents:
37f2a9b
Message:

Deal with endianness better

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_tsh.c

    rf0fb38f r5d4e520  
    5050typedef struct tsh_pkt_header_t {
    5151        uint32_t seconds;
    52         LT_BITFIELD32 iface:8;
    53         LT_BITFIELD32 usecs:24;
     52        uint32_t usecs;
    5453} tsh_pkt_header_t;
    5554
     
    187186
    188187static libtrace_direction_t tsh_get_direction(const libtrace_packet_t *packet) {
    189         return ((tsh_pkt_header_t*)(packet->header))->iface;
     188        return ntohl(((tsh_pkt_header_t*)(packet->header))->usecs & htonl(0xFF000000)) >> 24;
    190189}
    191190
     
    194193        struct timeval tv;
    195194        tv.tv_sec=ntohl(((tsh_pkt_header_t*)(packet->header))->seconds);
    196         tv.tv_usec=ntohl(((tsh_pkt_header_t*)(packet->header))->usecs);
     195        tv.tv_usec=ntohl(((tsh_pkt_header_t*)(packet->header))->usecs & htonl(0x00FFFFFF));
    197196
    198197        return tv;
Note: See TracChangeset for help on using the changeset viewer.