Changeset 531


Ignore:
Timestamp:
11/29/05 11:17:28 (7 years ago)
Author:
dlawson
Message:

fixes for legacy format reads

Location:
branches/libtrace-2_0_25/libpacketdump
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/libtrace-2_0_25/libpacketdump/libpacketdump.cc

    r501 r531  
    6464 
    6565        printf("%s",ctime(&sec)); 
    66         decode_next(link,packet->size-(link-packet->buffer),"link",trace_get_link_type(packet)); 
     66        decode_next(link,packet->size-trace_get_framing_length(packet),"link",trace_get_link_type(packet)); 
    6767} 
    6868 
  • branches/libtrace-2_0_25/libpacketdump/link_10.cc

    r445 r531  
    66#include <map> 
    77#include "libpacketdump.h" 
     8#include "libtrace.h" 
    89 
    910extern "C" 
    1011void decode(int link_type,char *packet,int len) 
    1112{ 
    12         printf(" Legacy ATM:"); 
    13         /* 
    14         if (len>=6) 
    15                 printf(" %s",ether_ntoa((struct ether_addr*)packet)); 
    16         else { 
    17                 printf("[|Truncated]\n"); 
    18                 return; 
    19         } 
    20         if (len>=12)  
    21                 printf(" %s",ether_ntoa((struct ether_addr*)(packet+6))); 
    22         else { 
    23                 printf("[|Truncated]\n"); 
    24                 return; 
    25         } 
    26         */ 
    27         if (len>=24) { 
    28                 uint16_t type = htons(*(uint16_t*)(packet+22)); 
     13        // ATM 
     14        printf(" Legacy Framing:"); 
     15        if (len>=12) { 
     16                uint16_t type = htons(*(uint16_t*)(packet+sizeof(libtrace_atm_cell)+4)); 
    2917                printf(" %04x\n",type); 
    30                 decode_next(packet+24,len-24,"eth",type); 
     18                decode_next(packet+sizeof(libtrace_atm_cell) +4 , 
     19                                len-sizeof(libtrace_atm_cell) + 4, 
     20                                "eth",type); 
    3121        } 
    3222        else { 
  • branches/libtrace-2_0_25/libpacketdump/link_11.cc

    r445 r531  
    1111void decode(int link_type,char *packet,int len) 
    1212{ 
     13        // Ethernet - just raw ethernet frames 
    1314        printf(" Legacy Framing: "); 
    1415        if (len>=10) { 
    15                 decode_next(packet+10,len-10,"link",2); 
     16                decode_next(packet,len,"link",2); 
    1617        } 
    1718        else { 
  • branches/libtrace-2_0_25/libpacketdump/link_9.cc

    r445 r531  
    1010void decode(int link_type,char *packet,int len) 
    1111{ 
    12         printf(" Legacy POS:"); 
    13         /* 
    14         if (len>=6) 
    15                 printf(" %s",ether_ntoa((struct ether_addr*)packet)); 
    16         else { 
    17                 printf("[|Truncated]\n"); 
    18                 return; 
    19         } 
    20         if (len>=12)  
    21                 printf(" %s",ether_ntoa((struct ether_addr*)(packet+6))); 
    22         else { 
    23                 printf("[|Truncated]\n"); 
    24                 return; 
    25         } 
    26         */ 
    27         if (len>=20) { 
    28                 uint16_t type = htons(*(uint16_t*)(packet+18)); 
     12        // POS 
     13        printf(" Legacy Framing:"); 
     14        // Take into account llc 
     15        if (len>=4) { 
     16                uint16_t type = htons( 
     17                                ((libtrace_pos *)packet)->ether_type); 
    2918                printf(" %04x\n",type); 
    30                 decode_next(packet+20,len-20,"eth",type); 
     19                decode_next(packet+sizeof(libtrace_pos), 
     20                                len-sizeof(libtrace_pos), 
     21                                "eth",type); 
    3122        } 
    3223        else { 
Note: See TracChangeset for help on using the changeset viewer.