Changeset d439067 for lib/protocols_l2.c


Ignore:
Timestamp:
12/10/18 15:59:45 (2 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
develop
Children:
10fd24b
Parents:
418c78d
Message:

Move packet cached fields into a distinct structure.

This will help tidy up the packet structure a little, as well as
simplify the cache clearing process (and maybe even speed it up
a little).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/protocols_l2.c

    r2193905 rd439067  
    181181                        (dest - (char *)packet->payload));
    182182                packet->payload = nextpayload - (dest - (char *)packet->payload);
    183                 packet->l2_header = NULL;
     183                packet->cached.l2_header = NULL;
    184184        }
    185185       
     
    456456                remaining = &dummyrem;
    457457
    458         if (packet->l2_header) {
     458        if (packet->cached.l2_header) {
    459459                /* Use cached values */
    460                 *linktype = packet->link_type;
    461                 *remaining = packet->l2_remaining;
    462                 return packet->l2_header;
     460                *linktype = packet->cached.link_type;
     461                *remaining = packet->cached.l2_remaining;
     462                return packet->cached.l2_header;
    463463        }
    464464
     
    487487                case TRACE_TYPE_NONDATA:
    488488                case TRACE_TYPE_OPENBSD_LOOP:
    489                         ((libtrace_packet_t*)packet)->l2_header = meta;
    490                         ((libtrace_packet_t*)packet)->l2_remaining = *remaining;
     489                        ((libtrace_packet_t*)packet)->cached.l2_header = meta;
     490                        ((libtrace_packet_t*)packet)->cached.l2_remaining = *remaining;
    491491                        return meta;
    492492                case TRACE_TYPE_LINUX_SLL:
     
    525525                                case TRACE_TYPE_NONDATA:
    526526                                case TRACE_TYPE_OPENBSD_LOOP:
    527                                         ((libtrace_packet_t*)packet)->l2_header = meta;
    528                                         ((libtrace_packet_t*)packet)->l2_remaining = *remaining;
     527                                        ((libtrace_packet_t*)packet)->cached.l2_header = meta;
     528                                        ((libtrace_packet_t*)packet)->cached.l2_remaining = *remaining;
    529529                                        return meta;
    530530                                case TRACE_TYPE_LINUX_SLL:
Note: See TracChangeset for help on using the changeset viewer.