Changeset dd06159


Ignore:
Timestamp:
09/13/07 16:51:57 (14 years ago)
Author:
Perry Lorier <perry@…>
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:
4c1302b
Parents:
394706e
Message:

Add support for cisco hdlc over pos

Location:
lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • lib/format_legacy.c

    r1344aa8 rdd06159  
    270270               
    271271
    272 static libtrace_linktype_t legacypos_get_link_type(const libtrace_packet_t *packet UNUSED) {
     272static 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;
    273280        return TRACE_TYPE_PPP;
    274281}
    275282
    276 static libtrace_linktype_t legacyatm_get_link_type(const libtrace_packet_t *packet UNUSED) {
     283static libtrace_linktype_t legacyatm_get_link_type(
     284                const libtrace_packet_t *packet UNUSED) {
    277285        return TRACE_TYPE_ATM;
    278286}
  • lib/linktypes.c

    r9bc4689 rdd06159  
    6969                case TRACE_TYPE_LLCSNAP: return TRACE_DLT_ATM_RFC1483;
    7070                case TRACE_TYPE_PPP:    return TRACE_DLT_PPP;
     71                case TRACE_TYPE_HDLC_POS: return TRACE_DLT_C_HDLC;
    7172                /* Below here are unsupported conversions */
    7273                /* Dispite hints to the contrary, there is no DLT
     
    8687                /* TODO: We haven't researched these yet */
    8788                case TRACE_TYPE_AAL5:
    88                 case TRACE_TYPE_HDLC_POS:
    8989                case TRACE_TYPE_METADATA:
    9090                        break;
  • lib/protocols.c

    r9bc4689 rdd06159  
    233233
    234234        return (void*)((char *)ppp+sizeof(*ppp));
     235}
     236
     237typedef 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
     243static 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));
    235260}
    236261
     
    381406        void *trans_ptr = 0;
    382407
    383         if ((ipptr->ip_off & SW_IP_OFFMASK) != 0) {
     408        if ((ntohs(ipptr->ip_off) & SW_IP_OFFMASK) != 0) {
    384409                return NULL;
    385410        }
     
    460485                case TRACE_TYPE_80211_PRISM:
    461486                        return pktbuf;
     487                /* Non metadata packets */
    462488                case TRACE_TYPE_HDLC_POS:
    463489                case TRACE_TYPE_ETH:
     
    605631                        return trace_get_payload_from_llcsnap(link,ethertype,remaining);
    606632
     633                case TRACE_TYPE_HDLC_POS:
     634                        return trace_get_payload_from_chdlc(link,ethertype,
     635                                        remaining);
    607636                /* TODO: Unsupported */
    608                 case TRACE_TYPE_HDLC_POS:
    609637                case TRACE_TYPE_POS:
    610638                case TRACE_TYPE_AAL5:
Note: See TracChangeset for help on using the changeset viewer.