Changeset 15749d5 for lib/libtrace.h.in


Ignore:
Timestamp:
09/27/10 14:01:58 (11 years ago)
Author:
Shane Alcock <salcock@…>
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:
7e8a25a
Parents:
5d081ff
Message:

Added a trace_get_payload_length() function which returns the original payload length for a packet - got sick of re-implementing this function everytime I wanted to know the size of the application payload.

This function currently works for TCP, UDP and ICMP packets. All other protocols
will return 0.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/libtrace.h.in

    r22e626a r15749d5  
    19981998size_t trace_get_framing_length(const libtrace_packet_t *packet);
    19991999
     2000/** Get the length of the original payload content of the packet (in bytes).
     2001 * @param packet        The packet to determine the payload length for
     2002 * @return The size of the packet payload (without headers). Returns 0 if
     2003 * unable to calculate payload length correctly.
     2004 *
     2005 * This function reports the amount of data that followed the transport header
     2006 * when the packet was originally captured, i.e. prior to any snapping. Best
     2007 * described as the wire length minus the packet headers.
     2008 *
     2009 * Currently only supports some protocols and will return 0 if an unsupported
     2010 * protocol header is encountered, or if one of the headers is truncated.
     2011 *
     2012 * @note Supports IPv4, IPv6, TCP, UDP and ICMP.
     2013 */
     2014DLLEXPORT SIMPLE_FUNCTION
     2015size_t trace_get_payload_length(const libtrace_packet_t *packet);
     2016
    20002017/** Truncate ("snap") the packet to the suggested length
    20012018 * @param packet        The packet to truncate
Note: See TracChangeset for help on using the changeset viewer.