Changeset 1276
- Timestamp:
- 09/13/07 16:51:57 (6 years ago)
- Location:
- trunk/lib
- Files:
-
- 3 edited
-
format_legacy.c (modified) (1 diff)
-
linktypes.c (modified) (2 diffs)
-
protocols.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/format_legacy.c
r1243 r1276 270 270 271 271 272 static libtrace_linktype_t legacypos_get_link_type(const libtrace_packet_t *packet UNUSED) { 272 static libtrace_linktype_t legacypos_get_link_type( 273 const libtrace_packet_t *packet) { 274 /* Is this a cisco hdlc frame? */ 275 if ((((uint8_t*)packet->payload)[0] == 0x0F /* Unicast */ 276 || ((uint8_t*)packet->payload)[0] == 0x8F /* Multicast */) 277 && ((uint8_t*)packet->payload)[1] == 0x00 /* control == 0x00 */ 278 ) 279 return TRACE_TYPE_HDLC_POS; 273 280 return TRACE_TYPE_PPP; 274 281 } 275 282 276 static libtrace_linktype_t legacyatm_get_link_type(const libtrace_packet_t *packet UNUSED) { 283 static libtrace_linktype_t legacyatm_get_link_type( 284 const libtrace_packet_t *packet UNUSED) { 277 285 return TRACE_TYPE_ATM; 278 286 } -
trunk/lib/linktypes.c
r1269 r1276 69 69 case TRACE_TYPE_LLCSNAP: return TRACE_DLT_ATM_RFC1483; 70 70 case TRACE_TYPE_PPP: return TRACE_DLT_PPP; 71 case TRACE_TYPE_HDLC_POS: return TRACE_DLT_C_HDLC; 71 72 /* Below here are unsupported conversions */ 72 73 /* Dispite hints to the contrary, there is no DLT … … 86 87 /* TODO: We haven't researched these yet */ 87 88 case TRACE_TYPE_AAL5: 88 case TRACE_TYPE_HDLC_POS:89 89 case TRACE_TYPE_METADATA: 90 90 break; -
trunk/lib/protocols.c
r1269 r1276 233 233 234 234 return (void*)((char *)ppp+sizeof(*ppp)); 235 } 236 237 typedef struct libtrace_chdlc_t { 238 uint8_t address; /** 0xF0 for unicast, 0xF8 for multicast */ 239 uint8_t control; 240 uint16_t ethertype; 241 } libtrace_chdlc_t; 242 243 static void *trace_get_payload_from_chdlc(void *link, 244 uint16_t *type, uint32_t *remaining) 245 { 246 libtrace_chdlc_t *chdlc = (libtrace_chdlc_t*)link; 247 248 if (remaining) { 249 if (*remaining < sizeof(libtrace_chdlc_t)) 250 return NULL; 251 *remaining-=sizeof(libtrace_chdlc_t); 252 } 253 254 if (type) { 255 *type=ntohs(chdlc->ethertype); 256 } 257 258 259 return (void*)((char *)chdlc+sizeof(*chdlc)); 235 260 } 236 261 … … 381 406 void *trans_ptr = 0; 382 407 383 if (( ipptr->ip_off& SW_IP_OFFMASK) != 0) {408 if ((ntohs(ipptr->ip_off) & SW_IP_OFFMASK) != 0) { 384 409 return NULL; 385 410 } … … 460 485 case TRACE_TYPE_80211_PRISM: 461 486 return pktbuf; 487 /* Non metadata packets */ 462 488 case TRACE_TYPE_HDLC_POS: 463 489 case TRACE_TYPE_ETH: … … 605 631 return trace_get_payload_from_llcsnap(link,ethertype,remaining); 606 632 633 case TRACE_TYPE_HDLC_POS: 634 return trace_get_payload_from_chdlc(link,ethertype, 635 remaining); 607 636 /* TODO: Unsupported */ 608 case TRACE_TYPE_HDLC_POS:609 637 case TRACE_TYPE_POS: 610 638 case TRACE_TYPE_AAL5:
Note: See TracChangeset
for help on using the changeset viewer.
