Changeset 4c90362 for libpacketdump
- Timestamp:
- 03/10/11 16:24:57 (11 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:
- 99425f8
- Parents:
- 8ccb7897
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libpacketdump/link_6.c
re4e94c38 r4c90362 13 13 14 14 #include "arphrd.h" 15 16 /* Copied this here because this isn't currently part of our external API - 17 * maybe we need to think about doing that? */ 18 libtrace_linktype_t arphrd_type_to_libtrace(unsigned int arphrd) { 19 switch(arphrd) { 20 case ARPHRD_ETHER: return TRACE_TYPE_ETH; 21 case ARPHRD_EETHER: return TRACE_TYPE_ETH; 22 case ARPHRD_IEEE80211: return TRACE_TYPE_80211; 23 case ARPHRD_80211_RADIOTAP: return TRACE_TYPE_80211_RADIO; 24 case ARPHRD_PPP: return TRACE_TYPE_NONE; 25 case ARPHRD_LOOPBACK: return TRACE_TYPE_NONE; 26 case ARPHRD_NONE: return TRACE_TYPE_NONE; 27 } 28 printf("Unknown ARPHRD: %u\n", arphrd); 29 return ~0U; 30 } 15 31 16 32 DLLEXPORT void decode(int link_type ,const char *pkt,unsigned len) … … 47 63 48 64 if (ntohs(sll->hatype) == ARPHRD_ETHER || 49 ntohs(sll->hatype) == ARPHRD_LOOPBACK) 50 decode_next(pkt + sizeof(*sll), len - sizeof(*sll), "eth", ntohs(sll->protocol)); 51 52 else 53 decode_next(ret, len, "link", ntohs(sll->hatype)); 54 65 ntohs(sll->hatype) == ARPHRD_LOOPBACK) { 66 67 if (ntohs(sll->protocol) == 0x0060) { 68 decode_next(ret, len, "link", 69 arphrd_type_to_libtrace(ntohs(sll->hatype))); 70 } 71 else 72 decode_next(pkt + sizeof(*sll), len - sizeof(*sll), 73 "eth", ntohs(sll->protocol)); 74 } 75 else { 76 decode_next(ret, len, "link", 77 arphrd_type_to_libtrace(ntohs(sll->hatype))); 78 } 55 79 return; 56 80
Note: See TracChangeset
for help on using the changeset viewer.