Changeset 7c72e4d for lib/libtrace.h.in


Ignore:
Timestamp:
06/20/07 13:10:40 (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:
8ee3dbd
Parents:
f93f0b3
Message:

Add caching of trace_get_capture_length() (since this is used a lot in protocol
decodes to figure out if we captured the full header we're about to decode).

Add caching of the l3 header (avoiding parsing the linktype/l2/l2.5 protocol
headers).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/libtrace.h.in

    r67b0d4d r7c72e4d  
    323323        libtrace_rt_types_t  type;      /**< rt protocol type for the packet */
    324324        buf_control_t buf_control;      /**< who owns the memory */
     325        int capture_length;             /**< Cached capture length */
     326        void *l3_header;                /**< Cached l3 header */
     327        uint16_t l3_ethertype;          /**< Cached l3 ethertype */
    325328} libtrace_packet_t;
    326329
     
    946949void *trace_get_link(const libtrace_packet_t *packet);
    947950
    948 /** get a pointer to the IP header (if any)
    949  * @param packet        the packet opaque pointer
    950  *
    951  * @return a pointer to the IP header, or NULL if there is no IP header
     951/** get a pointer to the IPv4 header (if any)
     952 * @param packet        the packet opaque pointer
     953 *
     954 * @return a pointer to the IPv4 header, or NULL if there is no IPv4 header
    952955 */
    953956DLLEXPORT SIMPLE_FUNCTION
     
    961964DLLEXPORT SIMPLE_FUNCTION
    962965libtrace_ip6_t *trace_get_ip6(libtrace_packet_t *packet);
     966
     967/** Get a pointer to the layer 3 header.
     968 * @param packet                The packet opaque pointer
     969 * @param[out] ethertype        The ethertype of the layer 3 header
     970 * @param[out] remaining        The amount of space available after this header
     971 *                              has been removed.
     972 *
     973 * @return a pointer to the layer 3 header.
     974 * remaining may be NULL, otherwise it will be filled in by the remaining size
     975 * of the captured packet.
     976 */
     977DLLEXPORT SIMPLE_FUNCTION
     978void *trace_get_layer3(libtrace_packet_t *packet,
     979                uint16_t *ethertype, uint32_t *remaining);
    963980
    964981/** Gets a pointer to the transport layer header (if any)
     
    13121329 */
    13131330DLLEXPORT SIMPLE_FUNCTION
    1314 size_t trace_get_capture_length(const libtrace_packet_t *packet);
     1331size_t trace_get_capture_length(libtrace_packet_t *packet);
    13151332
    13161333/** Get the size of the packet as it was seen on the wire.
Note: See TracChangeset for help on using the changeset viewer.