Changeset 7baa948 for lib/libtrace.h.in


Ignore:
Timestamp:
06/27/14 13:42:59 (7 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, 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:
fb20640
Parents:
fa7faf3
Message:

Added trace_get_fragment_offset to API

New function performs all the bit-shifting, masking,
multiplying and (in the case of IPv6) header skipping necessary to
work out the fragment offset for a packet, in bytes.

Fixed trace_get_source_port and trace_get_destination_port so
that they do not try to lookup port numbers if the packet is
not the first fragment.

IPv6 fragment offsets probably need more testing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/libtrace.h.in

    rc7021d9 r7baa948  
    17791779                uint16_t *csum);
    17801780
     1781/** Calculates the fragment offset in bytes for an IP packet
     1782 * @param packet        The libtrace packet to calculate the offset for
     1783 * @param[out] more     A boolean flag to indicate whether there are more
     1784 *                      fragments after the current packet.
     1785 * @return The fragment offset for the packet in bytes. If the packet is not
     1786 * an IP packet or the fragment offset is not present in packet, the return
     1787 * value will be 0.
     1788 *
     1789 * @note The value returned is in bytes, not 8-octet units as it is stored
     1790 * in the fragment offset field in the headers. In other words, libtrace
     1791 * automatically does the multiplication for you.
     1792 *
     1793 * The value passed in for 'more' does not matter; it will be overwritten
     1794 * with the value of the More Fragments flag from the IP header.
     1795 *
     1796 * New in libtrace 3.0.20
     1797 */
     1798DLLEXPORT uint16_t trace_get_fragment_offset(const libtrace_packet_t *packet,
     1799                uint8_t *more);
     1800
    17811801/** Gets a pointer to the transport layer header (if any)
    17821802 * @param packet   The libtrace packet to find the transport header for
Note: See TracChangeset for help on using the changeset viewer.