Changeset d439067 for lib/libtrace.h.in


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/libtrace.h.in

    r509ee47 rd439067  
    577577} libtrace_ethertype_t;
    578578
    579 /** The libtrace packet structure. Applications shouldn't be
    580  * meddling around in here
    581  */
    582 typedef struct libtrace_packet_t {
    583         struct libtrace_t *trace;       /**< Pointer to the trace */
    584         void *header;                   /**< Pointer to the framing header */
    585         void *payload;                  /**< Pointer to the link layer */
    586         void *buffer;                   /**< Allocated buffer */
    587         libtrace_rt_types_t  type;      /**< RT protocol type for the packet */
    588         buf_control_t buf_control;      /**< Describes memory ownership */
     579typedef struct libtrace_packet_cache {
    589580        int capture_length;             /**< Cached capture length */
    590581        int wire_length;                /**< Cached wire length */
     
    600591        uint8_t transport_proto;        /**< Cached transport protocol */
    601592        uint32_t l4_remaining;          /**< Cached transport remaining */
     593} libtrace_packet_cache_t;
     594
     595/** The libtrace packet structure. Applications shouldn't be
     596 * meddling around in here
     597 */
     598typedef struct libtrace_packet_t {
     599        struct libtrace_t *trace;       /**< Pointer to the trace */
     600        void *header;                   /**< Pointer to the framing header */
     601        void *payload;                  /**< Pointer to the link layer */
     602        void *buffer;                   /**< Allocated buffer */
     603        libtrace_rt_types_t  type;      /**< RT protocol type for the packet */
     604        buf_control_t buf_control;      /**< Describes memory ownership */
     605        libtrace_packet_cache_t cached; /**< Cached packet properties / headers */
    602606        uint64_t order; /**< Notes the order of this packet in relation to the input */
    603607        uint64_t hash; /**< A hash of the packet as supplied by the user */
Note: See TracChangeset for help on using the changeset viewer.