Changeset 8889370 for lib/protocols.c


Ignore:
Timestamp:
09/21/06 16:29:24 (15 years ago)
Author:
Scott Raynel <smr26@…>
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:
52c7cda
Parents:
7e758fc
Message:

trace_get_payload_from_linux_sll now returns a pointer to the start of the next header intead of trying to jump through the next one. It also returns the hardware address type instead of the protocol type now. trace_get_payload_from_link has been updated to recurse to step through the protocols. This makes _from_linux_sll more like the rest of the functions in protocols.c.
We also now have arphrd_type_to_libtrace() and libtrace_to_arphrd_type() functions to help with this.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/protocols.c

    rbad6a93 r8889370  
    110110}
    111111
     112/* NB: type is returned as an ARPHRD_ type for SLL*/
    112113static void *trace_get_payload_from_linux_sll(void *link,
    113114                uint16_t *type, uint32_t *remaining)
     
    125126
    126127        /* What kind of wacked out header, has this in host order?! */
    127         if (type) *type = htons(sll->protocol);
    128 
    129         ret=(void*)((char*)sll+sizeof(*sll));
    130 
    131         switch(sll->hatype) {
    132                 case ARPHRD_PPP:
    133                         break;
    134                 case ARPHRD_ETHER:
    135                         ret=trace_get_payload_from_ethernet(ret,type,remaining);
    136                         break;
    137                 default:
    138                         /* Unknown hardware type */
    139                         return NULL;
    140         }
    141 
    142         return ret;
     128        //if (type) *type = htons(sll->protocol);
     129
     130        if (type) *type = ntohs(sll->hatype);
     131
     132        return (void*)((char*)sll+sizeof(*sll));
     133
    143134}
    144135
     
    240231{
    241232        void *l = NULL;
    242 
     233        uint16_t dummytype;
     234       
    243235        switch(linktype) {
    244236                case TRACE_TYPE_80211_PRISM:
     
    260252                        return link; /* I love the simplicity */
    261253                case TRACE_TYPE_LINUX_SLL:
    262                         return trace_get_payload_from_linux_sll(link,type,remaining);
     254                        l = trace_get_payload_from_linux_sll(link,&dummytype,remaining);
     255                        if (type) *type = dummytype;
     256                        return (l ? trace_get_payload_from_link(l,
     257                                                arphrd_type_to_libtrace(dummytype), type, remaining) : NULL);
     258                       
    263259                case TRACE_TYPE_PFLOG:
    264260                        return trace_get_payload_from_pflog(link,type,remaining);
Note: See TracChangeset for help on using the changeset viewer.