Changeset 1375

Show
Ignore:
Timestamp:
28/10/08 17:34:47 (2 months ago)
Author:
perry
Message:

Deal with endianness better

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/format_tsh.c

    r1332 r1375  
    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;