Changeset 4a207b8
- Timestamp:
- 03/23/07 16:41:03 (14 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:
- dbdc23f
- Parents:
- 83f2cbf
- Location:
- lib
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/format_erf.c
rd5a27e8 r4a207b8 512 512 dag_record_t *erfptr = 0; 513 513 erfptr = (dag_record_t *)packet->header; 514 return erf_type_to_libtrace(erfptr->type); 514 if (erfptr->type != TYPE_LEGACY) 515 return erf_type_to_libtrace(erfptr->type); 516 else { 517 /* Sigh, lets start wildly guessing */ 518 if (((char*)packet->payload)[4]==0x45) 519 return TRACE_TYPE_PPP; 520 return ~0; 521 } 515 522 } 516 523 -
lib/format_legacy.c
rd5a27e8 r4a207b8 151 151 152 152 static libtrace_linktype_t legacypos_get_link_type(const libtrace_packet_t *packet UNUSED) { 153 return TRACE_TYPE_P OS;153 return TRACE_TYPE_PPP; 154 154 } 155 155 -
lib/libtrace.h.in
r2fbcb26 r4a207b8 210 210 TRACE_DLT_NULL = 0, 211 211 TRACE_DLT_EN10MB = 1, 212 TRACE_DLT_PPP = 9, 212 213 TRACE_DLT_ATM_RFC1483 = 11, 213 214 TRACE_DLT_RAW = 101, … … 236 237 TRACE_TYPE_DUCK = 14, /**< Pseudo link layer for DUCK packets */ 237 238 TRACE_TYPE_80211_RADIO = 15, /**< Radiotap + 802.11 */ 238 TRACE_TYPE_LLCSNAP = 16 /**< Raw LLC/SNAP */ 239 TRACE_TYPE_LLCSNAP = 16, /**< Raw LLC/SNAP */ 240 TRACE_TYPE_PPP = 17 /**< PPP frames */ 239 241 240 242 } libtrace_linktype_t; … … 562 564 } PACKED libtrace_atm_nni_capture_cell_t; 563 565 564 /** P OSheader */565 typedef struct libtrace_p os566 /** PPP header */ 567 typedef struct libtrace_pps 566 568 { 567 uint16_t header; 568 uint16_t ether_type; /**< Ether Type */ 569 } PACKED libtrace_pos_t; 569 uint8_t addres; /**< PPP Address (0xFF - All stations) */ 570 uint8_t header; /**< PPP Control (0x03 - Unnumbered info) */ 571 uint16_t protocol; /**< PPP Protocol (htons(0x0021) - IPv4 */ 572 } PACKED libtrace_ppp_t; 570 573 571 574 /** 802.11 header */ -
lib/linktypes.c
r4746c71 r4a207b8 42 42 case TRACE_DLT_IEEE802_11_RADIO: return TRACE_TYPE_80211_RADIO; 43 43 case TRACE_DLT_ATM_RFC1483: return TRACE_TYPE_LLCSNAP; 44 case TRACE_DLT_PPP: return TRACE_TYPE_PPP; 44 45 /* Unhandled */ 45 46 case TRACE_DLT_NULL: /* Raw IP frame with a BSD specific … … 67 68 case TRACE_TYPE_80211_RADIO: return TRACE_DLT_IEEE802_11_RADIO; 68 69 case TRACE_TYPE_LLCSNAP: return TRACE_DLT_ATM_RFC1483; 70 case TRACE_TYPE_PPP: return TRACE_DLT_PPP; 69 71 /* Below here are unsupported conversions */ 70 72 /* Dispite hints to the contrary, there is no DLT … … 80 82 /* Used for test traces within WAND */ 81 83 case TRACE_TYPE_80211_PRISM: 84 /* Probably == PPP */ 85 case TRACE_TYPE_POS: 82 86 /* TODO: We haven't researched these yet */ 83 case TRACE_TYPE_ POS:87 case TRACE_TYPE_AAL5: 84 88 case TRACE_TYPE_HDLC_POS: 85 case TRACE_TYPE_AAL5:86 89 break; 87 90 } … … 125 128 case TRACE_TYPE_80211_PRISM: 126 129 case TRACE_TYPE_80211: 127 case TRACE_TYPE_POS:128 130 case TRACE_TYPE_PFLOG: 129 131 case TRACE_TYPE_NONE: 130 132 case TRACE_TYPE_LINUX_SLL: 133 case TRACE_TYPE_PPP: 134 case TRACE_TYPE_POS: 131 135 break; 132 136 } … … 241 245 static libtrace_t *trace = NULL; 242 246 switch(trace_get_link_type(packet)) { 243 case TRACE_TYPE_POS:244 remaining=trace_get_capture_length(packet);245 packet->payload=trace_get_payload_from_pos(246 packet->payload,NULL,&remaining);247 248 tmp=(char*)malloc(249 trace_get_capture_length(packet)250 +sizeof(libtrace_pcapfile_pkt_hdr_t)251 );252 253 tv=trace_get_timeval(packet);254 ((libtrace_pcapfile_pkt_hdr_t*)tmp)->ts_sec=tv.tv_sec;255 ((libtrace_pcapfile_pkt_hdr_t*)tmp)->ts_usec=tv.tv_usec;256 ((libtrace_pcapfile_pkt_hdr_t*)tmp)->wirelen257 = trace_get_wire_length(packet)-(trace_get_capture_length(packet)-remaining);258 ((libtrace_pcapfile_pkt_hdr_t*)tmp)->caplen259 = remaining;260 261 memcpy(tmp+sizeof(libtrace_pcapfile_pkt_hdr_t),262 packet->payload,263 (size_t)remaining);264 if (packet->buf_control == TRACE_CTRL_EXTERNAL) {265 packet->buf_control=TRACE_CTRL_PACKET;266 }267 else {268 free(packet->buffer);269 }270 packet->buffer=tmp;271 packet->header=tmp;272 packet->payload=tmp+sizeof(libtrace_pcapfile_pkt_hdr_t);273 packet->type=pcap_dlt_to_rt(TRACE_DLT_RAW);274 275 if (trace == NULL) {276 trace = trace_create_dead("pcap:-");277 }278 279 packet->trace=trace;280 281 return true;282 247 case TRACE_TYPE_ATM: 283 248 remaining=trace_get_capture_length(packet); -
lib/protocols.c
reb1aab2 r4a207b8 206 206 } 207 207 208 void *trace_get_payload_from_p os(void *link,208 void *trace_get_payload_from_ppp(void *link, 209 209 uint16_t *type, uint32_t *remaining) 210 210 { 211 211 /* 64 byte capture. */ 212 libtrace_pos_t *pos = (libtrace_pos_t*)link; 213 214 if (remaining) { 215 if (*remaining < sizeof(libtrace_pos_t)) 216 return NULL; 217 *remaining-=sizeof(libtrace_pos_t); 218 } 219 220 /* This is documented by endace to be an ethertype. The ethertype 221 * however is always ntohs(0x0021), which endace in their own tools 222 * ignore and assume IP, so... 223 */ 224 /*if (type) *type = ntohs(pos->ether_type); */ 225 if (type) *type = ntohs(0x0800); 226 227 return (void*)((char *)pos+sizeof(*pos)); 212 libtrace_ppp_t *ppp = (libtrace_ppp_t*)link; 213 214 if (remaining) { 215 if (*remaining < sizeof(libtrace_ppp_t)) 216 return NULL; 217 *remaining-=sizeof(libtrace_ppp_t); 218 } 219 220 if (type) { 221 switch(ppp->protocol) { 222 case 0x0021: *type = ntohs(0x0800); 223 } 224 } 225 226 return (void*)((char *)ppp+sizeof(*ppp)); 228 227 } 229 228 … … 313 312 case TRACE_TYPE_PFLOG: 314 313 return trace_get_payload_from_pflog(link,type,remaining); 315 case TRACE_TYPE_P OS:316 return trace_get_payload_from_p os(link,type,remaining);314 case TRACE_TYPE_PPP: 315 return trace_get_payload_from_ppp(link,type,remaining); 317 316 case TRACE_TYPE_ATM: 318 317 l=trace_get_payload_from_atm(link,NULL,remaining);
Note: See TracChangeset
for help on using the changeset viewer.